1    	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2    	/*                                                                           */
3    	/*                  This file is part of the program and library             */
4    	/*         SCIP --- Solving Constraint Integer Programs                      */
5    	/*                                                                           */
6    	/*  Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB)                      */
7    	/*                                                                           */
8    	/*  Licensed under the Apache License, Version 2.0 (the "License");          */
9    	/*  you may not use this file except in compliance with the License.         */
10   	/*  You may obtain a copy of the License at                                  */
11   	/*                                                                           */
12   	/*      http://www.apache.org/licenses/LICENSE-2.0                           */
13   	/*                                                                           */
14   	/*  Unless required by applicable law or agreed to in writing, software      */
15   	/*  distributed under the License is distributed on an "AS IS" BASIS,        */
16   	/*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17   	/*  See the License for the specific language governing permissions and      */
18   	/*  limitations under the License.                                           */
19   	/*                                                                           */
20   	/*  You should have received a copy of the Apache-2.0 license                */
21   	/*  along with SCIP; see the file LICENSE. If not visit scipopt.org.         */
22   	/*                                                                           */
23   	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24   	
25   	/**@file   cons_or.h
26   	 * @ingroup CONSHDLRS
27   	 * @brief  Constraint handler for "or" constraints,  \f$r = x_1 \vee x_2 \vee \dots  \vee x_n\f$
28   	 * @author Tobias Achterberg
29   	 * @author Stefan Heinz
30   	 * @author Michael Winkler
31   	 *
32   	 */
33   	
34   	/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35   	
36   	#ifndef __SCIP_CONS_OR_H__
37   	#define __SCIP_CONS_OR_H__
38   	
39   	
40   	#include "scip/def.h"
41   	#include "scip/type_cons.h"
42   	#include "scip/type_retcode.h"
43   	#include "scip/type_scip.h"
44   	#include "scip/type_var.h"
45   	
46   	#ifdef __cplusplus
47   	extern "C" {
48   	#endif
49   	
50   	/** creates the handler for or constraints and includes it in SCIP
51   	 *
52   	 * @ingroup ConshdlrIncludes
53   	 * */
54   	SCIP_EXPORT
55   	SCIP_RETCODE SCIPincludeConshdlrOr(
56   	   SCIP*                 scip                /**< SCIP data structure */
57   	   );
58   	
59   	/**@addtogroup CONSHDLRS
60   	 *
61   	 * @{
62   	 *
63   	 * @name OR Constraints
64   	 *
65   	 * @{
66   	 *
67   	 * This constraint handler deals with OR constraint. These are constraint of the form:
68   	 *
69   	 * \f[
70   	 *    r = x_1 \vee x_2 \vee \dots  \vee x_n
71   	 * \f]
72   	 *
73   	 * where \f$x_i\f$ is a binary variable for all \f$i\f$. Hence, \f$r\f$ is also of binary type. The variable \f$r\f$ is
74   	 * called resultant and the \f$x\f$'s operators.
75   	 */
76   	
77   	/** creates and captures an or constraint
78   	 *
79   	 *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
80   	 */
81   	SCIP_EXPORT
82   	SCIP_RETCODE SCIPcreateConsOr(
83   	   SCIP*                 scip,               /**< SCIP data structure */
84   	   SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
85   	   const char*           name,               /**< name of constraint */
86   	   SCIP_VAR*             resvar,             /**< resultant variable of the operation */
87   	   int                   nvars,              /**< number of operator variables in the constraint */
88   	   SCIP_VAR**            vars,               /**< array with operator variables of constraint */
89   	   SCIP_Bool             initial,            /**< should the LP relaxation of constraint be in the initial LP?
90   	                                              *   Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
91   	   SCIP_Bool             separate,           /**< should the constraint be separated during LP processing?
92   	                                              *   Usually set to TRUE. */
93   	   SCIP_Bool             enforce,            /**< should the constraint be enforced during node processing?
94   	                                              *   TRUE for model constraints, FALSE for additional, redundant constraints. */
95   	   SCIP_Bool             check,              /**< should the constraint be checked for feasibility?
96   	                                              *   TRUE for model constraints, FALSE for additional, redundant constraints. */
97   	   SCIP_Bool             propagate,          /**< should the constraint be propagated during node processing?
98   	                                              *   Usually set to TRUE. */
99   	   SCIP_Bool             local,              /**< is constraint only valid locally?
100  	                                              *   Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
101  	   SCIP_Bool             modifiable,         /**< is constraint modifiable (subject to column generation)?
102  	                                              *   Usually set to FALSE. In column generation applications, set to TRUE if pricing
103  	                                              *   adds coefficients to this constraint. */
104  	   SCIP_Bool             dynamic,            /**< is constraint subject to aging?
105  	                                              *   Usually set to FALSE. Set to TRUE for own cuts which
106  	                                              *   are separated as constraints. */
107  	   SCIP_Bool             removable,          /**< should the relaxation be removed from the LP due to aging or cleanup?
108  	                                              *   Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
109  	   SCIP_Bool             stickingatnode      /**< should the constraint always be kept at the node where it was added, even
110  	                                              *   if it may be moved to a more global node?
111  	                                              *   Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
112  	   );
113  	
114  	/** creates and captures an or constraint
115  	 *  in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
116  	 *  method SCIPcreateConsNonlinear(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
117  	 *
118  	 *  @see SCIPcreateConsOr() for information about the basic constraint flag configuration
119  	 *
120  	 *  @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
121  	 */
122  	SCIP_EXPORT
123  	SCIP_RETCODE SCIPcreateConsBasicOr(
124  	   SCIP*                 scip,               /**< SCIP data structure */
125  	   SCIP_CONS**           cons,               /**< pointer to hold the created constraint */
126  	   const char*           name,               /**< name of constraint */
127  	   SCIP_VAR*             resvar,             /**< resultant variable of the operation */
128  	   int                   nvars,              /**< number of operator variables in the constraint */
129  	   SCIP_VAR**            vars                /**< array with operator variables of constraint */
130  	   );
131  	
132  	/** gets number of variables in or constraint */
133  	SCIP_EXPORT
134  	int SCIPgetNVarsOr(
135  	   SCIP*                 scip,               /**< SCIP data structure */
136  	   SCIP_CONS*            cons                /**< constraint data */
137  	   );
138  	
139  	/** gets array of variables in or constraint */
140  	SCIP_EXPORT
141  	SCIP_VAR** SCIPgetVarsOr(
142  	   SCIP*                 scip,               /**< SCIP data structure */
143  	   SCIP_CONS*            cons                /**< constraint data */
144  	   );
145  	
146  	/** gets the resultant variable in or constraint */
147  	SCIP_EXPORT
148  	SCIP_VAR* SCIPgetResultantOr(
149  	   SCIP*                 scip,               /**< SCIP data structure */
150  	   SCIP_CONS*            cons                /**< constraint data */
151  	   );
152  	
153  	/** @} */
154  	
155  	/** @} */
156  	
157  	#ifdef __cplusplus
158  	}
159  	#endif
160  	
161  	#endif
162