Scippy

SCIP

Solving Constraint Integer Programs

cons_linking.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-2014 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_linking.h
17  * @ingroup CONSHDLRS
18  * @brief constraint handler for linking binary variables to an integer variable
19  * @author Stefan Heinz
20  * @author Jens Schulz
21  *
22  * The constraints handler stores linking constraints between an integer variable and an array of binary variables. Such
23  * a linking constraint has the form:
24  * \f[
25  * y = \sum_{i=1}^n {c_i * x_i}
26  * \f]
27  * with integer variable \f$ y \f$, binary variables \f$ x_1, \dots, x_n \f$ and offset \f$b \in Q\f$, and
28  * with the additional side condition that exactly one binary variable has to be one (set partitioning condition).
29  *
30  * This constraint can be created only with the integer variable. In this case the binary variables are only created on
31  * demand. That is, whenever someone asks for the binary variables. Therefore, such constraints can be used to get a
32  * "binary representation" of the domain of the integer variable which will be dynamically created.
33  */
34 
35 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
36 
37 #ifndef __SCIP_CONS_LINKING_H__
38 #define __SCIP_CONS_LINKING_H__
39 
40 
41 #include "scip/scip.h"
42 
43 #ifdef __cplusplus
44 extern "C" {
45 #endif
46 
47 /** creates the handler for linking constraints and includes it in SCIP */
48 extern
50  SCIP* scip /**< SCIP data structure */
51  );
52 
53 /** creates and captures a linking constraint
54  *
55  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
56  */
57 extern
59  SCIP* scip, /**< SCIP data structure */
60  SCIP_CONS** cons, /**< pointer to hold the created constraint */
61  const char* name, /**< name of constraint */
62  SCIP_VAR* intvar, /**< integer variable which should be linked */
63  SCIP_VAR** binvars, /**< binary variables */
64  int* vals, /**< coefficients of the binary variables */
65  int nbinvars, /**< number of binary starting variables */
66  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
67  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
68  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
69  * Usually set to TRUE. */
70  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
71  * TRUE for model constraints, FALSE for additional, redundant constraints. */
72  SCIP_Bool check, /**< should the constraint be checked for feasibility?
73  * TRUE for model constraints, FALSE for additional, redundant constraints. */
74  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
75  * Usually set to TRUE. */
76  SCIP_Bool local, /**< is constraint only valid locally?
77  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
78  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
79  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
80  * adds coefficients to this constraint. */
81  SCIP_Bool dynamic, /**< is constraint subject to aging?
82  * Usually set to FALSE. Set to TRUE for own cuts which
83  * are separated as constraints. */
84  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
85  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
86  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
87  * if it may be moved to a more global node?
88  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
89  );
90 
91 /** creates and captures a linking constraint
92  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
93  * method SCIPcreateConsLinking(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
94  *
95  * @see SCIPcreateConsLinking() for information about the basic constraint flag configuration
96  *
97  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
98  */
99 extern
101  SCIP* scip, /**< SCIP data structure */
102  SCIP_CONS** cons, /**< pointer to hold the created constraint */
103  const char* name, /**< name of constraint */
104  SCIP_VAR* intvar, /**< integer variable which should be linked */
105  SCIP_VAR** binvars, /**< binary variables, or NULL */
106  int* vals, /**< coefficients of the binary variables */
107  int nbinvars /**< number of binary variables */
108  );
109 
110 
111 /** checks if for the given integer variable a linking constraint exists */
112 extern
114  SCIP* scip, /**< SCIP data structure */
115  SCIP_VAR* intvar /**< integer variable which should be linked */
116  );
117 
118 /** returns the linking constraint belonging the given integer variable or NULL if it does not exist yet */
119 extern
121  SCIP* scip, /**< SCIP data structure */
122  SCIP_VAR* intvar /**< integer variable which should be linked */
123  );
124 
125 /** returns the integer variable of the linking constraint */
126 extern
128  SCIP* scip, /**< SCIP data structure */
129  SCIP_CONS* cons /**< linking constraint */
130  );
131 
132 /** returns the binary variables of the linking constraint */
133 extern
135  SCIP* scip, /**< SCIP data structure */
136  SCIP_CONS* cons, /**< linking constraint */
137  SCIP_VAR*** binvars, /**< pointer to store the binary variables array pointer */
138  int* nbinvars /**< pointer to store the number of returned binary variables */
139  );
140 
141 /** returns the number of binary variables of the linking constraint */
142 extern
144  SCIP* scip, /**< SCIP data structure */
145  SCIP_CONS* cons /**< linking constraint */
146  );
147 
148 /** returns the coefficients of the binary variables */
149 extern
150 int* SCIPgetValsLinking(
151  SCIP* scip, /**< SCIP data structure */
152  SCIP_CONS* cons /**< linking constraint */
153  );
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif
160