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