Scippy

SCIP

Solving Constraint Integer Programs

cons_sos1.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_sos1.h
17  * @ingroup CONSHDLRS
18  * @brief constraint handler for SOS type 1 constraints
19  * @author Marc Pfetsch
20  *
21  * A specially ordered set of type 1 (SOS1) is a sequence of variables such that at most one
22  * variable is nonzero. The special case of two variables arises, for instance, from equilibrium or
23  * complementary conditions like \f$x \cdot y = 0\f$. Note that it is in principle allowed that a
24  * variable appears twice, but it then can be fixed to 0.
25  */
26 
27 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
28 
29 #ifndef __SCIP_CONS_SOS1_H__
30 #define __SCIP_CONS_SOS1_H__
31 
32 
33 #include "scip/scip.h"
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 /** creates the handler for SOS1 constraints and includes it in SCIP */
40 extern
42  SCIP* scip /**< SCIP data structure */
43  );
44 
45 /** creates and captures an SOS1 constraint
46  *
47  * We set the constraint to not be modifable. If the weights are non
48  * NULL, the variables are ordered according to these weights (in
49  * ascending order).
50  *
51  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
52  */
53 extern
55  SCIP* scip, /**< SCIP data structure */
56  SCIP_CONS** cons, /**< pointer to hold the created constraint */
57  const char* name, /**< name of constraint */
58  int nvars, /**< number of variables in the constraint */
59  SCIP_VAR** vars, /**< array with variables of constraint entries */
60  SCIP_Real* weights, /**< weights determining the variable order, or NULL if natural order should be used */
61  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
62  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
63  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
64  * Usually set to TRUE. */
65  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
66  * TRUE for model constraints, FALSE for additional, redundant constraints. */
67  SCIP_Bool check, /**< should the constraint be checked for feasibility?
68  * TRUE for model constraints, FALSE for additional, redundant constraints. */
69  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
70  * Usually set to TRUE. */
71  SCIP_Bool local, /**< is constraint only valid locally?
72  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
73  SCIP_Bool dynamic, /**< is constraint subject to aging?
74  * Usually set to FALSE. Set to TRUE for own cuts which
75  * are separated as constraints. */
76  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
77  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
78  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
79  * if it may be moved to a more global node?
80  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
81  );
82 
83 /** creates and captures an SOS1 constraint
84  * in its most basic variant, i. e., with all constraint flags set to their default values, which can be set
85  * afterwards using SCIPsetConsFLAGNAME() in scip.h
86  *
87  * @see SCIPcreateConsSOS1() for the default constraint flag configuration
88  *
89  * @warning Do NOT set the constraint to be modifiable manually, because this might lead
90  * to wrong results as the variable array will not be resorted
91  *
92  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
93  */
94 extern
96  SCIP* scip, /**< SCIP data structure */
97  SCIP_CONS** cons, /**< pointer to hold the created constraint */
98  const char* name, /**< name of constraint */
99  int nvars, /**< number of variables in the constraint */
100  SCIP_VAR** vars, /**< array with variables of constraint entries */
101  SCIP_Real* weights /**< weights determining the variable order, or NULL if natural order should be used */
102  );
103 
104 /** adds variable to SOS1 constraint, the position is determined by the given weight */
105 extern
107  SCIP* scip, /**< SCIP data structure */
108  SCIP_CONS* cons, /**< constraint */
109  SCIP_VAR* var, /**< variable to add to the constraint */
110  SCIP_Real weight /**< weight determining position of variable */
111  );
112 
113 /** appends variable to SOS1 constraint */
114 extern
116  SCIP* scip, /**< SCIP data structure */
117  SCIP_CONS* cons, /**< constraint */
118  SCIP_VAR* var /**< variable to add to the constraint */
119  );
120 
121 /** gets number of variables in SOS1 constraint */
122 extern
123 int SCIPgetNVarsSOS1(
124  SCIP* scip, /**< SCIP data structure */
125  SCIP_CONS* cons /**< constraint */
126  );
127 
128 /** gets array of variables in SOS1 constraint */
129 extern
131  SCIP* scip, /**< SCIP data structure */
132  SCIP_CONS* cons /**< constraint data */
133  );
134 
135 /** gets array of weights in SOS1 constraint (or NULL if not existent) */
136 extern
138  SCIP* scip, /**< SCIP data structure */
139  SCIP_CONS* cons /**< constraint data */
140  );
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 
146 #endif
147