Scippy

SCIP

Solving Constraint Integer Programs

cons_varbound.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-2023 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_varbound.h
26  * @ingroup CONSHDLRS
27  * @brief Constraint handler for variable bound constraints \f$lhs \leq x + c y \leq rhs\f$.
28  * @author Tobias Achterberg
29  * @author Timo Berthold
30  * @author Michael Winkler
31  * @author Gerald Gamrath
32  * @author Stefan Heinz
33  *
34  */
35 
36 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
37 
38 #ifndef __SCIP_CONS_VARBOUND_H__
39 #define __SCIP_CONS_VARBOUND_H__
40 
41 
42 #include "scip/def.h"
43 #include "scip/type_cons.h"
44 #include "scip/type_lp.h"
45 #include "scip/type_retcode.h"
46 #include "scip/type_scip.h"
47 #include "scip/type_var.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /** creates the handler for variable bound constraints and includes it in SCIP
54  *
55  * @ingroup ConshdlrIncludes
56  */
57 SCIP_EXPORT
59  SCIP* scip /**< SCIP data structure */
60  );
61 
62 /**@addtogroup CONSHDLRS
63  *
64  * @{
65  *
66  * @name Variable Bound Constraints
67  *
68  * @{
69  *
70  * This constraint handler handles a special type of linear constraints, namely variable bound constraints.
71  * A variable bound constraint has the form
72  * \f[
73  * lhs \leq x + c y \leq rhs
74  * \f]
75  * with coefficient \f$c \in Q\f$, \f$lhs\in Q \cup \{-\infty\}\f$, \f$rhs\in Q \cup \{\infty\}\f$,
76  * and decision variables \f$x\f$ (non-binary) and \f$y\f$ (binary or integer).
77  */
78 
79 /** creates and captures a variable bound constraint: lhs <= x + c*y <= rhs
80  *
81  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
82  */
83 SCIP_EXPORT
85  SCIP* scip, /**< SCIP data structure */
86  SCIP_CONS** cons, /**< pointer to hold the created constraint */
87  const char* name, /**< name of constraint */
88  SCIP_VAR* var, /**< variable x that has variable bound */
89  SCIP_VAR* vbdvar, /**< binary, integer or implicit integer bounding variable y */
90  SCIP_Real vbdcoef, /**< coefficient c of bounding variable y */
91  SCIP_Real lhs, /**< left hand side of variable bound inequality */
92  SCIP_Real rhs, /**< right hand side of variable bound inequality */
93  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
94  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
95  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
96  * Usually set to TRUE. */
97  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
98  * TRUE for model constraints, FALSE for additional, redundant constraints. */
99  SCIP_Bool check, /**< should the constraint be checked for feasibility?
100  * TRUE for model constraints, FALSE for additional, redundant constraints. */
101  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
102  * Usually set to TRUE. */
103  SCIP_Bool local, /**< is constraint only valid locally?
104  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
105  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
106  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
107  * adds coefficients to this constraint. */
108  SCIP_Bool dynamic, /**< is constraint subject to aging?
109  * Usually set to FALSE. Set to TRUE for own cuts which
110  * are separated as constraints. */
111  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
112  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
113  SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even
114  * if it may be moved to a more global node?
115  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
116  );
117 
118 /** creates and captures a varbound constraint
119  * in its most basic version, i. e., all constraint flags are set to their basic value as explained for the
120  * method SCIPcreateConsVarbound(); all flags can be set via SCIPsetConsFLAGNAME-methods in scip.h
121  *
122  * @see SCIPcreateConsVarbound() for information about the basic constraint flag configuration
123  *
124  * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
125  */
126 SCIP_EXPORT
128  SCIP* scip, /**< SCIP data structure */
129  SCIP_CONS** cons, /**< pointer to hold the created constraint */
130  const char* name, /**< name of constraint */
131  SCIP_VAR* var, /**< variable x that has variable bound */
132  SCIP_VAR* vbdvar, /**< binary, integer or implicit integer bounding variable y */
133  SCIP_Real vbdcoef, /**< coefficient c of bounding variable y */
134  SCIP_Real lhs, /**< left hand side of variable bound inequality */
135  SCIP_Real rhs /**< right hand side of variable bound inequality */
136  );
137 
138 /** gets left hand side of variable bound constraint lhs <= x + c*y <= rhs */
139 SCIP_EXPORT
141  SCIP* scip, /**< SCIP data structure */
142  SCIP_CONS* cons /**< constraint data */
143  );
144 
145 /** gets right hand side of variable bound constraint lhs <= x + c*y <= rhs */
146 SCIP_EXPORT
148  SCIP* scip, /**< SCIP data structure */
149  SCIP_CONS* cons /**< constraint data */
150  );
151 
152 /** gets bounded variable x of variable bound constraint lhs <= x + c*y <= rhs */
153 SCIP_EXPORT
155  SCIP* scip, /**< SCIP data structure */
156  SCIP_CONS* cons /**< constraint data */
157  );
158 
159 /** gets bounding variable y of variable bound constraint lhs <= x + c*y <= rhs */
160 SCIP_EXPORT
162  SCIP* scip, /**< SCIP data structure */
163  SCIP_CONS* cons /**< constraint data */
164  );
165 
166 /** gets bound coefficient c of variable bound constraint lhs <= x + c*y <= rhs */
167 SCIP_EXPORT
169  SCIP* scip, /**< SCIP data structure */
170  SCIP_CONS* cons /**< constraint data */
171  );
172 
173 /** gets the dual solution of the variable bound constraint in the current LP */
174 SCIP_EXPORT
176  SCIP* scip, /**< SCIP data structure */
177  SCIP_CONS* cons /**< constraint data */
178  );
179 
180 /** gets the dual Farkas value of the variable bound constraint in the current infeasible LP */
181 SCIP_EXPORT
183  SCIP* scip, /**< SCIP data structure */
184  SCIP_CONS* cons /**< constraint data */
185  );
186 
187 /** returns the linear relaxation of the given variable bound constraint; may return NULL if no LP row was yet created;
188  * the user must not modify the row!
189  */
190 SCIP_EXPORT
192  SCIP* scip, /**< SCIP data structure */
193  SCIP_CONS* cons /**< constraint data */
194  );
195 
196 /** cleans up (multi-)aggregations and fixings from varbound constraints */
197 SCIP_EXPORT
199  SCIP* scip, /**< SCIP data structure */
200  SCIP_Bool onlychecked, /**< should only checked constraints be cleaned up? */
201  SCIP_Bool* infeasible, /**< pointer to return whether the problem was detected to be infeasible */
202  int* naddconss, /**< pointer to count number of added (linear) constraints */
203  int* ndelconss, /**< pointer to count number of deleted (varbound) constraints */
204  int* nchgbds /**< pointer to count number of bound changes */
205  );
206 
207 /** @} */
208 
209 /** @} */
210 
211 #ifdef __cplusplus
212 }
213 #endif
214 
215 #endif
SCIP_Real SCIPgetLhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetDualsolVarbound(SCIP *scip, SCIP_CONS *cons)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_RETCODE SCIPcleanupConssVarbound(SCIP *scip, SCIP_Bool onlychecked, SCIP_Bool *infeasible, int *naddconss, int *ndelconss, int *nchgbds)
type definitions for return codes for SCIP methods
SCIP_ROW * SCIPgetRowVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_VAR * SCIPgetVarVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateConsBasicVarbound(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *var, SCIP_VAR *vbdvar, SCIP_Real vbdcoef, SCIP_Real lhs, SCIP_Real rhs)
SCIP_RETCODE SCIPcreateConsVarbound(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR *var, SCIP_VAR *vbdvar, SCIP_Real vbdcoef, SCIP_Real lhs, SCIP_Real rhs, 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)
type definitions for LP management
SCIP_Real SCIPgetRhsVarbound(SCIP *scip, SCIP_CONS *cons)
SCIP_Real SCIPgetDualfarkasVarbound(SCIP *scip, SCIP_CONS *cons)
type definitions for SCIP&#39;s main datastructure
type definitions for problem variables
SCIP_VAR * SCIPgetVbdvarVarbound(SCIP *scip, SCIP_CONS *cons)
#define SCIP_Bool
Definition: def.h:93
SCIP_Real SCIPgetVbdcoefVarbound(SCIP *scip, SCIP_CONS *cons)
#define SCIP_Real
Definition: def.h:186
common defines and data types used in all packages of SCIP
type definitions for constraints and constraint handlers
SCIP_RETCODE SCIPincludeConshdlrVarbound(SCIP *scip)