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-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_logicor.h
17  * @ingroup CONSHDLRS
18  * @brief Constraint handler for logicor constraints \f$1^T x \ge 1\f$
19  * (equivalent to set covering, but algorithms are suited for depth first search).
20  * @author Tobias Achterberg
21  * @author Michael Winkler
22  *
23  * This constraint handler handles a special type of linear constraints, namely
24  * logic or constraints. These are equivalent to set covering constraints, but
25  * are handled by special algorithms which are better suited for depth first search.
26  * For a set of binary variables \f$x_i, i=1,\dots,n\f$, a logic or constraint has the form
27  * \f[
28  * \sum_{i=1}^n x_i \ge 1.
29  * \f]
30  */
31 
32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 
34 #ifndef __SCIP_CONS_LOGICOR_H__
35 #define __SCIP_CONS_LOGICOR_H__
36 
37 
38 #include "scip/scip.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /** creates the handler for logic or constraints and includes it in SCIP */
45 extern
47  SCIP* scip /**< SCIP data structure */
48  );
49 
50 /** creates and captures a logic or constraint
51  *
52  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
53  */
54 extern
56  SCIP* scip, /**< SCIP data structure */
57  SCIP_CONS** cons, /**< pointer to hold the created constraint */
58  const char* name, /**< name of constraint */
59  int nvars, /**< number of variables in the constraint */
60  SCIP_VAR** vars, /**< array with variables of constraint entries */
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 modifiable, /**< is constraint modifiable (subject to column generation)?
74  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
75  * adds coefficients to this constraint. */
76  SCIP_Bool dynamic, /**< is constraint subject to aging?
77  * Usually set to FALSE. Set to TRUE for own cuts which
78  * are separated as constraints. */
79  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
80  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
81  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
82  * if it may be moved to a more global node?
83  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
84  );
85 
86 /** creates and captures a logicor constraint
87  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
88  * method SCIPcreateConsLogicor(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
89  *
90  * @see SCIPcreateConsLogicor() for information about the basic constraint flag configuration
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  );
102 
103 /** adds coefficient in logic or constraint */
104 extern
106  SCIP* scip, /**< SCIP data structure */
107  SCIP_CONS* cons, /**< logicor constraint */
108  SCIP_VAR* var /**< variable to add to the constraint */
109  );
110 
111 /** gets number of variables in logic or constraint */
112 extern
114  SCIP* scip, /**< SCIP data structure */
115  SCIP_CONS* cons /**< constraint data */
116  );
117 
118 /** gets array of variables in logic or constraint */
119 extern
121  SCIP* scip, /**< SCIP data structure */
122  SCIP_CONS* cons /**< constraint data */
123  );
124 
125 /** gets the dual solution of the logic or constraint in the current LP */
126 extern
128  SCIP* scip, /**< SCIP data structure */
129  SCIP_CONS* cons /**< constraint data */
130  );
131 
132 /** gets the dual Farkas value of the logic or constraint in the current infeasible LP */
133 extern
135  SCIP* scip, /**< SCIP data structure */
136  SCIP_CONS* cons /**< constraint data */
137  );
138 
139 /** returns the linear relaxation of the given logic or constraint; may return NULL if no LP row was yet created;
140  * the user must not modify the row!
141  */
142 extern
144  SCIP* scip, /**< SCIP data structure */
145  SCIP_CONS* cons /**< constraint data */
146  );
147 
148 #ifdef __cplusplus
149 }
150 #endif
151 
152 #endif
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_Real SCIPgetDualsolLogicor(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPcreateConsBasicLogicor(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars)
SCIP_Real SCIPgetDualfarkasLogicor(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPincludeConshdlrLogicor(SCIP *scip)
SCIP_ROW * SCIPgetRowLogicor(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsLogicor(SCIP *scip, SCIP_CONS *cons)
#define SCIP_Bool
Definition: def.h:53
SCIP_VAR ** SCIPgetVarsLogicor(SCIP *scip, SCIP_CONS *cons)
#define SCIP_Real
Definition: def.h:127
SCIP_RETCODE SCIPaddCoefLogicor(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var)
SCIP callable library.