Scippy

SCIP

Solving Constraint Integer Programs

cons_logicor.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (c) 2002-2024 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_logicor.h
26  * @ingroup CONSHDLRS
27  * @brief Constraint handler for logicor constraints \f$1^T x \ge 1\f$ (equivalent to set covering, but algorithms are suited for depth first search).
28  * @author Tobias Achterberg
29  * @author Michael Winkler
30  *
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #ifndef __SCIP_CONS_LOGICOR_H__
36 #define __SCIP_CONS_LOGICOR_H__
37 
38 
39 #include "scip/def.h"
40 #include "scip/type_cons.h"
41 #include "scip/type_lp.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 logic or constraints and includes it in SCIP
51  *
52  * @ingroup ConshdlrIncludes
53  * */
54 SCIP_EXPORT
56  SCIP* scip /**< SCIP data structure */
57  );
58 
59 /**@addtogroup CONSHDLRS
60  *
61  * @{
62  *
63  * @name Logicor Constraints
64  *
65  * @{
66  *
67  * This constraint handler handles a special type of linear constraints, namely
68  * logic or constraints. These are equivalent to set covering constraints, but
69  * are handled by special algorithms which are better suited for depth first search.
70  * For a set of binary variables \f$x_i, i=1,\dots,n\f$, a logic or constraint has the form
71  * \f[
72  * \sum_{i=1}^n x_i \ge 1.
73  * \f]
74  */
75 
76 /** creates and captures a logic or constraint
77  *
78  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
79  */
80 SCIP_EXPORT
82  SCIP* scip, /**< SCIP data structure */
83  SCIP_CONS** cons, /**< pointer to hold the created constraint */
84  const char* name, /**< name of constraint */
85  int nvars, /**< number of variables in the constraint */
86  SCIP_VAR** vars, /**< array with variables of constraint entries */
87  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
88  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
89  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
90  * Usually set to TRUE. */
91  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
92  * TRUE for model constraints, FALSE for additional, redundant constraints. */
93  SCIP_Bool check, /**< should the constraint be checked for feasibility?
94  * TRUE for model constraints, FALSE for additional, redundant constraints. */
95  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
96  * Usually set to TRUE. */
97  SCIP_Bool local, /**< is constraint only valid locally?
98  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
99  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
100  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
101  * adds coefficients to this constraint. */
102  SCIP_Bool dynamic, /**< is constraint subject to aging?
103  * Usually set to FALSE. Set to TRUE for own cuts which
104  * are separated as constraints. */
105  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
106  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
107  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
108  * if it may be moved to a more global node?
109  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
110  );
111 
112 /** creates and captures a logicor constraint
113  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
114  * method SCIPcreateConsLogicor(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
115  *
116  * @see SCIPcreateConsLogicor() for information about the basic constraint flag configuration
117  *
118  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
119  */
120 SCIP_EXPORT
122  SCIP* scip, /**< SCIP data structure */
123  SCIP_CONS** cons, /**< pointer to hold the created constraint */
124  const char* name, /**< name of constraint */
125  int nvars, /**< number of variables in the constraint */
126  SCIP_VAR** vars /**< array with variables of constraint entries */
127  );
128 
129 /** adds coefficient in logic or constraint */
130 SCIP_EXPORT
132  SCIP* scip, /**< SCIP data structure */
133  SCIP_CONS* cons, /**< logicor constraint */
134  SCIP_VAR* var /**< variable to add to the constraint */
135  );
136 
137 /** gets number of variables in logic or constraint */
138 SCIP_EXPORT
140  SCIP* scip, /**< SCIP data structure */
141  SCIP_CONS* cons /**< constraint data */
142  );
143 
144 /** gets array of variables in logic or constraint */
145 SCIP_EXPORT
147  SCIP* scip, /**< SCIP data structure */
148  SCIP_CONS* cons /**< constraint data */
149  );
150 
151 /** gets the dual solution of the logic or constraint in the current LP */
152 SCIP_EXPORT
154  SCIP* scip, /**< SCIP data structure */
155  SCIP_CONS* cons /**< constraint data */
156  );
157 
158 /** gets the dual Farkas value of the logic or constraint in the current infeasible LP */
159 SCIP_EXPORT
161  SCIP* scip, /**< SCIP data structure */
162  SCIP_CONS* cons /**< constraint data */
163  );
164 
165 /** returns the linear relaxation of the given logic or constraint; may return NULL if no LP row was yet created;
166  * the user must not modify the row!
167  */
168 SCIP_EXPORT
170  SCIP* scip, /**< SCIP data structure */
171  SCIP_CONS* cons /**< constraint data */
172  );
173 
174 /** cleans up (multi-)aggregations and fixings from logicor constraints */
175 SCIP_EXPORT
177  SCIP* scip, /**< SCIP data structure */
178  SCIP_Bool onlychecked, /**< should only checked constraints be cleaned up? */
179  int* naddconss, /**< pointer to count number of added (linear) constraints */
180  int* ndelconss, /**< pointer to count number of deleted (logicor) constraints */
181  int* nchgcoefs /**< pointer to count number of changed coefficients */
182  );
183 
184 /** @} */
185 
186 /** @} */
187 
188 #ifdef __cplusplus
189 }
190 #endif
191 
192 #endif
SCIP_RETCODE SCIPaddCoefLogicor(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for return codes for SCIP methods
type definitions for LP management
SCIP_Real SCIPgetDualsolLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcleanupConssLogicor(SCIP *scip, SCIP_Bool onlychecked, int *naddconss, int *ndelconss, int *nchgcoefs)
type definitions for SCIP&#39;s main datastructure
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsBasicLogicor(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
type definitions for problem variables
SCIP_ROW * SCIPgetRowLogicor(SCIP *scip, SCIP_CONS *cons)
#define SCIP_Bool
Definition: def.h:91
SCIP_Real SCIPgetDualfarkasLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsLogicor(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_RETCODE SCIPincludeConshdlrLogicor(SCIP *scip)
#define SCIP_Real
Definition: def.h:173
common defines and data types used in all packages of SCIP
type definitions for constraints and constraint handlers