Scippy

SCIP

Solving Constraint Integer Programs

cons_and.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-2016 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file cons_and.h
17  * @ingroup CONSHDLRS
18  * @brief Constraint handler for "and" constraints, \f$r = x_1 \wedge x_2 \wedge \dots \wedge x_n\f$
19  * @author Tobias Achterberg
20  * @author Stefan Heinz
21  * @author Michael Winkler
22  *
23  * This constraint handler deals with "and" constraint. These are constraint of the form:
24  *
25  * \f[
26  * r = x_1 \wedge x_2 \wedge \dots \wedge x_n
27  * \f]
28  *
29  * 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
30  * called resultant and the \f$x\f$'s operators.
31  */
32 
33 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
34 
35 #ifndef __SCIP_CONS_AND_H__
36 #define __SCIP_CONS_AND_H__
37 
38 
39 #include "scip/scip.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /** creates the handler for and constraints and includes it in SCIP */
46 extern
48  SCIP* scip /**< SCIP data structure */
49  );
50 
51 /** creates and captures an and constraint
52  *
53  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
54  */
55 extern
57  SCIP* scip, /**< SCIP data structure */
58  SCIP_CONS** cons, /**< pointer to hold the created constraint */
59  const char* name, /**< name of constraint */
60  SCIP_VAR* resvar, /**< resultant variable of the operation */
61  int nvars, /**< number of operator variables in the constraint */
62  SCIP_VAR** vars, /**< array with operator variables of constraint */
63  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
64  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
65  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
66  * Usually set to TRUE. */
67  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
68  * TRUE for model constraints, FALSE for additional, redundant constraints. */
69  SCIP_Bool check, /**< should the constraint be checked for feasibility?
70  * TRUE for model constraints, FALSE for additional, redundant constraints. */
71  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
72  * Usually set to TRUE. */
73  SCIP_Bool local, /**< is constraint only valid locally?
74  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
75  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
76  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
77  * adds coefficients to this constraint. */
78  SCIP_Bool dynamic, /**< is constraint subject to aging?
79  * Usually set to FALSE. Set to TRUE for own cuts which
80  * are separated as constraints. */
81  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
82  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
83  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
84  * if it may be moved to a more global node?
85  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
86  );
87 
88 /** creates and captures an and constraint
89  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
90  * method SCIPcreateConsAnd(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
91  *
92  * @see SCIPcreateConsAnd() for information about the basic constraint flag configuration
93  *
94  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
95  */
96 extern
98  SCIP* scip, /**< SCIP data structure */
99  SCIP_CONS** cons, /**< pointer to hold the created constraint */
100  const char* name, /**< name of constraint */
101  SCIP_VAR* resvar, /**< resultant variable of the operation */
102  int nvars, /**< number of operator variables in the constraint */
103  SCIP_VAR** vars /**< array with operator variables of constraint */
104  );
105 
106 /** gets number of variables in and constraint */
107 extern
108 int SCIPgetNVarsAnd(
109  SCIP* scip, /**< SCIP data structure */
110  SCIP_CONS* cons /**< constraint data */
111  );
112 
113 /** gets array of variables in and constraint */
114 extern
116  SCIP* scip, /**< SCIP data structure */
117  SCIP_CONS* cons /**< constraint data */
118  );
119 
120 /** gets the resultant variable in and constraint */
121 extern
123  SCIP* scip, /**< SCIP data structure */
124  SCIP_CONS* cons /**< constraint data */
125  );
126 
127 /** return if the variables of the and-constraint are sorted due to their indices */
128 extern
130  SCIP* scip, /**< SCIP data structure */
131  SCIP_CONS* cons /**< and-constraint */
132  );
133 
134 /** sort the variables of the and-constraint due to their indices */
135 extern
137  SCIP* scip, /**< SCIP data structure */
138  SCIP_CONS* cons /**< and-constraint */
139  );
140 
141 /** when 'upgrading' the given and-constraint, should the check flag for the upgraded constraint be set to TRUE, even if
142  * the check flag of this and-constraint is set to FALSE?
143  */
144 extern
146  SCIP* scip, /**< SCIP data structure */
147  SCIP_CONS* cons, /**< constraint data */
148  SCIP_Bool flag /**< should an arising constraint from the given and-constraint be checked,
149  * even if the check flag of the and-constraint is set to FALSE
150  */
151  );
152 
153 /** when 'upgrading' the given and-constraint, should the removable flag for the upgraded constraint be set to FALSE,
154  * even if the removable flag of this and-constraint is set to TRUE?
155  */
156 extern
158  SCIP* scip, /**< SCIP data structure */
159  SCIP_CONS* cons, /**< constraint data */
160  SCIP_Bool flag /**< should an arising constraint from the given and-constraint be not
161  * removable, even if the removable flag of the and-constraint is set to
162  * TRUE
163  */
164  );
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPincludeConshdlrAnd(SCIP *scip)
Definition: cons_and.c:4834
SCIP_RETCODE SCIPsortAndCons(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5147
SCIP_RETCODE SCIPchgAndConsCheckFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
Definition: cons_and.c:5176
SCIP_VAR * SCIPgetResultantAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5100
SCIP_VAR ** SCIPgetVarsAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5075
#define SCIP_Bool
Definition: def.h:53
SCIP_Bool SCIPisAndConsSorted(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5123
SCIP_RETCODE SCIPcreateConsAnd(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, 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)
Definition: cons_and.c:4922
SCIP_RETCODE SCIPchgAndConsRemovableFlagWhenUpgr(SCIP *scip, SCIP_CONS *cons, SCIP_Bool flag)
Definition: cons_and.c:5207
int SCIPgetNVarsAnd(SCIP *scip, SCIP_CONS *cons)
Definition: cons_and.c:5051
SCIP_RETCODE SCIPcreateConsBasicAnd(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *resvar, int nvars, SCIP_VAR **vars)
Definition: cons_and.c:5032
SCIP callable library.