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 cons.h 17 * @ingroup INTERNALAPI 18 * @brief internal methods for constraints and constraint handlers 19 * @author Tobias Achterberg 20 */ 21 22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 23 24 #ifndef __SCIP_CONS_H__ 25 #define __SCIP_CONS_H__ 26 27 28 #include "scip/def.h" 29 #include "blockmemshell/memory.h" 30 #include "scip/type_retcode.h" 31 #include "scip/type_result.h" 32 #include "scip/type_set.h" 33 #include "scip/type_stat.h" 34 #include "scip/type_mem.h" 35 #include "scip/type_misc.h" 36 #include "scip/type_timing.h" 37 #include "scip/type_lp.h" 38 #include "scip/type_var.h" 39 #include "scip/type_prob.h" 40 #include "scip/type_sol.h" 41 #include "scip/type_tree.h" 42 #include "scip/type_sepastore.h" 43 #include "scip/type_cons.h" 44 #include "scip/type_branch.h" 45 #include "scip/type_reopt.h" 46 #include "scip/pub_cons.h" 47 48 #ifndef NDEBUG 49 #include "scip/struct_cons.h" 50 #endif 51 52 #ifdef __cplusplus 53 extern "C" { 54 #endif 55 56 /* 57 * Constraint handler methods 58 */ 59 60 /** copies the given constraint handler to a new scip */ 61 SCIP_RETCODE SCIPconshdlrCopyInclude( 62 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 63 SCIP_SET* set, /**< SCIP_SET of SCIP to copy to */ 64 SCIP_Bool* valid /**< was the copying process valid? */ 65 ); 66 67 /** creates a constraint handler */ 68 SCIP_RETCODE SCIPconshdlrCreate( 69 SCIP_CONSHDLR** conshdlr, /**< pointer to constraint handler data structure */ 70 SCIP_SET* set, /**< global SCIP settings */ 71 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 72 BMS_BLKMEM* blkmem, /**< block memory for parameter settings */ 73 const char* name, /**< name of constraint handler */ 74 const char* desc, /**< description of constraint handler */ 75 int sepapriority, /**< priority of the constraint handler for separation */ 76 int enfopriority, /**< priority of the constraint handler for constraint enforcing */ 77 int checkpriority, /**< priority of the constraint handler for checking feasibility (and propagation) */ 78 int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */ 79 int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */ 80 int eagerfreq, /**< frequency for using all instead of only the useful constraints in separation, 81 * propagation and enforcement, -1 for no eager evaluations, 0 for first only */ 82 int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */ 83 SCIP_Bool delaysepa, /**< should separation method be delayed, if other separators found cuts? */ 84 SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */ 85 SCIP_Bool needscons, /**< should the constraint handler be skipped, if no constraints are available? */ 86 SCIP_PROPTIMING proptiming, /**< positions in the node solving loop where propagation method of constraint handlers should be executed */ 87 SCIP_PRESOLTIMING presoltiming, /**< timing mask of the constraint handler's presolving method */ 88 SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */ 89 SCIP_DECL_CONSFREE ((*consfree)), /**< destructor of constraint handler */ 90 SCIP_DECL_CONSINIT ((*consinit)), /**< initialize constraint handler */ 91 SCIP_DECL_CONSEXIT ((*consexit)), /**< deinitialize constraint handler */ 92 SCIP_DECL_CONSINITPRE ((*consinitpre)), /**< presolving initialization method of constraint handler */ 93 SCIP_DECL_CONSEXITPRE ((*consexitpre)), /**< presolving deinitialization method of constraint handler */ 94 SCIP_DECL_CONSINITSOL ((*consinitsol)), /**< solving process initialization method of constraint handler */ 95 SCIP_DECL_CONSEXITSOL ((*consexitsol)), /**< solving process deinitialization method of constraint handler */ 96 SCIP_DECL_CONSDELETE ((*consdelete)), /**< free specific constraint data */ 97 SCIP_DECL_CONSTRANS ((*constrans)), /**< transform constraint data into data belonging to the transformed problem */ 98 SCIP_DECL_CONSINITLP ((*consinitlp)), /**< initialize LP with relaxations of "initial" constraints */ 99 SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */ 100 SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */ 101 SCIP_DECL_CONSENFOLP ((*consenfolp)), /**< enforcing constraints for LP solutions */ 102 SCIP_DECL_CONSENFORELAX ((*consenforelax)), /**< enforcing constraints for relaxation solutions */ 103 SCIP_DECL_CONSENFOPS ((*consenfops)), /**< enforcing constraints for pseudo solutions */ 104 SCIP_DECL_CONSCHECK ((*conscheck)), /**< check feasibility of primal solution */ 105 SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */ 106 SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method */ 107 SCIP_DECL_CONSRESPROP ((*consresprop)), /**< propagation conflict resolving method */ 108 SCIP_DECL_CONSLOCK ((*conslock)), /**< variable rounding lock method */ 109 SCIP_DECL_CONSACTIVE ((*consactive)), /**< activation notification method */ 110 SCIP_DECL_CONSDEACTIVE((*consdeactive)), /**< deactivation notification method */ 111 SCIP_DECL_CONSENABLE ((*consenable)), /**< enabling notification method */ 112 SCIP_DECL_CONSDISABLE ((*consdisable)), /**< disabling notification method */ 113 SCIP_DECL_CONSDELVARS ((*consdelvars)), /**< variable deletion method */ 114 SCIP_DECL_CONSPRINT ((*consprint)), /**< constraint display method */ 115 SCIP_DECL_CONSCOPY ((*conscopy)), /**< constraint copying method */ 116 SCIP_DECL_CONSPARSE ((*consparse)), /**< constraint parsing method */ 117 SCIP_DECL_CONSGETVARS ((*consgetvars)), /**< constraint get variables method */ 118 SCIP_DECL_CONSGETNVARS((*consgetnvars)), /**< constraint get number of variable method */ 119 SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)), /**< constraint handler diving solution enforcement method */ 120 SCIP_CONSHDLRDATA* conshdlrdata /**< constraint handler data */ 121 ); 122 123 /** calls destructor and frees memory of constraint handler */ 124 SCIP_RETCODE SCIPconshdlrFree( 125 SCIP_CONSHDLR** conshdlr, /**< pointer to constraint handler data structure */ 126 SCIP_SET* set /**< global SCIP settings */ 127 ); 128 129 /** calls init method of constraint handler */ 130 SCIP_RETCODE SCIPconshdlrInit( 131 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 132 BMS_BLKMEM* blkmem, /**< block memory */ 133 SCIP_SET* set, /**< global SCIP settings */ 134 SCIP_STAT* stat /**< dynamic problem statistics */ 135 ); 136 137 /** calls exit method of constraint handler */ 138 SCIP_RETCODE SCIPconshdlrExit( 139 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 140 BMS_BLKMEM* blkmem, /**< block memory */ 141 SCIP_SET* set, /**< global SCIP settings */ 142 SCIP_STAT* stat /**< dynamic problem statistics */ 143 ); 144 145 /** informs constraint handler that the presolving process is being started */ 146 SCIP_RETCODE SCIPconshdlrInitpre( 147 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 148 BMS_BLKMEM* blkmem, /**< block memory */ 149 SCIP_SET* set, /**< global SCIP settings */ 150 SCIP_STAT* stat /**< dynamic problem statistics */ 151 ); 152 153 /** informs constraint handler that the presolving is finished */ 154 SCIP_RETCODE SCIPconshdlrExitpre( 155 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 156 BMS_BLKMEM* blkmem, /**< block memory */ 157 SCIP_SET* set, /**< global SCIP settings */ 158 SCIP_STAT* stat /**< dynamic problem statistics */ 159 ); 160 161 /** informs constraint handler that the branch and bound process is being started */ 162 SCIP_RETCODE SCIPconshdlrInitsol( 163 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 164 BMS_BLKMEM* blkmem, /**< block memory */ 165 SCIP_SET* set, /**< global SCIP settings */ 166 SCIP_STAT* stat /**< dynamic problem statistics */ 167 ); 168 169 /** informs constraint handler that the branch and bound process data is being freed */ 170 SCIP_RETCODE SCIPconshdlrExitsol( 171 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 172 BMS_BLKMEM* blkmem, /**< block memory */ 173 SCIP_SET* set, /**< global SCIP settings */ 174 SCIP_STAT* stat, /**< dynamic problem statistics */ 175 SCIP_Bool restart /**< was this exit solve call triggered by a restart? */ 176 ); 177 178 /** calls LP initialization method of constraint handler to separate all initial active constraints */ 179 SCIP_RETCODE SCIPconshdlrInitLP( 180 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 181 BMS_BLKMEM* blkmem, /**< block memory */ 182 SCIP_SET* set, /**< global SCIP settings */ 183 SCIP_STAT* stat, /**< dynamic problem statistics */ 184 SCIP_TREE* tree, /**< branch and bound tree */ 185 SCIP_Bool initkeptconss, /**< Also initialize constraints which are valid at a more global node, 186 * but were not activated there? Should be FALSE for repeated calls at 187 * one node or if the current focusnode is a child of the former one */ 188 SCIP_Bool* cutoff /**< pointer to store whether infeasibility was detected while building the LP */ 189 ); 190 191 /** calls separator method of constraint handler to separate LP solution */ 192 SCIP_RETCODE SCIPconshdlrSeparateLP( 193 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 194 BMS_BLKMEM* blkmem, /**< block memory */ 195 SCIP_SET* set, /**< global SCIP settings */ 196 SCIP_STAT* stat, /**< dynamic problem statistics */ 197 SCIP_SEPASTORE* sepastore, /**< separation storage */ 198 int depth, /**< depth of current node */ 199 SCIP_Bool execdelayed, /**< execute separation method even if it is marked to be delayed */ 200 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 201 ); 202 203 /** calls separator method of constraint handler to separate given primal solution */ 204 SCIP_RETCODE SCIPconshdlrSeparateSol( 205 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 206 BMS_BLKMEM* blkmem, /**< block memory */ 207 SCIP_SET* set, /**< global SCIP settings */ 208 SCIP_STAT* stat, /**< dynamic problem statistics */ 209 SCIP_SEPASTORE* sepastore, /**< separation storage */ 210 SCIP_SOL* sol, /**< primal solution that should be separated */ 211 int depth, /**< depth of current node */ 212 SCIP_Bool execdelayed, /**< execute separation method even if it is marked to be delayed */ 213 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 214 ); 215 216 /** calls enforcing method of constraint handler for a relaxation solution for all constraints added after last 217 * conshdlrResetEnfo() call 218 */ 219 SCIP_RETCODE SCIPconshdlrEnforceRelaxSol( 220 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 221 BMS_BLKMEM* blkmem, /**< block memory */ 222 SCIP_SET* set, /**< global SCIP settings */ 223 SCIP_STAT* stat, /**< dynamic problem statistics */ 224 SCIP_TREE* tree, /**< branch and bound tree */ 225 SCIP_SEPASTORE* sepastore, /**< separation storage */ 226 SCIP_SOL* relaxsol, /**< solution to be enforced */ 227 SCIP_Bool solinfeasible, /**< was the solution already found out to be infeasible? */ 228 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 229 ); 230 231 /** calls enforcing method of constraint handler for LP solution for all constraints added after last 232 * conshdlrReset() call 233 */ 234 SCIP_RETCODE SCIPconshdlrEnforceLPSol( 235 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 236 BMS_BLKMEM* blkmem, /**< block memory */ 237 SCIP_SET* set, /**< global SCIP settings */ 238 SCIP_STAT* stat, /**< dynamic problem statistics */ 239 SCIP_TREE* tree, /**< branch and bound tree */ 240 SCIP_SEPASTORE* sepastore, /**< separation storage */ 241 SCIP_Bool solinfeasible, /**< was the solution already found out to be infeasible? */ 242 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 243 ); 244 245 /** calls diving solution enforcement callback of constraint handler, if it exists */ 246 SCIP_RETCODE SCIPconshdlrGetDiveBoundChanges( 247 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 248 SCIP_SET* set, /**< global SCIP settings */ 249 SCIP_DIVESET* diveset, /**< diving settings to control scoring */ 250 SCIP_SOL* sol, /**< current solution of diving mode */ 251 SCIP_Bool* success, /**< pointer to store whether constraint handler successfully found a variable */ 252 SCIP_Bool* infeasible /**< pointer to store whether the current node was detected to be infeasible */ 253 ); 254 255 /** calls enforcing method of constraint handler for pseudo solution for all constraints added after last 256 * conshdlrReset() call 257 */ 258 SCIP_RETCODE SCIPconshdlrEnforcePseudoSol( 259 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 260 BMS_BLKMEM* blkmem, /**< block memory */ 261 SCIP_SET* set, /**< global SCIP settings */ 262 SCIP_STAT* stat, /**< dynamic problem statistics */ 263 SCIP_TREE* tree, /**< branch and bound tree */ 264 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */ 265 SCIP_Bool solinfeasible, /**< was the solution already found out to be infeasible? */ 266 SCIP_Bool objinfeasible, /**< is the solution infeasible anyway due to violating lower objective bound? */ 267 SCIP_Bool forced, /**< should enforcement of pseudo solution be forced? */ 268 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 269 ); 270 271 /** calls feasibility check method of constraint handler */ 272 SCIP_RETCODE SCIPconshdlrCheck( 273 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 274 BMS_BLKMEM* blkmem, /**< block memory */ 275 SCIP_SET* set, /**< global SCIP settings */ 276 SCIP_STAT* stat, /**< dynamic problem statistics */ 277 SCIP_SOL* sol, /**< primal CIP solution */ 278 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */ 279 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */ 280 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */ 281 SCIP_Bool completely, /**< Should all violations be checked? */ 282 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 283 ); 284 285 /** calls propagation method of constraint handler */ 286 SCIP_RETCODE SCIPconshdlrPropagate( 287 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 288 BMS_BLKMEM* blkmem, /**< block memory */ 289 SCIP_SET* set, /**< global SCIP settings */ 290 SCIP_STAT* stat, /**< dynamic problem statistics */ 291 int depth, /**< depth of current node; -1 if preprocessing domain propagation */ 292 SCIP_Bool fullpropagation, /**< should all constraints be propagated (or only new ones)? */ 293 SCIP_Bool execdelayed, /**< execute propagation method even if it is marked to be delayed */ 294 SCIP_Bool instrongbranching, /**< are we currently doing strong branching? */ 295 SCIP_PROPTIMING proptiming, /**< current point in the node solving process */ 296 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 297 ); 298 299 /** calls presolving method of constraint handler */ 300 SCIP_RETCODE SCIPconshdlrPresolve( 301 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 302 BMS_BLKMEM* blkmem, /**< block memory */ 303 SCIP_SET* set, /**< global SCIP settings */ 304 SCIP_STAT* stat, /**< dynamic problem statistics */ 305 SCIP_PRESOLTIMING timing, /**< current presolving timing */ 306 int nrounds, /**< number of presolving rounds already done */ 307 int* nfixedvars, /**< pointer to total number of variables fixed of all presolvers */ 308 int* naggrvars, /**< pointer to total number of variables aggregated of all presolvers */ 309 int* nchgvartypes, /**< pointer to total number of variable type changes of all presolvers */ 310 int* nchgbds, /**< pointer to total number of variable bounds tightened of all presolvers */ 311 int* naddholes, /**< pointer to total number of domain holes added of all presolvers */ 312 int* ndelconss, /**< pointer to total number of deleted constraints of all presolvers */ 313 int* naddconss, /**< pointer to total number of added constraints of all presolvers */ 314 int* nupgdconss, /**< pointer to total number of upgraded constraints of all presolvers */ 315 int* nchgcoefs, /**< pointer to total number of changed coefficients of all presolvers */ 316 int* nchgsides, /**< pointer to total number of changed left/right hand sides of all presolvers */ 317 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 318 ); 319 320 /** enables or disables all clocks of \p conshdlr, depending on the value of the flag */ 321 void SCIPconshdlrEnableOrDisableClocks( 322 SCIP_CONSHDLR* conshdlr, /**< the constraint handler for which all clocks should be enabled or disabled */ 323 SCIP_Bool enable /**< should the clocks of the constraint handler be enabled? */ 324 ); 325 326 /** calls variable deletion method of constraint handler */ 327 SCIP_RETCODE SCIPconshdlrDelVars( 328 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 329 BMS_BLKMEM* blkmem, /**< block memory */ 330 SCIP_SET* set, /**< global SCIP settings */ 331 SCIP_STAT* stat /**< dynamic problem statistics */ 332 ); 333 334 335 /** locks rounding of variables involved in the given constraint constraint handler that doesn't need constraints */ 336 SCIP_RETCODE SCIPconshdlrLockVars( 337 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 338 SCIP_SET* set /**< global SCIP settings */ 339 ); 340 341 /** unlocks rounding of variables involved in the given constraint constraint handler that doesn't need constraints */ 342 SCIP_RETCODE SCIPconshdlrUnlockVars( 343 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 344 SCIP_SET* set /**< global SCIP settings */ 345 ); 346 347 /** 348 * callback setter methods of constraint handlers 349 */ 350 351 /** sets copy method of both the constraint handler and each associated constraint */ 352 void SCIPconshdlrSetCopy( 353 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 354 SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */ 355 SCIP_DECL_CONSCOPY ((*conscopy)) /**< constraint copying method */ 356 ); 357 358 /** sets destructor method of constraint handler */ 359 void SCIPconshdlrSetFree( 360 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 361 SCIP_DECL_CONSFREE ((*consfree)) /**< destructor of constraint handler */ 362 ); 363 364 /** sets initialization method of constraint handler */ 365 void SCIPconshdlrSetInit( 366 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 367 SCIP_DECL_CONSINIT ((*consinit)) /**< initialize constraint handler */ 368 ); 369 370 /** sets deinitialization method of constraint handler */ 371 void SCIPconshdlrSetExit( 372 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 373 SCIP_DECL_CONSEXIT ((*consexit)) /**< deinitialize constraint handler */ 374 ); 375 376 /** sets solving process initialization method of constraint handler */ 377 void SCIPconshdlrSetInitsol( 378 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 379 SCIP_DECL_CONSINITSOL((*consinitsol)) /**< solving process initialization method of constraint handler */ 380 ); 381 382 /** sets solving process deinitialization method of constraint handler */ 383 void SCIPconshdlrSetExitsol( 384 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 385 SCIP_DECL_CONSEXITSOL ((*consexitsol)) /**< solving process deinitialization method of constraint handler */ 386 ); 387 388 /** sets preprocessing initialization method of constraint handler */ 389 void SCIPconshdlrSetInitpre( 390 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 391 SCIP_DECL_CONSINITPRE((*consinitpre)) /**< preprocessing initialization method of constraint handler */ 392 ); 393 394 /** sets preprocessing deinitialization method of constraint handler */ 395 void SCIPconshdlrSetExitpre( 396 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 397 SCIP_DECL_CONSEXITPRE((*consexitpre)) /**< preprocessing deinitialization method of constraint handler */ 398 ); 399 400 /** sets presolving method of constraint handler */ 401 SCIP_RETCODE SCIPconshdlrSetPresol( 402 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 403 SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method of constraint handler */ 404 int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */ 405 SCIP_PRESOLTIMING presoltiming /**< timing mask of the constraint handler's presolving method */ 406 ); 407 408 /** sets method of constraint handler to free specific constraint data */ 409 void SCIPconshdlrSetDelete( 410 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 411 SCIP_DECL_CONSDELETE ((*consdelete)) /**< free specific constraint data */ 412 ); 413 414 /** sets method of constraint handler to transform constraint data into data belonging to the transformed problem */ 415 void SCIPconshdlrSetTrans( 416 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 417 SCIP_DECL_CONSTRANS ((*constrans)) /**< transform constraint data into data belonging to the transformed problem */ 418 ); 419 420 /** sets method of constraint handler to initialize LP with relaxations of "initial" constraints */ 421 void SCIPconshdlrSetInitlp( 422 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 423 SCIP_DECL_CONSINITLP ((*consinitlp)) /**< initialize LP with relaxations of "initial" constraints */ 424 ); 425 426 /** sets propagation conflict resolving method of constraint handler */ 427 void SCIPconshdlrSetResprop( 428 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 429 SCIP_DECL_CONSRESPROP ((*consresprop)) /**< propagation conflict resolving method */ 430 ); 431 432 /** sets activation notification method of constraint handler */ 433 void SCIPconshdlrSetActive( 434 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 435 SCIP_DECL_CONSACTIVE ((*consactive)) /**< activation notification method */ 436 ); 437 438 /** sets deactivation notification method of constraint handler */ 439 void SCIPconshdlrSetDeactive( 440 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 441 SCIP_DECL_CONSDEACTIVE((*consdeactive)) /**< deactivation notification method */ 442 ); 443 444 /** sets enabling notification method of constraint handler */ 445 void SCIPconshdlrSetEnable( 446 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 447 SCIP_DECL_CONSENABLE ((*consenable)) /**< enabling notification method */ 448 ); 449 450 /** sets disabling notification method of constraint handler */ 451 void SCIPconshdlrSetDisable( 452 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 453 SCIP_DECL_CONSDISABLE ((*consdisable)) /**< disabling notification method */ 454 ); 455 456 /** sets variable deletion method of constraint handler */ 457 void SCIPconshdlrSetDelvars( 458 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 459 SCIP_DECL_CONSDELVARS ((*consdelvars)) /**< variable deletion method */ 460 ); 461 462 /** sets constraint display method of constraint handler */ 463 void SCIPconshdlrSetPrint( 464 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 465 SCIP_DECL_CONSPRINT ((*consprint)) /**< constraint display method */ 466 ); 467 468 /** sets constraint parsing method of constraint handler */ 469 void SCIPconshdlrSetParse( 470 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 471 SCIP_DECL_CONSPARSE ((*consparse)) /**< constraint parsing method */ 472 ); 473 474 /** sets constraint variable getter method of constraint handler */ 475 void SCIPconshdlrSetGetVars( 476 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 477 SCIP_DECL_CONSGETVARS ((*consgetvars)) /**< constraint variable getter method */ 478 ); 479 480 /** sets constraint variable number getter method of constraint handler */ 481 void SCIPconshdlrSetGetNVars( 482 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 483 SCIP_DECL_CONSGETNVARS((*consgetnvars)) /**< constraint variable number getter method */ 484 ); 485 486 /** sets diving enforcement method of constraint handler */ 487 void SCIPconshdlrSetGetDiveBdChgs( 488 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 489 SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)) /**< constraint handler diving solution enforcement method */ 490 ); 491 492 /* 493 * Constraint set change methods 494 */ 495 496 /** frees constraint set change data and releases all included constraints */ 497 SCIP_RETCODE SCIPconssetchgFree( 498 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change */ 499 BMS_BLKMEM* blkmem, /**< block memory */ 500 SCIP_SET* set /**< global SCIP settings */ 501 ); 502 503 /** adds constraint addition to constraint set changes, and captures constraint; activates constraint if the 504 * constraint set change data is currently active 505 */ 506 SCIP_RETCODE SCIPconssetchgAddAddedCons( 507 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data structure */ 508 BMS_BLKMEM* blkmem, /**< block memory */ 509 SCIP_SET* set, /**< global SCIP settings */ 510 SCIP_STAT* stat, /**< dynamic problem statistics */ 511 SCIP_CONS* cons, /**< added constraint */ 512 int depth, /**< depth of constraint set change's node */ 513 SCIP_Bool focusnode, /**< does the constraint set change belong to the focus node? */ 514 SCIP_Bool active /**< is the constraint set change currently active? */ 515 ); 516 517 /** adds constraint disabling to constraint set changes, and captures constraint */ 518 SCIP_RETCODE SCIPconssetchgAddDisabledCons( 519 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data structure */ 520 BMS_BLKMEM* blkmem, /**< block memory */ 521 SCIP_SET* set, /**< global SCIP settings */ 522 SCIP_CONS* cons /**< disabled constraint */ 523 ); 524 525 /** applies constraint set change */ 526 SCIP_RETCODE SCIPconssetchgApply( 527 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to apply */ 528 BMS_BLKMEM* blkmem, /**< block memory */ 529 SCIP_SET* set, /**< global SCIP settings */ 530 SCIP_STAT* stat, /**< dynamic problem statistics */ 531 int depth, /**< depth of constraint set change's node */ 532 SCIP_Bool focusnode /**< does the constraint set change belong to the focus node? */ 533 ); 534 535 /** undoes constraint set change */ 536 SCIP_RETCODE SCIPconssetchgUndo( 537 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to undo */ 538 BMS_BLKMEM* blkmem, /**< block memory */ 539 SCIP_SET* set, /**< global SCIP settings */ 540 SCIP_STAT* stat /**< dynamic problem statistics */ 541 ); 542 543 /** applies constraint set change to the global problem and deletes the constraint set change data */ 544 SCIP_RETCODE SCIPconssetchgMakeGlobal( 545 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data */ 546 BMS_BLKMEM* blkmem, /**< block memory */ 547 SCIP_SET* set, /**< global SCIP settings */ 548 SCIP_STAT* stat, /**< dynamic problem statistics */ 549 SCIP_PROB* prob, /**< problem data */ 550 SCIP_REOPT* reopt /**< reoptimization data */ 551 ); 552 553 /** increase count of applied cuts */ 554 void SCIPconshdlrIncNAppliedCuts( 555 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 556 ); 557 558 /** increase count of found cuts */ 559 void SCIPconshdlrIncNCutsFound( 560 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 561 ); 562 563 564 565 /* 566 * Constraint methods 567 */ 568 569 /** creates and captures a constraint, and inserts it into the conss array of its constraint handler 570 * 571 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution 572 * may be declared feasible even if it violates this particular constraint. 573 * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a 574 * local constraint is redundant due to the variable's local bounds. 575 */ 576 SCIP_RETCODE SCIPconsCreate( 577 SCIP_CONS** cons, /**< pointer to constraint */ 578 BMS_BLKMEM* blkmem, /**< block memory */ 579 SCIP_SET* set, /**< global SCIP settings */ 580 const char* name, /**< name of constraint */ 581 SCIP_CONSHDLR* conshdlr, /**< constraint handler for this constraint */ 582 SCIP_CONSDATA* consdata, /**< data for this specific constraint */ 583 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? 584 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */ 585 SCIP_Bool separate, /**< should the constraint be separated during LP processing? 586 * Usually set to TRUE. */ 587 SCIP_Bool enforce, /**< should the constraint be enforced during node processing? 588 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 589 SCIP_Bool check, /**< should the constraint be checked for feasibility? 590 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 591 SCIP_Bool propagate, /**< should the constraint be propagated during node processing? 592 * Usually set to TRUE. */ 593 SCIP_Bool local, /**< is constraint only valid locally? 594 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */ 595 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? 596 * Usually set to FALSE. In column generation applications, set to TRUE if pricing 597 * adds coefficients to this constraint. */ 598 SCIP_Bool dynamic, /**< is constraint subject to aging? 599 * Usually set to FALSE. Set to TRUE for own cuts which 600 * are separated as constraints. */ 601 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? 602 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */ 603 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even 604 * if it may be moved to a more global node? 605 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */ 606 SCIP_Bool original, /**< is constraint belonging to the original problem? */ 607 SCIP_Bool deleteconsdata /**< has the constraint data to be deleted if constraint is freed? */ 608 ); 609 610 /** copies source constraint of source SCIP into the target constraint for the target SCIP, using the variable map for 611 * mapping the variables of the source SCIP to the variables of the target SCIP; if the copying process was successful 612 * a constraint is created and captured; 613 * 614 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, an LP or pseudo solution 615 * may be declared feasible even if it violates this particular constraint. 616 * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a 617 * local constraint is redundant due to the variable's local bounds. 618 */ 619 SCIP_RETCODE SCIPconsCopy( 620 SCIP_CONS** cons, /**< pointer to store the created target constraint */ 621 SCIP_SET* set, /**< global SCIP settings of the target SCIP */ 622 const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */ 623 SCIP* sourcescip, /**< source SCIP data structure */ 624 SCIP_CONSHDLR* sourceconshdlr, /**< source constraint handler for this constraint */ 625 SCIP_CONS* sourcecons, /**< source constraint of the source SCIP */ 626 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to corresponding 627 * variables of the target SCIP */ 628 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding 629 * target constraints, must not be NULL! */ 630 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? */ 631 SCIP_Bool separate, /**< should the constraint be separated during LP processing? */ 632 SCIP_Bool enforce, /**< should the constraint be enforced during node processing? */ 633 SCIP_Bool check, /**< should the constraint be checked for feasibility? */ 634 SCIP_Bool propagate, /**< should the constraint be propagated during node processing? */ 635 SCIP_Bool local, /**< is constraint only valid locally? */ 636 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? */ 637 SCIP_Bool dynamic, /**< is constraint subject to aging? */ 638 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */ 639 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even 640 * if it may be moved to a more global node? */ 641 SCIP_Bool global, /**< create a global or a local copy? */ 642 SCIP_Bool* valid /**< pointer to store whether the copying was valid or not */ 643 ); 644 645 /** parses constraint information (in cip format) out of a string; if the parsing process was successful a constraint is 646 * created, captured, and inserted into the conss array of its constraint handler. 647 * 648 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, an LP or pseudo solution 649 * may be declared feasible even if it violates this particular constraint. 650 * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a 651 * local constraint is redundant due to the variable's local bounds. 652 */ 653 SCIP_RETCODE SCIPconsParse( 654 SCIP_CONS** cons, /**< pointer to constraint */ 655 SCIP_SET* set, /**< global SCIP settings */ 656 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler of target SCIP */ 657 const char* str, /**< name of constraint */ 658 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? 659 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */ 660 SCIP_Bool separate, /**< should the constraint be separated during LP processing? 661 * Usually set to TRUE. */ 662 SCIP_Bool enforce, /**< should the constraint be enforced during node processing? 663 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 664 SCIP_Bool check, /**< should the constraint be checked for feasibility? 665 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 666 SCIP_Bool propagate, /**< should the constraint be propagated during node processing? 667 * Usually set to TRUE. */ 668 SCIP_Bool local, /**< is constraint only valid locally? 669 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */ 670 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? 671 * Usually set to FALSE. In column generation applications, set to TRUE if pricing 672 * adds coefficients to this constraint. */ 673 SCIP_Bool dynamic, /**< is constraint subject to aging? 674 * Usually set to FALSE. Set to TRUE for own cuts which 675 * are separated as constraints. */ 676 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? 677 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */ 678 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even 679 * if it may be moved to a more global node? 680 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */ 681 SCIP_Bool* success /**< pointer store if the paring process was successful */ 682 ); 683 684 /** change name of given constraint */ 685 SCIP_RETCODE SCIPconsChgName( 686 SCIP_CONS* cons, /**< problem constraint */ 687 BMS_BLKMEM* blkmem, /**< block memory buffer */ 688 const char* name /**< new name of constraint */ 689 ); 690 691 /** frees a constraint and removes it from the conss array of its constraint handler */ 692 SCIP_RETCODE SCIPconsFree( 693 SCIP_CONS** cons, /**< constraint to free */ 694 BMS_BLKMEM* blkmem, /**< block memory buffer */ 695 SCIP_SET* set /**< global SCIP settings */ 696 ); 697 698 /** increases usage counter of constraint */ 699 void SCIPconsCapture( 700 SCIP_CONS* cons /**< constraint */ 701 ); 702 703 /** decreases usage counter of constraint, and frees memory if necessary */ 704 SCIP_RETCODE SCIPconsRelease( 705 SCIP_CONS** cons, /**< pointer to constraint */ 706 BMS_BLKMEM* blkmem, /**< block memory */ 707 SCIP_SET* set /**< global SCIP settings */ 708 ); 709 710 711 /** outputs constraint information to file stream */ 712 SCIP_RETCODE SCIPconsPrint( 713 SCIP_CONS* cons, /**< constraint to print */ 714 SCIP_SET* set, /**< global SCIP settings */ 715 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */ 716 FILE* file /**< output file (or NULL for standard output) */ 717 ); 718 719 /** checks single constraint for feasibility of the given solution */ 720 SCIP_RETCODE SCIPconsCheck( 721 SCIP_CONS* cons, /**< constraint to check */ 722 SCIP_SET* set, /**< global SCIP settings */ 723 SCIP_SOL* sol, /**< primal CIP solution */ 724 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */ 725 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */ 726 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */ 727 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 728 ); 729 730 /** enforces single constraint for a given pseudo solution */ 731 SCIP_RETCODE SCIPconsEnfops( 732 SCIP_CONS* cons, /**< constraint to enforce */ 733 SCIP_SET* set, /**< global SCIP settings */ 734 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */ 735 SCIP_Bool objinfeasible, /**< is the solution infeasible anyway due to violating lower objective bound? */ 736 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 737 ); 738 739 /** enforces single constraint for a given LP solution */ 740 SCIP_RETCODE SCIPconsEnfolp( 741 SCIP_CONS* cons, /**< constraint to enforce */ 742 SCIP_SET* set, /**< global SCIP settings */ 743 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */ 744 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 745 ); 746 747 /** enforces single constraint for a given relaxation solution */ 748 SCIP_RETCODE SCIPconsEnforelax( 749 SCIP_CONS* cons, /**< constraint to enforce */ 750 SCIP_SET* set, /**< global SCIP settings */ 751 SCIP_SOL* sol, /**< solution to be enforced */ 752 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */ 753 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 754 ); 755 756 /** calls LP initialization method for single constraint */ 757 SCIP_RETCODE SCIPconsInitlp( 758 SCIP_CONS* cons, /**< constraint to initialize */ 759 SCIP_SET* set, /**< global SCIP settings */ 760 SCIP_Bool* infeasible /**< pointer to store whether infeasibility was detected while building the LP */ 761 ); 762 763 /** calls separation method of single constraint for LP solution */ 764 SCIP_RETCODE SCIPconsSepalp( 765 SCIP_CONS* cons, /**< constraint to separate */ 766 SCIP_SET* set, /**< global SCIP settings */ 767 SCIP_RESULT* result /**< pointer to store the result of the separation call */ 768 ); 769 770 /** calls separation method of single constraint for given primal solution */ 771 SCIP_RETCODE SCIPconsSepasol( 772 SCIP_CONS* cons, /**< constraint to separate */ 773 SCIP_SET* set, /**< global SCIP settings */ 774 SCIP_SOL* sol, /**< primal solution that should be separated */ 775 SCIP_RESULT* result /**< pointer to store the result of the separation call */ 776 ); 777 778 /** calls domain propagation method of single constraint */ 779 SCIP_RETCODE SCIPconsProp( 780 SCIP_CONS* cons, /**< constraint to propagate */ 781 SCIP_SET* set, /**< global SCIP settings */ 782 SCIP_PROPTIMING proptiming, /**< current point in the node solving loop */ 783 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 784 ); 785 786 /** resolves propagation conflict of single constraint */ 787 SCIP_RETCODE SCIPconsResprop( 788 SCIP_CONS* cons, /**< constraint to resolve conflict for */ 789 SCIP_SET* set, /**< global SCIP settings */ 790 SCIP_VAR* infervar, /**< the conflict variable whose bound change has to be resolved */ 791 int inferinfo, /**< the user information passed to the corresponding SCIPinferVarLbCons() or SCIPinferVarUbCons() call */ 792 SCIP_BOUNDTYPE boundtype, /**< the type of the changed bound (lower or upper bound) */ 793 SCIP_BDCHGIDX* bdchgidx, /**< the index of the bound change, representing the point of time where the change took place */ 794 SCIP_Real relaxedbd, /**< the relaxed bound which is sufficient to be explained */ 795 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 796 ); 797 798 /** presolves single constraint */ 799 SCIP_RETCODE SCIPconsPresol( 800 SCIP_CONS* cons, /**< constraint to presolve */ 801 SCIP_SET* set, /**< global SCIP settings */ 802 int nrounds, /**< number of presolving rounds already done */ 803 SCIP_PRESOLTIMING timing, /**< current presolving timing */ 804 int nnewfixedvars, /**< number of variables fixed since the last call to the presolving method */ 805 int nnewaggrvars, /**< number of variables aggregated since the last call to the presolving method */ 806 int nnewchgvartypes, /**< number of variable type changes since the last call to the presolving method */ 807 int nnewchgbds, /**< number of variable bounds tightened since the last call to the presolving method */ 808 int nnewholes, /**< number of domain holes added since the last call to the presolving method */ 809 int nnewdelconss, /**< number of deleted constraints since the last call to the presolving method */ 810 int nnewaddconss, /**< number of added constraints since the last call to the presolving method */ 811 int nnewupgdconss, /**< number of upgraded constraints since the last call to the presolving method */ 812 int nnewchgcoefs, /**< number of changed coefficients since the last call to the presolving method */ 813 int nnewchgsides, /**< number of changed left or right hand sides since the last call to the presolving method */ 814 int* nfixedvars, /**< pointer to count total number of variables fixed of all presolvers */ 815 int* naggrvars, /**< pointer to count total number of variables aggregated of all presolvers */ 816 int* nchgvartypes, /**< pointer to count total number of variable type changes of all presolvers */ 817 int* nchgbds, /**< pointer to count total number of variable bounds tightened of all presolvers */ 818 int* naddholes, /**< pointer to count total number of domain holes added of all presolvers */ 819 int* ndelconss, /**< pointer to count total number of deleted constraints of all presolvers */ 820 int* naddconss, /**< pointer to count total number of added constraints of all presolvers */ 821 int* nupgdconss, /**< pointer to count total number of upgraded constraints of all presolvers */ 822 int* nchgcoefs, /**< pointer to count total number of changed coefficients of all presolvers */ 823 int* nchgsides, /**< pointer to count total number of changed left/right hand sides of all presolvers */ 824 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 825 ); 826 827 /** calls constraint activation notification method of single constraint */ 828 SCIP_RETCODE SCIPconsActive( 829 SCIP_CONS* cons, /**< constraint to notify */ 830 SCIP_SET* set /**< global SCIP settings */ 831 ); 832 833 /** calls constraint deactivation notification method of single constraint */ 834 SCIP_RETCODE SCIPconsDeactive( 835 SCIP_CONS* cons, /**< constraint to notify */ 836 SCIP_SET* set /**< global SCIP settings */ 837 ); 838 839 /** method to collect the variables of a constraint 840 * 841 * If the number of variables is greater than the available slots in the variable array, nothing happens except that 842 * the success point is set to FALSE. With the method SCIPgetConsNVars() it is possible to get the number of variables 843 * a constraint has in its scope. 844 * 845 * @note The success pointer indicates if all variables were copied into the vars arrray. 846 * 847 * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is 848 * set to FALSE. 849 */ 850 SCIP_RETCODE SCIPconsGetVars( 851 SCIP_CONS* cons, /**< constraint to print */ 852 SCIP_SET* set, /**< global SCIP settings */ 853 SCIP_VAR** vars, /**< array to store the involved variable of the constraint */ 854 int varssize, /**< available slots in vars array which is needed to check if the array is large enough */ 855 SCIP_Bool* success /**< pointer to store whether the variables are successfully copied */ 856 ); 857 858 /** method to collect the number of variables of a constraint 859 * 860 * @note The success pointer indicates if the contraint handler was able to return the number of variables 861 * 862 * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is 863 * set to FALSE 864 */ 865 SCIP_RETCODE SCIPconsGetNVars( 866 SCIP_CONS* cons, /**< constraint to print */ 867 SCIP_SET* set, /**< global SCIP settings */ 868 int* nvars, /**< pointer to store the number of variables */ 869 SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the number of variables */ 870 ); 871 872 /** globally removes constraint from all subproblems; removes constraint from the constraint set change data of the 873 * node, where it was created, or from the problem, if it was a problem constraint 874 */ 875 SCIP_RETCODE SCIPconsDelete( 876 SCIP_CONS* cons, /**< constraint to delete */ 877 BMS_BLKMEM* blkmem, /**< block memory */ 878 SCIP_SET* set, /**< global SCIP settings */ 879 SCIP_STAT* stat, /**< dynamic problem statistics */ 880 SCIP_PROB* prob, /**< problem data */ 881 SCIP_REOPT* reopt /**< reoptimization data */ 882 ); 883 884 /** gets and captures transformed constraint of a given constraint; if the constraint is not yet transformed, 885 * a new transformed constraint for this constraint is created 886 */ 887 SCIP_RETCODE SCIPconsTransform( 888 SCIP_CONS* origcons, /**< original constraint */ 889 BMS_BLKMEM* blkmem, /**< block memory buffer */ 890 SCIP_SET* set, /**< global SCIP settings */ 891 SCIP_CONS** transcons /**< pointer to store the transformed constraint */ 892 ); 893 894 /** sets the initial flag of the given constraint */ 895 SCIP_RETCODE SCIPconsSetInitial( 896 SCIP_CONS* cons, /**< constraint */ 897 SCIP_SET* set, /**< global SCIP settings */ 898 SCIP_STAT* stat, /**< dynamic problem statistics */ 899 SCIP_Bool initial /**< new value */ 900 ); 901 902 /** sets the separate flag of the given constraint */ 903 SCIP_RETCODE SCIPconsSetSeparated( 904 SCIP_CONS* cons, /**< constraint */ 905 SCIP_SET* set, /**< global SCIP settings */ 906 SCIP_Bool separate /**< new value */ 907 ); 908 909 /** sets the enforce flag of the given constraint */ 910 SCIP_RETCODE SCIPconsSetEnforced( 911 SCIP_CONS* cons, /**< constraint */ 912 SCIP_SET* set, /**< global SCIP settings */ 913 SCIP_Bool enforce /**< new value */ 914 ); 915 916 /** sets the check flag of the given constraint */ 917 SCIP_RETCODE SCIPconsSetChecked( 918 SCIP_CONS* cons, /**< constraint */ 919 SCIP_SET* set, /**< global SCIP settings */ 920 SCIP_Bool check /**< new value */ 921 ); 922 923 /** sets the propagate flag of the given constraint */ 924 SCIP_RETCODE SCIPconsSetPropagated( 925 SCIP_CONS* cons, /**< constraint */ 926 SCIP_SET* set, /**< global SCIP settings */ 927 SCIP_Bool propagate /**< new value */ 928 ); 929 930 /** sets the local flag of the given constraint */ 931 void SCIPconsSetLocal( 932 SCIP_CONS* cons, /**< constraint */ 933 SCIP_Bool local /**< new value */ 934 ); 935 936 /** sets the modifiable flag of the given constraint */ 937 void SCIPconsSetModifiable( 938 SCIP_CONS* cons, /**< constraint */ 939 SCIP_Bool modifiable /**< new value */ 940 ); 941 942 /** sets the dynamic flag of the given constraint */ 943 void SCIPconsSetDynamic( 944 SCIP_CONS* cons, /**< constraint */ 945 SCIP_Bool dynamic /**< new value */ 946 ); 947 948 /** sets the removable flag of the given constraint */ 949 void SCIPconsSetRemovable( 950 SCIP_CONS* cons, /**< constraint */ 951 SCIP_Bool removable /**< new value */ 952 ); 953 954 /** sets the stickingatnode flag of the given constraint */ 955 void SCIPconsSetStickingAtNode( 956 SCIP_CONS* cons, /**< constraint */ 957 SCIP_Bool stickingatnode /**< new value */ 958 ); 959 960 /** gives the constraint a new name; ATTENTION: to old pointer is over written that might 961 * result in a memory leakage */ 962 void SCIPconsSetNamePointer( 963 SCIP_CONS* cons, /**< constraint */ 964 const char* name /**< new name of constraint */ 965 ); 966 967 /** gets associated transformed constraint of an original constraint, or NULL if no associated transformed constraint 968 * exists 969 */ 970 SCIP_CONS* SCIPconsGetTransformed( 971 SCIP_CONS* cons /**< constraint */ 972 ); 973 974 /** activates constraint or marks constraint to be activated in next update */ 975 SCIP_RETCODE SCIPconsActivate( 976 SCIP_CONS* cons, /**< constraint */ 977 SCIP_SET* set, /**< global SCIP settings */ 978 SCIP_STAT* stat, /**< dynamic problem statistics */ 979 int depth, /**< depth in the tree where the constraint activation takes place, or -1 for global problem */ 980 SCIP_Bool focusnode /**< does the constraint activation take place at the focus node? */ 981 ); 982 983 /** deactivates constraint or marks constraint to be deactivated in next update */ 984 SCIP_RETCODE SCIPconsDeactivate( 985 SCIP_CONS* cons, /**< constraint */ 986 SCIP_SET* set, /**< global SCIP settings */ 987 SCIP_STAT* stat /**< dynamic problem statistics */ 988 ); 989 990 /** enables constraint's separation, enforcing, and propagation capabilities or marks them to be enabled in next update */ 991 SCIP_RETCODE SCIPconsEnable( 992 SCIP_CONS* cons, /**< constraint */ 993 SCIP_SET* set, /**< global SCIP settings */ 994 SCIP_STAT* stat /**< dynamic problem statistics */ 995 ); 996 997 /** disables constraint's separation, enforcing, and propagation capabilities or marks them to be disabled in next update */ 998 SCIP_RETCODE SCIPconsDisable( 999 SCIP_CONS* cons, /**< constraint */ 1000 SCIP_SET* set, /**< global SCIP settings */ 1001 SCIP_STAT* stat /**< dynamic problem statistics */ 1002 ); 1003 1004 /** enables constraint's separation capabilities or marks them to be enabled in next update */ 1005 SCIP_RETCODE SCIPconsEnableSeparation( 1006 SCIP_CONS* cons, /**< constraint */ 1007 SCIP_SET* set /**< global SCIP settings */ 1008 ); 1009 1010 /** disables constraint's separation capabilities or marks them to be disabled in next update */ 1011 SCIP_RETCODE SCIPconsDisableSeparation( 1012 SCIP_CONS* cons, /**< constraint */ 1013 SCIP_SET* set /**< global SCIP settings */ 1014 ); 1015 1016 /** enables constraint's propagation capabilities or marks them to be enabled in next update */ 1017 SCIP_RETCODE SCIPconsEnablePropagation( 1018 SCIP_CONS* cons, /**< constraint */ 1019 SCIP_SET* set /**< global SCIP settings */ 1020 ); 1021 1022 /** disables constraint's propagation capabilities or marks them to be disabled in next update */ 1023 SCIP_RETCODE SCIPconsDisablePropagation( 1024 SCIP_CONS* cons, /**< constraint */ 1025 SCIP_SET* set /**< global SCIP settings */ 1026 ); 1027 1028 /** marks the constraint to be a conflict */ 1029 void SCIPconsMarkConflict( 1030 SCIP_CONS* cons /**< constraint */ 1031 ); 1032 1033 /** marks the constraint to be propagated (update might be delayed) */ 1034 SCIP_EXPORT 1035 SCIP_RETCODE SCIPconsMarkPropagate( 1036 SCIP_CONS* cons, /**< constraint */ 1037 SCIP_SET* set /**< global SCIP settings */ 1038 ); 1039 1040 /** unmarks the constraint to be propagated (update might be delayed) */ 1041 SCIP_RETCODE SCIPconsUnmarkPropagate( 1042 SCIP_CONS* cons, /**< constraint */ 1043 SCIP_SET* set /**< global SCIP settings */ 1044 ); 1045 1046 /** adds given value to age of constraint, but age can never become negative; 1047 * should be called 1048 * - in constraint separation, if no cut was found for this constraint, 1049 * - in constraint enforcing, if constraint was feasible, and 1050 * - in constraint propagation, if no domain reduction was deduced; 1051 * if it's age exceeds the constraint age limit, makes constraint obsolete or marks constraint to be made obsolete 1052 * in next update 1053 */ 1054 SCIP_RETCODE SCIPconsAddAge( 1055 SCIP_CONS* cons, /**< constraint */ 1056 BMS_BLKMEM* blkmem, /**< block memory */ 1057 SCIP_SET* set, /**< global SCIP settings */ 1058 SCIP_STAT* stat, /**< dynamic problem statistics */ 1059 SCIP_PROB* prob, /**< problem data */ 1060 SCIP_Real deltaage, /**< value to add to the constraint's age */ 1061 SCIP_REOPT* reopt /**< reoptimization data */ 1062 ); 1063 1064 /** increases age of constraint by 1.0; 1065 * should be called 1066 * - in constraint separation, if no cut was found for this constraint, 1067 * - in constraint enforcing, if constraint was feasible, and 1068 * - in constraint propagation, if no domain reduction was deduced; 1069 * if it's age exceeds the constraint age limit, makes constraint obsolete or marks constraint to be made obsolete 1070 * in next update 1071 */ 1072 SCIP_RETCODE SCIPconsIncAge( 1073 SCIP_CONS* cons, /**< constraint */ 1074 BMS_BLKMEM* blkmem, /**< block memory */ 1075 SCIP_SET* set, /**< global SCIP settings */ 1076 SCIP_STAT* stat, /**< dynamic problem statistics */ 1077 SCIP_PROB* prob, /**< problem data */ 1078 SCIP_REOPT* reopt /**< reoptimization data */ 1079 ); 1080 1081 /** resets age of constraint to zero; 1082 * should be called 1083 * - in constraint separation, if a cut was found for this constraint, 1084 * - in constraint enforcing, if the constraint was violated, and 1085 * - in constraint propagation, if a domain reduction was deduced; 1086 * if it was obsolete, makes constraint useful again or marks constraint to be made useful again in next update 1087 */ 1088 SCIP_RETCODE SCIPconsResetAge( 1089 SCIP_CONS* cons, /**< constraint */ 1090 SCIP_SET* set /**< global SCIP settings */ 1091 ); 1092 1093 /** resolves the given conflicting bound, that was deduced by the given constraint, by putting all "reason" bounds 1094 * leading to the deduction into the conflict queue with calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(), 1095 * SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or SCIPaddConflictBinvar(); 1096 * 1097 * @note it is sufficient to explain the relaxed bound change 1098 */ 1099 SCIP_RETCODE SCIPconsResolvePropagation( 1100 SCIP_CONS* cons, /**< constraint that deduced the assignment */ 1101 SCIP_SET* set, /**< global SCIP settings */ 1102 SCIP_VAR* infervar, /**< variable whose bound was deduced by the constraint */ 1103 int inferinfo, /**< user inference information attached to the bound change */ 1104 SCIP_BOUNDTYPE inferboundtype, /**< bound that was deduced (lower or upper bound) */ 1105 SCIP_BDCHGIDX* bdchgidx, /**< bound change index, representing the point of time where change took place */ 1106 SCIP_Real relaxedbd, /**< the relaxed bound */ 1107 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 1108 ); 1109 1110 /** adds given values to lock status of the constraint and updates the locks of the given locktype of the involved variables */ 1111 SCIP_RETCODE SCIPconsAddLocks( 1112 SCIP_CONS* cons, /**< constraint */ 1113 SCIP_SET* set, /**< global SCIP settings */ 1114 SCIP_LOCKTYPE locktype, /**< type of variable locks */ 1115 int nlockspos, /**< increase in number of rounding locks for constraint */ 1116 int nlocksneg /**< increase in number of rounding locks for constraint's negation */ 1117 ); 1118 1119 /* 1120 * Hash functions 1121 */ 1122 1123 /** gets the key (i.e. the name) of the given constraint */ 1124 SCIP_DECL_HASHGETKEY(SCIPhashGetKeyCons); 1125 1126 /* 1127 * method for arrays of contraint handlers 1128 */ 1129 1130 /** stores all constraints marked for propagation away when probing is started */ 1131 SCIP_RETCODE SCIPconshdlrsStorePropagationStatus( 1132 SCIP_SET* set, /**< global SCIP settings */ 1133 SCIP_CONSHDLR** conshdlrs, /**< all constraint handlers */ 1134 int nconshdlrs /**< number of contraint handlers */ 1135 ); 1136 1137 /** reset all constraints marked for propagation when probing was finished */ 1138 SCIP_RETCODE SCIPconshdlrsResetPropagationStatus( 1139 SCIP_SET* set, /**< global SCIP settings */ 1140 BMS_BLKMEM* blkmem, /**< block memory */ 1141 SCIP_CONSHDLR** conshdlrs, /**< all constraint handlers */ 1142 int nconshdlrs /**< number of contraint handlers */ 1143 ); 1144 1145 #ifdef __cplusplus 1146 } 1147 #endif 1148 1149 #endif 1150