1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 2 /* */ 3 /* This file is part of the program and library */ 4 /* SCIP --- Solving Constraint Integer Programs */ 5 /* */ 6 /* Copyright (C) 2002-2021 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 visit scipopt.org. */ 13 /* */ 14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 15 16 /**@file type_cons.h 17 * @ingroup TYPEDEFINITIONS 18 * @brief type definitions for constraints and constraint handlers 19 * @author Tobias Achterberg 20 * @author Stefan Heinz 21 * 22 * This file defines the interface for constraint handlers implemented in C. 23 * 24 * - \ref CONS "Instructions for implementing a constraint handler" 25 * - \ref CONSHDLRS "List of available constraint handlers" 26 * - \ref scip::ObjConshdlr "C++ wrapper class" 27 */ 28 29 /** @defgroup DEFPLUGINS_CONS Default constraint handlers 30 * @ingroup DEFPLUGINS 31 * @brief implementation files (.c files) of the default constraint handlers of SCIP 32 */ 33 34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 35 36 #ifndef __SCIP_TYPE_CONS_H__ 37 #define __SCIP_TYPE_CONS_H__ 38 39 #include "scip/def.h" 40 #include "scip/type_lp.h" 41 #include "scip/type_retcode.h" 42 #include "scip/type_result.h" 43 #include "scip/type_var.h" 44 #include "scip/type_sol.h" 45 #include "scip/type_scip.h" 46 #include "scip/type_timing.h" 47 #include "scip/type_heur.h" 48 49 #ifdef __cplusplus 50 extern "C" { 51 #endif 52 53 typedef struct SCIP_Conshdlr SCIP_CONSHDLR; /**< constraint handler for a specific constraint type */ 54 typedef struct SCIP_Cons SCIP_CONS; /**< constraint data structure */ 55 typedef struct SCIP_ConshdlrData SCIP_CONSHDLRDATA; /**< constraint handler data */ 56 typedef struct SCIP_ConsData SCIP_CONSDATA; /**< locally defined constraint type specific data */ 57 typedef struct SCIP_ConsSetChg SCIP_CONSSETCHG; /**< tracks additions and removals of the set of active constraints */ 58 typedef struct SCIP_LinConsStats SCIP_LINCONSSTATS; /**< linear constraint classification statistics used for MIPLIB */ 59 60 /** linear constraint types recognizable */ 61 enum SCIP_LinConstype 62 { 63 SCIP_LINCONSTYPE_EMPTY = 0, /**< linear constraints with no variables */ 64 SCIP_LINCONSTYPE_FREE = 1, /**< linear constraints with no finite side */ 65 SCIP_LINCONSTYPE_SINGLETON = 2, /**< linear constraints with a single variable */ 66 SCIP_LINCONSTYPE_AGGREGATION = 3, /**< linear constraints of the type \f$ ax + by = c\f$ */ 67 SCIP_LINCONSTYPE_PRECEDENCE = 4, /**< linear constraints of the type \f$ a x - a y \leq b\f$ where \f$x\f$ and \f$y\f$ must have the same type */ 68 SCIP_LINCONSTYPE_VARBOUND = 5, /**< linear constraints of the form \f$ ax + by \leq c \, x \in \{0,1\} \f$ */ 69 SCIP_LINCONSTYPE_SETPARTITION = 6, /**< linear constraints of the form \f$ \sum x_i = 1\, x_i \in \{0,1\} \forall i \f$ */ 70 SCIP_LINCONSTYPE_SETPACKING = 7, /**< linear constraints of the form \f$ \sum x_i \leq 1\, x_i \in \{0,1\} \forall i \f$ */ 71 SCIP_LINCONSTYPE_SETCOVERING = 8, /**< linear constraints of the form \f$ \sum x_i \geq 1\, x_i \in \{0,1\} \forall i \f$ */ 72 SCIP_LINCONSTYPE_CARDINALITY = 9, /**< linear constraints of the form \f$ \sum x_i = k\, x_i \in \{0,1\} \forall i, \, k\geq 2 \f$ */ 73 SCIP_LINCONSTYPE_INVKNAPSACK = 10, /**< linear constraints of the form \f$ \sum x_i \leq b\, x_i \in \{0,1\} \forall i, \, b\in \mathbb{n} \geq 2 \f$ */ 74 SCIP_LINCONSTYPE_EQKNAPSACK = 11, /**< linear constraints of the form \f$ \sum a_i x_i = b\, x_i \in \{0,1\} \forall i, \, b\in \mathbb{n} \geq 2 \f$ */ 75 SCIP_LINCONSTYPE_BINPACKING = 12, /**< linear constraints of the form \f$ \sum a_i x_i + a x \leq a\, x, x_i \in \{0,1\} \forall i, \, a\in \mathbb{n} \geq 2 \f$ */ 76 SCIP_LINCONSTYPE_KNAPSACK = 13, /**< linear constraints of the form \f$ \sum a_k x_k \leq b\, x_i \in \{0,1\} \forall i, \, b\in \mathbb{n} \geq 2 \f$ */ 77 SCIP_LINCONSTYPE_INTKNAPSACK = 14, /**< linear constraints of the form \f$ \sum a_k x_k \leq b\, x_i \in \mathbb{Z} \forall i, \, b\in \mathbb{n} \f$ */ 78 SCIP_LINCONSTYPE_MIXEDBINARY = 15, /**< linear constraints of the form \f$ \sum a_k x_k + \sum p_j s_j \leq/= b\, x_i \in \{0,1\} \forall i, s_j \in \text{ cont. } \forall j\f$ */ 79 SCIP_LINCONSTYPE_GENERAL = 16 /**< general linear constraints with no special structure */ 80 }; 81 typedef enum SCIP_LinConstype SCIP_LINCONSTYPE; 82 83 #define SCIP_NLINCONSTYPES ((int)SCIP_LINCONSTYPE_GENERAL+1) 84 85 /** copy method for constraint handler plugins (called when SCIP copies plugins) 86 * 87 * If the copy process was one to one, the valid pointer can be set to TRUE. Otherwise, this pointer has to be set to 88 * FALSE. If all problem defining objects (constraint handlers and variable pricers) return valid = TRUE for all 89 * their copying calls, SCIP assumes that it is an overall one to one copy of the original instance. In this case any 90 * reductions made in the copied SCIP instance can be transfered to the original SCIP instance. If the valid pointer is 91 * set to TRUE and it was not a one to one copy, it might happen that optimal solutions are cut off. 92 * 93 * input: 94 * - scip : SCIP main data structure 95 * - conshdlr : the constraint handler itself 96 * - valid : was the copying process valid? 97 */ 98 #define SCIP_DECL_CONSHDLRCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_Bool* valid) 99 100 /** destructor of constraint handler to free constraint handler data (called when SCIP is exiting) 101 * 102 * input: 103 * - scip : SCIP main data structure 104 * - conshdlr : the constraint handler itself 105 */ 106 #define SCIP_DECL_CONSFREE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr) 107 108 /** initialization method of constraint handler (called after problem was transformed) 109 * 110 * input: 111 * - scip : SCIP main data structure 112 * - conshdlr : the constraint handler itself 113 * - conss : array of constraints in transformed problem 114 * - nconss : number of constraints in transformed problem 115 */ 116 #define SCIP_DECL_CONSINIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) 117 118 /** deinitialization method of constraint handler (called before transformed problem is freed) 119 * 120 * input: 121 * - scip : SCIP main data structure 122 * - conshdlr : the constraint handler itself 123 * - conss : array of constraints in transformed problem 124 * - nconss : number of constraints in transformed problem 125 */ 126 #define SCIP_DECL_CONSEXIT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) 127 128 /** presolving initialization method of constraint handler (called when presolving is about to begin) 129 * 130 * This method is called when the presolving process is about to begin, even if presolving is turned off. 131 * The constraint handler may use this call to initialize its data structures. 132 * 133 * Necessary modifications that have to be performed even if presolving is turned off should be done here or in the 134 * presolving deinitialization call (SCIP_DECL_CONSEXITPRE()). 135 * 136 * @note Note that the constraint array might contain constraints that were created but not added to the problem. 137 * Constraints that are not added, i.e., for which SCIPconsIsAdded() returns FALSE, cannot be used for problem 138 * reductions. 139 * 140 * input: 141 * - scip : SCIP main data structure 142 * - conshdlr : the constraint handler itself 143 * - conss : array of constraints in transformed problem 144 * - nconss : number of constraints in transformed problem 145 */ 146 #define SCIP_DECL_CONSINITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) 147 148 /** presolving deinitialization method of constraint handler (called after presolving has been finished) 149 * 150 * This method is called after the presolving has been finished, even if presolving is turned off. 151 * The constraint handler may use this call e.g. to clean up or modify its data structures. 152 * 153 * Necessary modifications that have to be performed even if presolving is turned off should be done here or in the 154 * presolving initialization call (SCIP_DECL_CONSINITPRE()). 155 * 156 * Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the 157 * problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL, 158 * SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD. 159 * 160 * @note Note that the constraint array might contain constraints that were created but not added to the problem. 161 * Constraints that are not added, i.e., for which SCIPconsIsAdded() returns FALSE, cannot be used for problem 162 * reductions. 163 * 164 * input: 165 * - scip : SCIP main data structure 166 * - conshdlr : the constraint handler itself 167 * - conss : final array of constraints in transformed problem 168 * - nconss : final number of constraints in transformed problem 169 */ 170 #define SCIP_DECL_CONSEXITPRE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) 171 172 /** solving process initialization method of constraint handler (called when branch and bound process is about to begin) 173 * 174 * This method is called when the presolving was finished and the branch and bound process is about to begin. 175 * The constraint handler may use this call to initialize its branch and bound specific data. 176 * 177 * Besides necessary modifications and clean up, no time consuming operations should be performed, especially if the 178 * problem has already been solved. Use the method SCIPgetStatus(), which in this case returns SCIP_STATUS_OPTIMAL, 179 * SCIP_STATUS_INFEASIBLE, SCIP_STATUS_UNBOUNDED, or SCIP_STATUS_INFORUNBD. 180 * 181 * @note Note that the constraint array might contain constraints that were created but not added to the problem. 182 * Constraints that are not added, i.e., for which SCIPconsIsAdded() returns FALSE, cannot be used for problem 183 * reductions. 184 * 185 * input: 186 * - scip : SCIP main data structure 187 * - conshdlr : the constraint handler itself 188 * - conss : array of constraints of the constraint handler 189 * - nconss : number of constraints of the constraint handler 190 */ 191 #define SCIP_DECL_CONSINITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) 192 193 /** solving process deinitialization method of constraint handler (called before branch and bound process data is freed) 194 * 195 * This method is called before the branch and bound process is freed. 196 * The constraint handler should use this call to clean up its branch and bound data, in particular to release 197 * all LP rows that he has created or captured. 198 * 199 * input: 200 * - scip : SCIP main data structure 201 * - conshdlr : the constraint handler itself 202 * - conss : array of constraints of the constraint handler 203 * - nconss : number of constraints of the constraint handler 204 * - restart : was this exit solve call triggered by a restart? 205 */ 206 #define SCIP_DECL_CONSEXITSOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool restart) 207 208 /** frees specific constraint data 209 * 210 * @warning There may exist unprocessed events. For example, a variable's bound may have been already changed, but the 211 * corresponding bound change event was not yet processed. 212 * 213 * input: 214 * - scip : SCIP main data structure 215 * - conshdlr : the constraint handler itself 216 * - cons : the constraint belonging to the constraint data 217 * - consdata : pointer to the constraint data to free 218 */ 219 #define SCIP_DECL_CONSDELETE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, SCIP_CONSDATA** consdata) 220 221 /** transforms constraint data into data belonging to the transformed problem 222 * 223 * input: 224 * - scip : SCIP main data structure 225 * - conshdlr : the constraint handler itself 226 * - sourcecons : source constraint to transform 227 * - targetcons : pointer to store created target constraint 228 */ 229 #define SCIP_DECL_CONSTRANS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* sourcecons, SCIP_CONS** targetcons) 230 231 /** LP initialization method of constraint handler (called before the initial LP relaxation at a node is solved) 232 * 233 * Puts the LP relaxations of all "initial" constraints into the LP. The method should put a canonic LP relaxation 234 * of all given constraints to the LP with calls to SCIPaddRow(). 235 * 236 * @warning It is not guaranteed that the problem is going to be declared infeasible if the infeasible pointer is set 237 * to TRUE. Therefore, it is recommended that users do not end this method prematurely when an infeasiblity 238 * is detected. 239 * 240 * input: 241 * - scip : SCIP main data structure 242 * - conshdlr : the constraint handler itself 243 * - conss : array of constraints to process 244 * - nconss : number of constraints to process 245 * 246 * output: 247 * - infeasible : pointer to store whether an infeasibility was detected while building the LP 248 */ 249 #define SCIP_DECL_CONSINITLP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_Bool* infeasible) 250 251 /** separation method of constraint handler for LP solution 252 * 253 * Separates all constraints of the constraint handler. The method is called in the LP solution loop, 254 * which means that a valid LP solution exists. 255 * 256 * The first nusefulconss constraints are the ones, that are identified to likely be violated. The separation 257 * method should process only the useful constraints in most runs, and only occasionally the remaining 258 * nconss - nusefulconss constraints. 259 * 260 * input: 261 * - scip : SCIP main data structure 262 * - conshdlr : the constraint handler itself 263 * - conss : array of constraints to process 264 * - nconss : number of constraints to process 265 * - nusefulconss : number of useful (non-obsolete) constraints to process 266 * - result : pointer to store the result of the separation call 267 * 268 * possible return values for *result (if more than one applies, the first in the list should be used): 269 * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off 270 * - SCIP_CONSADDED : an additional constraint was generated 271 * - SCIP_REDUCEDDOM : a variable's domain was reduced 272 * - SCIP_SEPARATED : a cutting plane was generated 273 * - SCIP_NEWROUND : a cutting plane was generated and a new separation round should immediately start 274 * - SCIP_DIDNOTFIND : the separator searched, but did not find domain reductions, cutting planes, or cut constraints 275 * - SCIP_DIDNOTRUN : the separator was skipped 276 * - SCIP_DELAYED : the separator was skipped, but should be called again 277 */ 278 #define SCIP_DECL_CONSSEPALP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, \ 279 int nconss, int nusefulconss, SCIP_RESULT* result) 280 281 /** separation method of constraint handler for arbitrary primal solution 282 * 283 * Separates all constraints of the constraint handler. The method is called outside the LP solution loop (e.g., by 284 * a relaxator or a primal heuristic), which means that there is no valid LP solution. 285 * Instead, the method should produce cuts that separate the given solution. 286 * 287 * The first nusefulconss constraints are the ones, that are identified to likely be violated. The separation 288 * method should process only the useful constraints in most runs, and only occasionally the remaining 289 * nconss - nusefulconss constraints. 290 * 291 * input: 292 * - scip : SCIP main data structure 293 * - conshdlr : the constraint handler itself 294 * - conss : array of constraints to process 295 * - nconss : number of constraints to process 296 * - nusefulconss : number of useful (non-obsolete) constraints to process 297 * - sol : primal solution that should be separated 298 * - result : pointer to store the result of the separation call 299 * 300 * possible return values for *result (if more than one applies, the first in the list should be used): 301 * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off 302 * - SCIP_CONSADDED : an additional constraint was generated 303 * - SCIP_REDUCEDDOM : a variable's domain was reduced 304 * - SCIP_SEPARATED : a cutting plane was generated 305 * - SCIP_NEWROUND : a cutting plane was generated and a new separation round should immediately start 306 * - SCIP_DIDNOTFIND : the separator searched, but did not find domain reductions, cutting planes, or cut constraints 307 * - SCIP_DIDNOTRUN : the separator was skipped 308 * - SCIP_DELAYED : the separator was skipped, but should be called again 309 */ 310 #define SCIP_DECL_CONSSEPASOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, \ 311 int nconss, int nusefulconss, SCIP_SOL* sol, SCIP_RESULT* result) 312 313 /** constraint enforcing method of constraint handler for LP solutions 314 * 315 * The method is called at the end of the node processing loop for a node where the LP was solved. 316 * The LP solution has to be checked for feasibility. If possible, an infeasibility should be resolved by 317 * branching, reducing a variable's domain to exclude the solution or separating the solution with a valid 318 * cutting plane. 319 * 320 * The enforcing methods of the active constraint handlers are called in decreasing order of their enforcing 321 * priorities until the first constraint handler returned with the value SCIP_CUTOFF, SCIP_SEPARATED, 322 * SCIP_REDUCEDDOM, SCIP_CONSADDED, or SCIP_BRANCHED. 323 * The integrality constraint handler has an enforcing priority of zero. A constraint handler which can 324 * (or wants) to enforce its constraints only for integral solutions should have a negative enforcing priority 325 * (e.g. the alldiff-constraint can only operate on integral solutions). 326 * A constraint handler which wants to incorporate its own branching strategy even on non-integral 327 * solutions must have an enforcing priority greater than zero (e.g. the SOS-constraint incorporates 328 * SOS-branching on non-integral solutions). 329 * 330 * The first nusefulconss constraints are the ones, that are identified to likely be violated. The enforcing 331 * method should process the useful constraints first. The other nconss - nusefulconss constraints should only 332 * be enforced, if no violation was found in the useful constraints. 333 * 334 * input: 335 * - scip : SCIP main data structure 336 * - conshdlr : the constraint handler itself 337 * - conss : array of constraints to process 338 * - nconss : number of constraints to process 339 * - nusefulconss : number of useful (non-obsolete) constraints to process 340 * - solinfeasible : was the solution already declared infeasible by a constraint handler? 341 * - result : pointer to store the result of the enforcing call 342 * 343 * possible return values for *result (if more than one applies, the first in the list should be used): 344 * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off 345 * - SCIP_CONSADDED : an additional constraint was generated 346 * - SCIP_REDUCEDDOM : a variable's domain was reduced 347 * - SCIP_SEPARATED : a cutting plane was generated 348 * - SCIP_SOLVELP : the LP should be solved again because the LP primal feasibility tolerance has been tightened 349 * - SCIP_BRANCHED : no changes were made to the problem, but a branching was applied to resolve an infeasibility 350 * - SCIP_INFEASIBLE : at least one constraint is infeasible, but it was not resolved 351 * - SCIP_FEASIBLE : all constraints of the handler are feasible 352 */ 353 #define SCIP_DECL_CONSENFOLP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \ 354 SCIP_Bool solinfeasible, SCIP_RESULT* result) 355 356 /** constraint enforcing method of constraint handler for relaxation solutions 357 * 358 * input: 359 * - scip : SCIP main data structure 360 * - sol : relaxation solution 361 * - conshdlr : the constraint handler itself 362 * - conss : array of constraints to process 363 * - nconss : number of constraints to process 364 * - nusefulconss : number of useful (non-obsolete) constraints to process 365 * - solinfeasible : was the solution already declared infeasible by a constraint handler? 366 * - result : pointer to store the result of the enforcing call 367 * 368 * possible return values for *result (if more than one applies, the first in the list should be used): 369 * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off 370 * - SCIP_CONSADDED : an additional constraint was generated 371 * - SCIP_REDUCEDDOM : a variable's domain was reduced 372 * - SCIP_SEPARATED : a cutting plane was generated 373 * - SCIP_BRANCHED : no changes were made to the problem, but a branching was applied to resolve an infeasibility 374 * - SCIP_SOLVELP : at least one constraint is infeasible, and this can only be resolved by solving the LP 375 * - SCIP_INFEASIBLE : at least one constraint is infeasible, but it was not resolved 376 * - SCIP_FEASIBLE : all constraints of the handler are feasible 377 */ 378 #define SCIP_DECL_CONSENFORELAX(x) SCIP_RETCODE x (SCIP* scip, SCIP_SOL* sol, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \ 379 SCIP_Bool solinfeasible, SCIP_RESULT* result) 380 381 /** constraint enforcing method of constraint handler for pseudo solutions 382 * 383 * The method is called at the end of the node processing loop for a node where the LP was not solved. 384 * The pseudo solution has to be checked for feasibility. If possible, an infeasibility should be resolved by 385 * branching, reducing a variable's domain to exclude the solution or adding an additional constraint. 386 * Separation is not possible, since the LP is not processed at the current node. All LP informations like 387 * LP solution, slack values, or reduced costs are invalid and must not be accessed. 388 * 389 * Like in the enforcing method for LP solutions, the enforcing methods of the active constraint handlers are 390 * called in decreasing order of their enforcing priorities until the first constraint handler returned with 391 * the value SCIP_CUTOFF, SCIP_REDUCEDDOM, SCIP_CONSADDED, SCIP_BRANCHED, or SCIP_SOLVELP. 392 * 393 * The first nusefulconss constraints are the ones, that are identified to likely be violated. The enforcing 394 * method should process the useful constraints first. The other nconss - nusefulconss constraints should only 395 * be enforced, if no violation was found in the useful constraints. 396 * 397 * If the pseudo solution's objective value is lower than the lower bound of the node, it cannot be feasible 398 * and the enforcing method may skip it's check and set *result to SCIP_DIDNOTRUN. However, it can also process 399 * its constraints and return any other possible result code. 400 * 401 * input: 402 * - scip : SCIP main data structure 403 * - conshdlr : the constraint handler itself 404 * - conss : array of constraints to process 405 * - nconss : number of constraints to process 406 * - nusefulconss : number of useful (non-obsolete) constraints to process 407 * - solinfeasible : was the solution already declared infeasible by a constraint handler? 408 * - objinfeasible : is the solution infeasible anyway due to violating lower objective bound? 409 * - result : pointer to store the result of the enforcing call 410 * 411 * possible return values for *result (if more than one applies, the first in the list should be used): 412 * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off 413 * - SCIP_CONSADDED : an additional constraint was generated 414 * - SCIP_REDUCEDDOM : a variable's domain was reduced 415 * - SCIP_BRANCHED : no changes were made to the problem, but a branching was applied to resolve an infeasibility 416 * - SCIP_SOLVELP : at least one constraint is infeasible, and this can only be resolved by solving the LP 417 * - SCIP_INFEASIBLE : at least one constraint is infeasible, but it was not resolved 418 * - SCIP_FEASIBLE : all constraints of the handler are feasible 419 * - SCIP_DIDNOTRUN : the enforcement was skipped (only possible, if objinfeasible is true) 420 */ 421 #define SCIP_DECL_CONSENFOPS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \ 422 SCIP_Bool solinfeasible, SCIP_Bool objinfeasible, SCIP_RESULT* result) 423 424 /** feasibility check method of constraint handler for integral solutions 425 * 426 * The given solution has to be checked for feasibility. 427 * 428 * The check methods of the active constraint handlers are called in decreasing order of their check 429 * priorities until the first constraint handler returned with the result SCIP_INFEASIBLE. 430 * The integrality constraint handler has a check priority of zero. A constraint handler which can 431 * (or wants) to check its constraints only for integral solutions should have a negative check priority 432 * (e.g. the alldiff-constraint can only operate on integral solutions). 433 * A constraint handler which wants to check feasibility even on non-integral solutions must have a 434 * check priority greater than zero (e.g. if the check is much faster than testing all variables for 435 * integrality). 436 * 437 * In some cases, integrality conditions or rows of the current LP don't have to be checked, because their 438 * feasibility is already checked or implicitly given. In these cases, 'checkintegrality' or 439 * 'checklprows' is FALSE. 440 * 441 * If the solution is not NULL, SCIP should also be informed about the constraint violation with a call to 442 * SCIPupdateSolConsViolation() and additionally SCIPupdateSolLPRowViolation() for every row of the constraint's current 443 * representation in the LP relaxation, if any such rows exist. 444 * As a convenience method, SCIPupdateSolLPConsViolation() can be used if the constraint 445 * is represented completely by a set of LP rows, meaning that the current constraint violation is equal to the maximum 446 * of the contraint violations of the corresponding LP rows. 447 * 448 * input: 449 * - scip : SCIP main data structure 450 * - conshdlr : the constraint handler itself 451 * - conss : array of constraints to process 452 * - nconss : number of constraints to process 453 * - sol : the solution to check feasibility for 454 * - checkintegrality: Has integrality to be checked? 455 * - checklprows : Do constraints represented by rows in the current LP have to be checked? 456 * - printreason : Should the reason for the violation be printed? 457 * - completely : Should all violations be checked? 458 * - result : pointer to store the result of the feasibility checking call 459 * 460 * possible return values for *result: 461 * - SCIP_INFEASIBLE : at least one constraint of the handler is infeasible 462 * - SCIP_FEASIBLE : all constraints of the handler are feasible 463 */ 464 #define SCIP_DECL_CONSCHECK(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, SCIP_SOL* sol, \ 465 SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool completely, SCIP_RESULT* result) 466 467 /** domain propagation method of constraint handler 468 * 469 * The first nusefulconss constraints are the ones, that are identified to likely be violated. The propagation 470 * method should process only the useful constraints in most runs, and only occasionally the remaining 471 * nconss - nusefulconss constraints. 472 * 473 * @note if the constraint handler uses dual information in propagation it is nesassary to check via calling 474 * SCIPallowWeakDualReds and SCIPallowStrongDualReds if dual reductions and propgation with the current cutoff bound, resp., 475 * are allowed. 476 * 477 * input: 478 * - scip : SCIP main data structure 479 * - conshdlr : the constraint handler itself 480 * - conss : array of constraints to process 481 * - nconss : number of constraints to process 482 * - nusefulconss : number of useful (non-obsolete) constraints to process 483 * - nmarkedconss : number of constraints which are marked to be definitely propagated 484 * - proptiming : current point in the node solving loop 485 * - result : pointer to store the result of the propagation call 486 * 487 * possible return values for *result: 488 * - SCIP_CUTOFF : the node is infeasible in the variable's bounds and can be cut off 489 * - SCIP_REDUCEDDOM : at least one domain reduction was found 490 * - SCIP_DIDNOTFIND : the propagator searched but did not find any domain reductions 491 * - SCIP_DIDNOTRUN : the propagator was skipped 492 * - SCIP_DELAYED : the propagator was skipped, but should be called again 493 * - SCIP_DELAYNODE : the current node should be postponed (return value only valid for BEFORELP propagation) 494 */ 495 #define SCIP_DECL_CONSPROP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nusefulconss, \ 496 int nmarkedconss, SCIP_PROPTIMING proptiming, SCIP_RESULT* result) 497 498 /** presolving method of constraint handler 499 * 500 * The presolver should go through the variables and constraints and tighten the domains or 501 * constraints. Each tightening should increase the given total number of changes. 502 * 503 * input: 504 * - scip : SCIP main data structure 505 * - conshdlr : the constraint handler itself 506 * - conss : array of constraints to process 507 * - nconss : number of constraints to process 508 * - nrounds : number of presolving rounds already done 509 * - presoltiming : current presolving timing 510 * - nnewfixedvars : number of variables fixed since the last call to the presolving method 511 * - nnewaggrvars : number of variables aggregated since the last call to the presolving method 512 * - nnewchgvartypes : number of variable type changes since the last call to the presolving method 513 * - nnewchgbds : number of variable bounds tightened since the last call to the presolving method 514 * - nnewholes : number of domain holes added since the last call to the presolving method 515 * - nnewdelconss : number of deleted constraints since the last call to the presolving method 516 * - nnewaddconss : number of added constraints since the last call to the presolving method 517 * - nnewupgdconss : number of upgraded constraints since the last call to the presolving method 518 * - nnewchgcoefs : number of changed coefficients since the last call to the presolving method 519 * - nnewchgsides : number of changed left or right hand sides since the last call to the presolving method 520 * 521 * @note the counters state the changes since the last call including the changes of this presolving method during its 522 * call 523 * 524 * @note if the constraint handler performs dual presolving it is nesassary to check via calling SCIPallowWeakDualReds 525 * and SCIPallowStrongDualReds if dual reductions are allowed. 526 * 527 * input/output: 528 * - nfixedvars : pointer to count total number of variables fixed of all presolvers 529 * - naggrvars : pointer to count total number of variables aggregated of all presolvers 530 * - nchgvartypes : pointer to count total number of variable type changes of all presolvers 531 * - nchgbds : pointer to count total number of variable bounds tightened of all presolvers 532 * - naddholes : pointer to count total number of domain holes added of all presolvers 533 * - ndelconss : pointer to count total number of deleted constraints of all presolvers 534 * - naddconss : pointer to count total number of added constraints of all presolvers 535 * - nupgdconss : pointer to count total number of upgraded constraints of all presolvers 536 * - nchgcoefs : pointer to count total number of changed coefficients of all presolvers 537 * - nchgsides : pointer to count total number of changed left/right hand sides of all presolvers 538 * 539 * output: 540 * - result : pointer to store the result of the presolving call 541 * 542 * possible return values for *result: 543 * - SCIP_UNBOUNDED : at least one variable is not bounded by any constraint in obj. direction -> problem is unbounded 544 * - SCIP_CUTOFF : at least one constraint is infeasible in the variable's bounds -> problem is infeasible 545 * - SCIP_SUCCESS : the presolving method found a reduction 546 * - SCIP_DIDNOTFIND : the presolving method searched, but did not find a presolving change 547 * - SCIP_DIDNOTRUN : the presolving method was skipped 548 * - SCIP_DELAYED : the presolving method was skipped, but should be called again 549 */ 550 #define SCIP_DECL_CONSPRESOL(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss, int nrounds, \ 551 SCIP_PRESOLTIMING presoltiming, int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, \ 552 int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, \ 553 int* nfixedvars, int* naggrvars, int* nchgvartypes, int* nchgbds, int* naddholes, \ 554 int* ndelconss, int* naddconss, int* nupgdconss, int* nchgcoefs, int* nchgsides, SCIP_RESULT* result) 555 556 /** propagation conflict resolving method of constraint handler 557 * 558 * This method is called during conflict analysis. If the constraint handler wants to support conflict analysis, 559 * it should call SCIPinferVarLbCons() or SCIPinferVarUbCons() in domain propagation instead of SCIPchgVarLb() or 560 * SCIPchgVarUb() in order to deduce bound changes on variables. 561 * In the SCIPinferVarLbCons() and SCIPinferVarUbCons() calls, the handler provides the constraint, that deduced the 562 * variable's bound change, and an integer value "inferinfo" that can be arbitrarily chosen. 563 * The propagation conflict resolving method can then be implemented, to provide a "reason" for the bound 564 * changes, i.e., the bounds of variables at the time of the propagation, that forced the constraint to set the 565 * conflict variable's bound to its current value. It can use the "inferinfo" tag to identify its own propagation 566 * rule and thus identify the "reason" bounds. The bounds that form the reason of the assignment must then be provided 567 * by calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(), SCIPaddConflictRelaxedLb(), 568 * SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), and/or SCIPaddConflictBinvar() in the propagation conflict 569 * resolving method. 570 * 571 * For example, the logicor constraint c = "x or y or z" fixes variable z to TRUE (i.e. changes the lower bound of z 572 * to 1.0), if both, x and y, are assigned to FALSE (i.e. if the upper bounds of these variables are 0.0). It uses 573 * SCIPinferVarLbCons(scip, z, 1.0, c, 0) to apply this assignment (an inference information tag is not needed by the 574 * constraint handler and is set to 0). 575 * In the conflict analysis, the constraint handler may be asked to resolve the lower bound change on z with 576 * constraint c, that was applied at a time given by a bound change index "bdchgidx". 577 * With a call to SCIPgetVarLbAtIndex(scip, z, bdchgidx, TRUE), the handler can find out, that the lower bound of 578 * variable z was set to 1.0 at the given point of time, and should call SCIPaddConflictUb(scip, x, bdchgidx) and 579 * SCIPaddConflictUb(scip, y, bdchgidx) to tell SCIP, that the upper bounds of x and y at this point of time were 580 * the reason for the deduction of the lower bound of z. 581 * 582 * input: 583 * - scip : SCIP main data structure 584 * - conshdlr : the constraint handler itself 585 * - cons : the constraint that deduced the bound change of the conflict variable 586 * - infervar : the conflict variable whose bound change has to be resolved 587 * - inferinfo : the user information passed to the corresponding SCIPinferVarLbCons() or SCIPinferVarUbCons() call 588 * - boundtype : the type of the changed bound (lower or upper bound) 589 * - bdchgidx : the index of the bound change, representing the point of time where the change took place 590 * - relaxedbd : the relaxed bound which is sufficient to be explained 591 * 592 * output: 593 * - result : pointer to store the result of the propagation conflict resolving call 594 * 595 * possible return values for *result: 596 * - SCIP_SUCCESS : the conflicting bound change has been successfully resolved by adding all reason bounds 597 * - SCIP_DIDNOTFIND : the conflicting bound change could not be resolved and has to be put into the conflict set 598 * 599 * @note it is sufficient to explain/resolve the relaxed bound 600 */ 601 #define SCIP_DECL_CONSRESPROP(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, \ 602 SCIP_VAR* infervar, int inferinfo, SCIP_BOUNDTYPE boundtype, SCIP_BDCHGIDX* bdchgidx, SCIP_Real relaxedbd, \ 603 SCIP_RESULT* result) 604 605 /** variable rounding lock method of constraint handler 606 * 607 * This method is called, after a constraint is added or removed from the transformed problem. 608 * It should update the rounding locks of the given type of all associated variables with calls to 609 * SCIPaddVarLocksType(), depending on the way, the variable is involved in the constraint: 610 * - If the constraint may get violated by decreasing the value of a variable, it should call 611 * SCIPaddVarLocksType(scip, var, locktype, nlockspos, nlocksneg), saying that rounding down is 612 * potentially rendering the (positive) constraint infeasible and rounding up is potentially rendering the 613 * negation of the constraint infeasible. 614 * - If the constraint may get violated by increasing the value of a variable, it should call 615 * SCIPaddVarLocksType(scip, var, locktype, nlocksneg, nlockspos), saying that rounding up is 616 * potentially rendering the constraint's negation infeasible and rounding up is potentially rendering the 617 * constraint itself infeasible. 618 * - If the constraint may get violated by changing the variable in any direction, it should call 619 * SCIPaddVarLocksType(scip, var, locktype, nlockspos + nlocksneg, nlockspos + nlocksneg). 620 * 621 * Consider the linear constraint "3x -5y +2z <= 7" as an example. The variable rounding lock method of the 622 * linear constraint handler should call SCIPaddVarLocksType(scip, x, locktype, nlocksneg, nlockspos), 623 * SCIPaddVarLocksType(scip, y, locktype, nlockspos, nlocksneg) and 624 * SCIPaddVarLocksType(scip, z, type, nlocksneg, nlockspos) to tell SCIP, that rounding up of x and z and rounding 625 * down of y can destroy the feasibility of the constraint, while rounding down of x and z and rounding up of y can 626 * destroy the feasibility of the constraint's negation "3x -5y +2z > 7". 627 * A linear constraint "2 <= 3x -5y +2z <= 7" should call 628 * SCIPaddVarLocksType(scip, ..., nlockspos + nlocksneg, nlockspos + nlocksneg) on all variables, since rounding in both 629 * directions of each variable can destroy both the feasibility of the constraint and it's negation 630 * "3x -5y +2z < 2 or 3x -5y +2z > 7". 631 * 632 * If the constraint itself contains other constraints as sub constraints (e.g. the "or" constraint concatenation 633 * "c(x) or d(x)"), the rounding lock methods of these constraints should be called in a proper way. 634 * - If the constraint may get violated by the violation of the sub constraint c, it should call 635 * SCIPaddConsLocksType(scip, c, locktype, nlockspos, nlocksneg), saying that infeasibility of c may lead to 636 * infeasibility of the (positive) constraint, and infeasibility of c's negation (i.e. feasibility of c) may lead 637 * to infeasibility of the constraint's negation (i.e. feasibility of the constraint). 638 * - If the constraint may get violated by the feasibility of the sub constraint c, it should call 639 * SCIPaddConsLocksType(scip, c, locktype, nlocksneg, nlockspos), saying that infeasibility of c may lead to 640 * infeasibility of the constraint's negation (i.e. feasibility of the constraint), and infeasibility of c's negation 641 * (i.e. feasibility of c) may lead to infeasibility of the (positive) constraint. 642 * - If the constraint may get violated by any change in the feasibility of the sub constraint c, it should call 643 * SCIPaddConsLocksType(scip, c, locktype, nlockspos + nlocksneg, nlockspos + nlocksneg). 644 * 645 * Consider the or concatenation "c(x) or d(x)". The variable rounding lock method of the or constraint handler 646 * should call SCIPaddConsLocksType(scip, c, locktype, nlockspos, nlocksneg) and 647 * SCIPaddConsLocksType(scip, d, locktype, nlockspos, nlocksneg) to tell SCIP, that infeasibility of c and d can lead 648 * to infeasibility of "c(x) or d(x)". 649 * 650 * As a second example, consider the equivalence constraint "y <-> c(x)" with variable y and constraint c. The 651 * constraint demands, that y == 1 if and only if c(x) is satisfied. The variable lock method of the corresponding 652 * constraint handler should call SCIPaddVarLocksType(scip, y, locktype, nlockspos + nlocksneg, nlockspos + nlocksneg) and 653 * SCIPaddConsLocksType(scip, c, locktype, nlockspos + nlocksneg, nlockspos + nlocksneg), because any modification to the 654 * value of y or to the feasibility of c can alter the feasibility of the equivalence constraint. 655 * 656 * input: 657 * - scip : SCIP main data structure 658 * - conshdlr : the constraint handler itself 659 * - cons : the constraint that should lock rounding of its variables, or NULL if the constraint handler 660 * does not need constraints 661 * - locktype : type of rounding locks, i.e., SCIP_LOCKTYPE_MODEL or SCIP_LOCKTYPE_CONFLICT 662 * - nlockspos : number of times, the roundings should be locked for the constraint (may be negative) 663 * - nlocksneg : number of times, the roundings should be locked for the constraint's negation (may be negative) 664 */ 665 #define SCIP_DECL_CONSLOCK(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, SCIP_LOCKTYPE locktype, int nlockspos, int nlocksneg) 666 667 /** constraint activation notification method of constraint handler 668 * 669 * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but 670 * the corresponding bound change event was not yet processed. 671 * 672 * This method is always called after a constraint of the constraint handler was activated. The constraint 673 * handler may use this call to update his own (statistical) data. 674 * 675 * input: 676 * - scip : SCIP main data structure 677 * - conshdlr : the constraint handler itself 678 * - cons : the constraint that has been activated 679 */ 680 #define SCIP_DECL_CONSACTIVE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons) 681 682 /** constraint deactivation notification method of constraint handler 683 * 684 * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but 685 * the corresponding bound change event was not yet processed. 686 * 687 * This method is always called before a constraint of the constraint handler is deactivated. The constraint 688 * handler may use this call to update his own (statistical) data. 689 * 690 * input: 691 * - scip : SCIP main data structure 692 * - conshdlr : the constraint handler itself 693 * - cons : the constraint that will be deactivated 694 */ 695 #define SCIP_DECL_CONSDEACTIVE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons) 696 697 /** constraint enabling notification method of constraint handler 698 * 699 * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but 700 * the corresponding bound change event was not yet processed. 701 * 702 * This method is always called after a constraint of the constraint handler was enabled. The constraint 703 * handler may use this call to update his own (statistical) data. 704 * 705 * input: 706 * - scip : SCIP main data structure 707 * - conshdlr : the constraint handler itself 708 * - cons : the constraint that has been enabled 709 */ 710 #define SCIP_DECL_CONSENABLE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons) 711 712 /** constraint disabling notification method of constraint handler 713 * 714 * WARNING! There may exist unprocessed events. For example, a variable's bound may have been already changed, but 715 * the corresponding bound change event was not yet processed. 716 * 717 * This method is always called before a constraint of the constraint handler is disabled. The constraint 718 * handler may use this call to update his own (statistical) data. 719 * 720 * input: 721 * - scip : SCIP main data structure 722 * - conshdlr : the constraint handler itself 723 * - cons : the constraint that will be disabled 724 */ 725 #define SCIP_DECL_CONSDISABLE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons) 726 727 /** variable deletion method of constraint handler 728 * 729 * This method is optinal and only of interest if you are using SCIP as a branch-and-price framework. That means, you 730 * are generating new variables during the search. If you are not doing that just define the function pointer to be 731 * NULL. 732 * 733 * If this method gets implemented you should iterate over all constraints of the constraint handler and delete all 734 * variables that were marked for deletion by SCIPdelVar(). 735 * 736 * input: 737 * - scip : SCIP main data structure 738 * - conshdlr : the constraint handler itself 739 * - conss : array of constraints in transformed problem 740 * - nconss : number of constraints in transformed problem 741 */ 742 #define SCIP_DECL_CONSDELVARS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** conss, int nconss) 743 744 /** constraint display method of constraint handler 745 * 746 * The constraint handler can store a representation of the constraint into the given text file. Use the method 747 * SCIPinfoMessage() to push a string into the file stream. 748 * 749 * @note There are several methods which help to display variables. These are SCIPwriteVarName(), SCIPwriteVarsList(), 750 * SCIPwriteVarsLinearsum(), and SCIPwriteVarsPolynomial(). 751 * 752 * input: 753 * - scip : SCIP main data structure 754 * - conshdlr : the constraint handler itself 755 * - cons : the constraint that should be displayed 756 * - file : the text file to store the information into 757 */ 758 #define SCIP_DECL_CONSPRINT(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, FILE* file) 759 760 /** constraint copying method of constraint handler 761 * 762 * The constraint handler can provide a copy method which copies a constraint from one SCIP data structure into an other 763 * SCIP data structure. If a copy of a constraint is created, the constraint has to be captured. (The capture is usually 764 * already done due to the creation of the constraint). 765 * 766 * If the copy process was one to one, the valid pointer can be set to TRUE. Otherwise, you have to set this pointer to 767 * FALSE. In case all problem defining objects (constraint handlers and variable pricers) return a TRUE valid for all 768 * their copying calls, SCIP assumes that it is a overall one to one copy of the original instance. In this case any 769 * reductions made in the copied SCIP instance can be transfered to the original SCIP instance. If the valid pointer is 770 * set to TRUE and it was not a one to one copy, it might happen that optimal solutions are cut off. 771 * 772 * To get a copy of a variable in the target SCIP you should use the function SCIPgetVarCopy(). 773 * 774 * input: 775 * - scip : target SCIP data structure 776 * - cons : pointer to store the created target constraint 777 * - name : name of constraint, or NULL if the name of the source constraint should be used 778 * - sourcescip : source SCIP data structure 779 * - sourceconshdlr : source constraint handler of the source SCIP 780 * - sourcecons : source constraint of the source SCIP 781 * - varmap : a SCIP_HASHMAP mapping variables of the source SCIP to corresponding variables of the target SCIP 782 * - consmap : a SCIP_HASHMAP mapping constraints of the source SCIP to corresponding constraints of the target SCIP 783 * - initial : should the LP relaxation of constraint be in the initial LP? 784 * - separate : should the constraint be separated during LP processing? 785 * - enforce : should the constraint be enforced during node processing? 786 * - check : should the constraint be checked for feasibility? 787 * - propagate : should the constraint be propagated during node processing? 788 * - local : is constraint only valid locally? 789 * - modifiable : is constraint modifiable (subject to column generation)? 790 * - dynamic : is constraint subject to aging? 791 * - removable : should the relaxation be removed from the LP due to aging or cleanup? 792 * - stickingatnode : should the constraint always be kept at the node where it was added, even 793 * if it may be moved to a more global node? 794 * - global : should a global or a local copy be created? 795 * 796 * output: 797 * - valid : pointer to store whether the copying was valid or not 798 */ 799 #define SCIP_DECL_CONSCOPY(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONS** cons, const char* name, \ 800 SCIP* sourcescip, SCIP_CONSHDLR* sourceconshdlr, SCIP_CONS* sourcecons, SCIP_HASHMAP* varmap, SCIP_HASHMAP* consmap, \ 801 SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, \ 802 SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, \ 803 SCIP_Bool global, SCIP_Bool* valid) 804 805 /** constraint parsing method of constraint handler 806 * 807 * The constraint handler can provide a callback to parse the output created by the display method 808 * (\ref SCIP_DECL_CONSPRINT) and to create a constraint out of it. 809 * 810 * @note For parsing there are several methods which are handy. Have a look at: SCIPparseVarName(), 811 * SCIPparseVarsList(), SCIPparseVarsLinearsum(), SCIPparseVarsPolynomial(), SCIPstrToRealValue(), and 812 * SCIPstrCopySection(). 813 * 814 * input: 815 * - scip : SCIP main data structure 816 * - conshdlr : the constraint handler itself 817 * - cons : pointer to store the created constraint 818 * - name : name of the constraint 819 * - str : string to parse 820 * - initial : should the LP relaxation of constraint be in the initial LP? 821 * - separate : should the constraint be separated during LP processing? 822 * - enforce : should the constraint be enforced during node processing? 823 * - check : should the constraint be checked for feasibility? 824 * - propagate : should the constraint be propagated during node processing? 825 * - local : is constraint only valid locally? 826 * - modifiable : is constraint modifiable (subject to column generation)? 827 * - dynamic : is constraint subject to aging? 828 * - removable : should the relaxation be removed from the LP due to aging or cleanup? 829 * - stickingatnode : should the constraint always be kept at the node where it was added, even 830 * if it may be moved to a more global node? 831 * output: 832 * - success : pointer to store whether the parsing was successful or not 833 */ 834 #define SCIP_DECL_CONSPARSE(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS** cons, \ 835 const char* name, const char* str, \ 836 SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, \ 837 SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool* success) 838 839 /** constraint method of constraint handler which returns the variables (if possible) 840 * 841 * The constraint handler can (this callback is optional) provide this callback to return the variables which are 842 * involved in that particular constraint. If this is possible, the variables should be copyied into the variables 843 * array and the success pointers has to be set to TRUE. Otherwise the success has to be set FALSE or the callback 844 * should not be implemented. 845 * 846 * input: 847 * - scip : SCIP main data structure 848 * - conshdlr : the constraint handler itself 849 * - cons : the constraint that should return its variable data 850 * - varssize : available slots in vars array which is needed to check if the array is large enough 851 * 852 * output: 853 * - vars : array to store/copy the involved variables of the constraint 854 * - success : pointer to store whether the variables are successfully copied 855 */ 856 #define SCIP_DECL_CONSGETVARS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, \ 857 SCIP_VAR** vars, int varssize, SCIP_Bool* success) 858 859 /** constraint method of constraint handler which returns the number of variables (if possible) 860 * 861 * The constraint handler can (this callback is optional) provide this callback to return the number variable which are 862 * involved in that particular constraint. If this is not possible, the success pointers has to be set to FALSE or the 863 * callback should not be implemented. 864 * 865 * input: 866 * - scip : SCIP main data structure 867 * - conshdlr : the constraint handler itself 868 * - cons : constraint for which the number of variables is wanted 869 * 870 * output: 871 * - nvars : pointer to store the number of variables 872 * - success : pointer to store whether the constraint successfully returned the number of variables 873 */ 874 #define SCIP_DECL_CONSGETNVARS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_CONS* cons, \ 875 int* nvars, SCIP_Bool* success) 876 877 /** constraint handler method to suggest dive bound changes during the generic diving algorithm 878 * 879 * This callback is used inside the various diving heuristics of SCIP and does not affect the normal branching of the 880 * actual search. The constraint handler can provide this callback to render the current solution (even more) 881 * infeasible by suggesting one or several variable bound changes. In fact, since diving heuristics do not necessarily 882 * solve LP relaxations at every probing depth, some of the variable local bounds might already be conflicting with the 883 * solution values. The solution is rendered infeasible by determining bound changes that should be applied to the 884 * next explored search node via SCIPaddDiveBoundChange(). An alternative in case that the preferred bound change(s) 885 * were detected infeasible must be provided. 886 * 887 * The constraint handler must take care to only add bound changes that further shrink the variable domain. 888 * 889 * The success pointer must be used to indicate whether the constraint handler succeeded in selecting diving bound 890 * changes. The infeasible pointer should be set to TRUE if the constraint handler found a local infeasibility. If the 891 * constraint handler needs to select between several candidates, it may use the scoring mechanism of the diveset 892 * argument to control its choice. 893 * 894 * This callback is optional. 895 * 896 * @note: @p sol is usually the LP relaxation solution unless the caller of the method, usually a diving heuristic, 897 * does not solve LP relaxations at every depth 898 * 899 * input: 900 * - scip : SCIP main data structure 901 * - conshdlr : the constraint handler itself 902 * - diveset : diving settings for scoring 903 * - sol : current diving solution, usually the LP relaxation solution 904 * 905 * output: 906 * - success : pointer to store whether the constraint handler succeeded to determine dive bound changes 907 * - infeasible : pointer to store whether the constraint handler detected an infeasibility in the local node 908 */ 909 #define SCIP_DECL_CONSGETDIVEBDCHGS(x) SCIP_RETCODE x (SCIP* scip, SCIP_CONSHDLR* conshdlr, SCIP_DIVESET* diveset, \ 910 SCIP_SOL* sol, SCIP_Bool* success, SCIP_Bool* infeasible) 911 912 #ifdef __cplusplus 913 } 914 #endif 915 916 #endif 917