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 scip_cons.c 26 * @ingroup OTHER_CFILES 27 * @brief public methods for constraint handler plugins and constraints 28 * @author Tobias Achterberg 29 * @author Timo Berthold 30 * @author Gerald Gamrath 31 * @author Leona Gottwald 32 * @author Stefan Heinz 33 * @author Gregor Hendel 34 * @author Christopher Hojny 35 * @author Thorsten Koch 36 * @author Alexander Martin 37 * @author Marc Pfetsch 38 * @author Michael Winkler 39 * @author Kati Wolter 40 * 41 * @todo check all SCIP_STAGE_* switches, and include the new stages TRANSFORMED and INITSOLVE 42 */ 43 44 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 45 46 #include "scip/cons.h" 47 #include "scip/debug.h" 48 #include "scip/prob.h" 49 #include "scip/pub_cons.h" 50 #include "scip/pub_message.h" 51 #include "scip/pub_misc.h" 52 #include "scip/scip_cons.h" 53 #include "scip/scip_general.h" 54 #include "scip/scip_mem.h" 55 #include "scip/set.h" 56 #include "scip/struct_cons.h" 57 #include "scip/struct_mem.h" 58 #include "scip/struct_scip.h" 59 #include "scip/struct_set.h" 60 61 /* In debug mode, the following methods are implemented as function calls to ensure 62 * type validity. 63 * In optimized mode, the methods are implemented as defines to improve performance. 64 * However, we want to have them in the library anyways, so we have to undef the defines. 65 */ 66 67 #undef SCIPmarkConsPropagate 68 69 /** creates a constraint handler and includes it in SCIP. 70 * 71 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 72 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 73 * 74 * @pre This method can be called if SCIP is in one of the following stages: 75 * - \ref SCIP_STAGE_INIT 76 * - \ref SCIP_STAGE_PROBLEM 77 * 78 * @note method has all constraint handler callbacks as arguments and is thus changed every time a new 79 * callback is added 80 * in future releases; consider using SCIPincludeConshdlrBasic() and setter functions 81 * if you seek for a method which is less likely to change in future releases 82 */ 83 SCIP_RETCODE SCIPincludeConshdlr( 84 SCIP* scip, /**< SCIP data structure */ 85 const char* name, /**< name of constraint handler */ 86 const char* desc, /**< description of constraint handler */ 87 int sepapriority, /**< priority of the constraint handler for separation */ 88 int enfopriority, /**< priority of the constraint handler for constraint enforcing */ 89 int chckpriority, /**< priority of the constraint handler for checking feasibility (and propagation) */ 90 int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */ 91 int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */ 92 int eagerfreq, /**< frequency for using all instead of only the useful constraints in separation, 93 * propagation and enforcement, -1 for no eager evaluations, 0 for first only */ 94 int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */ 95 SCIP_Bool delaysepa, /**< should separation method be delayed, if other separators found cuts? */ 96 SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */ 97 SCIP_Bool needscons, /**< should the constraint handler be skipped, if no constraints are available? */ 98 SCIP_PROPTIMING proptiming, /**< positions in the node solving loop where propagation method of constraint handlers should be executed */ 99 SCIP_PRESOLTIMING presoltiming, /**< timing mask of the constraint handler's presolving method */ 100 SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */ 101 SCIP_DECL_CONSFREE ((*consfree)), /**< destructor of constraint handler */ 102 SCIP_DECL_CONSINIT ((*consinit)), /**< initialize constraint handler */ 103 SCIP_DECL_CONSEXIT ((*consexit)), /**< deinitialize constraint handler */ 104 SCIP_DECL_CONSINITPRE ((*consinitpre)), /**< presolving initialization method of constraint handler */ 105 SCIP_DECL_CONSEXITPRE ((*consexitpre)), /**< presolving deinitialization method of constraint handler */ 106 SCIP_DECL_CONSINITSOL ((*consinitsol)), /**< solving process initialization method of constraint handler */ 107 SCIP_DECL_CONSEXITSOL ((*consexitsol)), /**< solving process deinitialization method of constraint handler */ 108 SCIP_DECL_CONSDELETE ((*consdelete)), /**< free specific constraint data */ 109 SCIP_DECL_CONSTRANS ((*constrans)), /**< transform constraint data into data belonging to the transformed problem */ 110 SCIP_DECL_CONSINITLP ((*consinitlp)), /**< initialize LP with relaxations of "initial" constraints */ 111 SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */ 112 SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */ 113 SCIP_DECL_CONSENFOLP ((*consenfolp)), /**< enforcing constraints for LP solutions */ 114 SCIP_DECL_CONSENFORELAX ((*consenforelax)), /**< enforcing constraints for relaxation solutions */ 115 SCIP_DECL_CONSENFOPS ((*consenfops)), /**< enforcing constraints for pseudo solutions */ 116 SCIP_DECL_CONSCHECK ((*conscheck)), /**< check feasibility of primal solution */ 117 SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */ 118 SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method */ 119 SCIP_DECL_CONSRESPROP ((*consresprop)), /**< propagation conflict resolving method */ 120 SCIP_DECL_CONSLOCK ((*conslock)), /**< variable rounding lock method */ 121 SCIP_DECL_CONSACTIVE ((*consactive)), /**< activation notification method */ 122 SCIP_DECL_CONSDEACTIVE((*consdeactive)), /**< deactivation notification method */ 123 SCIP_DECL_CONSENABLE ((*consenable)), /**< enabling notification method */ 124 SCIP_DECL_CONSDISABLE ((*consdisable)), /**< disabling notification method */ 125 SCIP_DECL_CONSDELVARS ((*consdelvars)), /**< variable deletion method */ 126 SCIP_DECL_CONSPRINT ((*consprint)), /**< constraint display method */ 127 SCIP_DECL_CONSCOPY ((*conscopy)), /**< constraint copying method */ 128 SCIP_DECL_CONSPARSE ((*consparse)), /**< constraint parsing method */ 129 SCIP_DECL_CONSGETVARS ((*consgetvars)), /**< constraint get variables method */ 130 SCIP_DECL_CONSGETNVARS((*consgetnvars)), /**< constraint get number of variable method */ 131 SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)), /**< constraint handler diving solution enforcement method */ 132 SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)), /**< constraint permutation symmetry detection graph 133 * getter method */ 134 SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)), /**< constraint signed permutation symmetry 135 * detection graph getter method */ 136 SCIP_CONSHDLRDATA* conshdlrdata /**< constraint handler data */ 137 ) 138 { 139 SCIP_CONSHDLR* conshdlr; 140 141 SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeConshdlr", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 142 143 /* check whether constraint handler is already present */ 144 if( SCIPfindConshdlr(scip, name) != NULL ) 145 { 146 SCIPerrorMessage("constraint handler <%s> already included.\n", name); 147 return SCIP_INVALIDDATA; 148 } 149 150 SCIP_CALL( SCIPconshdlrCreate(&conshdlr, scip->set, scip->messagehdlr, scip->mem->setmem, 151 name, desc, sepapriority, enfopriority, chckpriority, sepafreq, propfreq, eagerfreq, maxprerounds, 152 delaysepa, delayprop, needscons, proptiming, presoltiming, conshdlrcopy, 153 consfree, consinit, consexit, consinitpre, consexitpre, consinitsol, consexitsol, 154 consdelete, constrans, consinitlp, conssepalp, conssepasol, consenfolp, consenforelax, consenfops, conscheck, consprop, 155 conspresol, consresprop, conslock, consactive, consdeactive, consenable, consdisable, consdelvars, consprint, 156 conscopy, consparse, consgetvars, consgetnvars, consgetdivebdchgs, consgetpermsymgraph, 157 consgetsignedpermsymgraph, conshdlrdata) ); 158 SCIP_CALL( SCIPsetIncludeConshdlr(scip->set, conshdlr) ); 159 160 return SCIP_OKAY; 161 } 162 163 /** creates a constraint handler and includes it in SCIP. All non-fundamental (or optional) callbacks will be set to NULL. 164 * Optional callbacks can be set via specific setter functions, see SCIPsetConshdlrInit(), SCIPsetConshdlrExit(), 165 * SCIPsetConshdlrCopy(), SCIPsetConshdlrFree(), SCIPsetConshdlrInitsol(), SCIPsetConshdlrExitsol(), 166 * SCIPsetConshdlrInitpre(), SCIPsetConshdlrExitpre(), SCIPsetConshdlrPresol(), SCIPsetConshdlrDelete(), 167 * SCIPsetConshdlrDelvars(), SCIPsetConshdlrInitlp(), SCIPsetConshdlrActive(), SCIPsetConshdlrDeactive(), 168 * SCIPsetConshdlrEnable(), SCIPsetConshdlrDisable(), SCIPsetConshdlrResprop(), SCIPsetConshdlrTrans(), 169 * SCIPsetConshdlrPrint(), SCIPsetConshdlrParse(), SCIPsetConshdlrGetVars(), SCIPsetConshdlrGetNVars(), and 170 * SCIPsetConshdlrGetDiveBdChgs(). 171 * 172 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 173 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 174 * 175 * @pre This method can be called if SCIP is in one of the following stages: 176 * - \ref SCIP_STAGE_INIT 177 * - \ref SCIP_STAGE_PROBLEM 178 * 179 * @note if you want to set all callbacks with a single method call, consider using SCIPincludeConshdlr() instead 180 */ 181 SCIP_RETCODE SCIPincludeConshdlrBasic( 182 SCIP* scip, /**< SCIP data structure */ 183 SCIP_CONSHDLR** conshdlrptr, /**< reference to a constraint handler pointer, or NULL */ 184 const char* name, /**< name of constraint handler */ 185 const char* desc, /**< description of constraint handler */ 186 int enfopriority, /**< priority of the constraint handler for constraint enforcing */ 187 int chckpriority, /**< priority of the constraint handler for checking feasibility (and propagation) */ 188 int eagerfreq, /**< frequency for using all instead of only the useful constraints in separation, 189 * propagation and enforcement, -1 for no eager evaluations, 0 for first only */ 190 SCIP_Bool needscons, /**< should the constraint handler be skipped, if no constraints are available? */ 191 SCIP_DECL_CONSENFOLP ((*consenfolp)), /**< enforcing constraints for LP solutions */ 192 SCIP_DECL_CONSENFOPS ((*consenfops)), /**< enforcing constraints for pseudo solutions */ 193 SCIP_DECL_CONSCHECK ((*conscheck)), /**< check feasibility of primal solution */ 194 SCIP_DECL_CONSLOCK ((*conslock)), /**< variable rounding lock method */ 195 SCIP_CONSHDLRDATA* conshdlrdata /**< constraint handler data */ 196 ) 197 { 198 SCIP_CONSHDLR* conshdlr; 199 200 SCIP_CALL( SCIPcheckStage(scip, "SCIPincludeConshdlrBasic", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 201 202 /* check whether constraint handler is already present */ 203 if( SCIPfindConshdlr(scip, name) != NULL ) 204 { 205 SCIPerrorMessage("constraint handler <%s> already included.\n", name); 206 return SCIP_INVALIDDATA; 207 } 208 209 SCIP_CALL( SCIPconshdlrCreate(&conshdlr, scip->set, scip->messagehdlr, scip->mem->setmem, 210 name, desc, 0, enfopriority, chckpriority, -1, -1, eagerfreq, 0, 211 FALSE, FALSE, needscons, 212 SCIP_PROPTIMING_BEFORELP, SCIP_PRESOLTIMING_ALWAYS, 213 NULL, 214 NULL, NULL, NULL, NULL, NULL, NULL, NULL, 215 NULL, NULL, NULL, NULL, NULL, consenfolp, NULL, consenfops, conscheck, NULL, 216 NULL, NULL, conslock, NULL, NULL, NULL, NULL, NULL, NULL, 217 NULL, NULL, NULL, NULL, NULL, NULL, NULL, conshdlrdata) ); 218 SCIP_CALL( SCIPsetIncludeConshdlr(scip->set, conshdlr) ); 219 220 if( conshdlrptr != NULL ) 221 *conshdlrptr = conshdlr; 222 223 return SCIP_OKAY; 224 } 225 226 /** sets all separation related callbacks/parameters of the constraint handler 227 * 228 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 229 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 230 * 231 * @pre This method can be called if SCIP is in one of the following stages: 232 * - \ref SCIP_STAGE_INIT 233 * - \ref SCIP_STAGE_PROBLEM 234 */ 235 SCIP_RETCODE SCIPsetConshdlrSepa( 236 SCIP* scip, /**< SCIP data structure */ 237 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 238 SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */ 239 SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */ 240 int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */ 241 int sepapriority, /**< priority of the constraint handler for separation */ 242 SCIP_Bool delaysepa /**< should separation method be delayed, if other separators found cuts? */ 243 ) 244 { 245 int oldsepapriority; 246 const char* name; 247 char paramname[SCIP_MAXSTRLEN]; 248 249 assert(scip != NULL); 250 assert(conshdlr != NULL); 251 252 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrSepa", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 253 254 oldsepapriority = SCIPconshdlrGetSepaPriority(conshdlr); 255 SCIPconshdlrSetSepa(conshdlr, conssepalp, conssepasol, sepafreq, sepapriority, delaysepa); 256 257 /* change the position of the constraint handler in the constraint handler array w.r.t. its new sepa priority */ 258 if( oldsepapriority != sepapriority ) 259 SCIPsetReinsertConshdlrSepaPrio(scip->set, conshdlr, oldsepapriority); 260 261 name = SCIPconshdlrGetName(conshdlr); 262 263 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/sepafreq", name); 264 SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, sepafreq) ); 265 266 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/delaysepa", name); 267 SCIP_CALL( SCIPsetSetDefaultBoolParam(scip->set, paramname, delaysepa) ); 268 269 return SCIP_OKAY; 270 } 271 272 /** sets both the propagation callback and the propagation frequency of the constraint handler 273 * 274 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 275 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 276 * 277 * @pre This method can be called if SCIP is in one of the following stages: 278 * - \ref SCIP_STAGE_INIT 279 * - \ref SCIP_STAGE_PROBLEM 280 */ 281 SCIP_RETCODE SCIPsetConshdlrProp( 282 SCIP* scip, /**< SCIP data structure */ 283 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 284 SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */ 285 int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */ 286 SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */ 287 SCIP_PROPTIMING proptiming /**< positions in the node solving loop where propagation should be executed */ 288 ) 289 { 290 const char* name; 291 char paramname[SCIP_MAXSTRLEN]; 292 293 assert(scip != NULL); 294 assert(conshdlr != NULL); 295 296 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrProp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 297 298 SCIPconshdlrSetProp(conshdlr, consprop, propfreq, delayprop, proptiming); 299 300 name = SCIPconshdlrGetName(conshdlr); 301 302 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/propfreq", name); 303 SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, propfreq) ); 304 305 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/proptiming", name); 306 SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, (int) proptiming) ); 307 308 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/delayprop", name); 309 SCIP_CALL( SCIPsetSetDefaultBoolParam(scip->set, paramname, delayprop) ); 310 311 return SCIP_OKAY; 312 } 313 314 /** sets relaxation enforcement method of the constraint handler 315 * 316 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 317 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 318 * 319 * @pre This method can be called if SCIP is in one of the following stages: 320 * - \ref SCIP_STAGE_INIT 321 * - \ref SCIP_STAGE_PROBLEM 322 */ 323 SCIP_RETCODE SCIPsetConshdlrEnforelax( 324 SCIP* scip, /**< SCIP data structure */ 325 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 326 SCIP_DECL_CONSENFORELAX ((*consenforelax)) /**< enforcement method for relaxation solution of constraint handler (might be NULL) */ 327 ) 328 { 329 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrEnforelax", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 330 331 assert(conshdlr != NULL); 332 333 SCIPconshdlrSetEnforelax(conshdlr, consenforelax); 334 335 return SCIP_OKAY; 336 } 337 338 /** sets copy method of both the constraint handler and each associated constraint 339 * 340 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 341 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 342 * 343 * @pre This method can be called if SCIP is in one of the following stages: 344 * - \ref SCIP_STAGE_INIT 345 * - \ref SCIP_STAGE_PROBLEM 346 */ 347 SCIP_RETCODE SCIPsetConshdlrCopy( 348 SCIP* scip, /**< SCIP data structure */ 349 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 350 SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */ 351 SCIP_DECL_CONSCOPY ((*conscopy)) /**< constraint copying method */ 352 ) 353 { 354 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrCopy", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 355 356 assert(conshdlr != NULL); 357 358 SCIPconshdlrSetCopy(conshdlr, conshdlrcopy, conscopy); 359 360 return SCIP_OKAY; 361 } 362 363 /** sets destructor method of constraint handler 364 * 365 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 366 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 367 * 368 * @pre This method can be called if SCIP is in one of the following stages: 369 * - \ref SCIP_STAGE_INIT 370 * - \ref SCIP_STAGE_PROBLEM 371 */ 372 SCIP_RETCODE SCIPsetConshdlrFree( 373 SCIP* scip, /**< SCIP data structure */ 374 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 375 SCIP_DECL_CONSFREE ((*consfree)) /**< destructor of constraint handler */ 376 ) 377 { 378 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrFree", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 379 380 assert(conshdlr != NULL); 381 382 SCIPconshdlrSetFree(conshdlr, consfree); 383 384 return SCIP_OKAY; 385 } 386 387 /** sets initialization method of constraint handler 388 * 389 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 390 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 391 * 392 * @pre This method can be called if SCIP is in one of the following stages: 393 * - \ref SCIP_STAGE_INIT 394 * - \ref SCIP_STAGE_PROBLEM 395 */ 396 SCIP_RETCODE SCIPsetConshdlrInit( 397 SCIP* scip, /**< SCIP data structure */ 398 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 399 SCIP_DECL_CONSINIT ((*consinit)) /**< initialize constraint handler */ 400 ) 401 { 402 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrInit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 403 404 assert(conshdlr != NULL); 405 406 SCIPconshdlrSetInit(conshdlr, consinit); 407 408 return SCIP_OKAY; 409 } 410 411 /** sets deinitialization method of constraint handler 412 * 413 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 414 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 415 * 416 * @pre This method can be called if SCIP is in one of the following stages: 417 * - \ref SCIP_STAGE_INIT 418 * - \ref SCIP_STAGE_PROBLEM 419 */ 420 SCIP_RETCODE SCIPsetConshdlrExit( 421 SCIP* scip, /**< SCIP data structure */ 422 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 423 SCIP_DECL_CONSEXIT ((*consexit)) /**< deinitialize constraint handler */ 424 ) 425 { 426 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrExit", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 427 428 assert(conshdlr != NULL); 429 430 SCIPconshdlrSetExit(conshdlr, consexit); 431 432 return SCIP_OKAY; 433 } 434 435 /** sets solving process initialization method of constraint handler 436 * 437 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 438 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 439 * 440 * @pre This method can be called if SCIP is in one of the following stages: 441 * - \ref SCIP_STAGE_INIT 442 * - \ref SCIP_STAGE_PROBLEM 443 */ 444 SCIP_RETCODE SCIPsetConshdlrInitsol( 445 SCIP* scip, /**< SCIP data structure */ 446 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 447 SCIP_DECL_CONSINITSOL((*consinitsol)) /**< solving process initialization method of constraint handler */ 448 ) 449 { 450 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrInitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 451 452 assert(conshdlr != NULL); 453 454 SCIPconshdlrSetInitsol(conshdlr, consinitsol); 455 456 return SCIP_OKAY; 457 } 458 459 /** sets solving process deinitialization method of constraint handler 460 * 461 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 462 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 463 * 464 * @pre This method can be called if SCIP is in one of the following stages: 465 * - \ref SCIP_STAGE_INIT 466 * - \ref SCIP_STAGE_PROBLEM 467 */ 468 SCIP_RETCODE SCIPsetConshdlrExitsol( 469 SCIP* scip, /**< SCIP data structure */ 470 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 471 SCIP_DECL_CONSEXITSOL ((*consexitsol))/**< solving process deinitialization method of constraint handler */ 472 ) 473 { 474 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrExitsol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 475 476 assert(conshdlr != NULL); 477 478 SCIPconshdlrSetExitsol(conshdlr, consexitsol); 479 480 return SCIP_OKAY; 481 } 482 483 /** sets preprocessing initialization method of constraint handler 484 * 485 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 486 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 487 * 488 * @pre This method can be called if SCIP is in one of the following stages: 489 * - \ref SCIP_STAGE_INIT 490 * - \ref SCIP_STAGE_PROBLEM 491 */ 492 SCIP_RETCODE SCIPsetConshdlrInitpre( 493 SCIP* scip, /**< SCIP data structure */ 494 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 495 SCIP_DECL_CONSINITPRE((*consinitpre)) /**< preprocessing initialization method of constraint handler */ 496 ) 497 { 498 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrInitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 499 500 assert(conshdlr != NULL); 501 502 SCIPconshdlrSetInitpre(conshdlr, consinitpre); 503 504 return SCIP_OKAY; 505 } 506 507 /** sets preprocessing deinitialization method of constraint handler 508 * 509 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 510 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 511 * 512 * @pre This method can be called if SCIP is in one of the following stages: 513 * - \ref SCIP_STAGE_INIT 514 * - \ref SCIP_STAGE_PROBLEM 515 */ 516 SCIP_RETCODE SCIPsetConshdlrExitpre( 517 SCIP* scip, /**< SCIP data structure */ 518 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 519 SCIP_DECL_CONSEXITPRE((*consexitpre)) /**< preprocessing deinitialization method of constraint handler */ 520 ) 521 { 522 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrExitpre", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 523 524 assert(conshdlr != NULL); 525 526 SCIPconshdlrSetExitpre(conshdlr, consexitpre); 527 528 return SCIP_OKAY; 529 } 530 531 /** sets presolving method of constraint handler 532 * 533 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 534 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 535 * 536 * @pre This method can be called if SCIP is in one of the following stages: 537 * - \ref SCIP_STAGE_INIT 538 * - \ref SCIP_STAGE_PROBLEM 539 */ 540 SCIP_RETCODE SCIPsetConshdlrPresol( 541 SCIP* scip, /**< SCIP data structure */ 542 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 543 SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method of constraint handler */ 544 int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */ 545 SCIP_PRESOLTIMING presoltiming /**< timing mask of the constraint handler's presolving method */ 546 ) 547 { 548 const char* name; 549 char paramname[SCIP_MAXSTRLEN]; 550 551 assert(scip != NULL); 552 assert(conshdlr != NULL); 553 554 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrPresol", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 555 556 SCIP_CALL( SCIPconshdlrSetPresol(conshdlr, conspresol, maxprerounds, presoltiming) ); 557 558 name = SCIPconshdlrGetName(conshdlr); 559 560 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/maxprerounds", name); 561 SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, maxprerounds) ); 562 563 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/presoltiming", name); 564 SCIP_CALL( SCIPsetSetDefaultIntParam(scip->set, paramname, (int) presoltiming) ); 565 566 return SCIP_OKAY; 567 } 568 569 /** sets method of constraint handler to free specific constraint data 570 * 571 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 572 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 573 * 574 * @pre This method can be called if SCIP is in one of the following stages: 575 * - \ref SCIP_STAGE_INIT 576 * - \ref SCIP_STAGE_PROBLEM 577 */ 578 SCIP_RETCODE SCIPsetConshdlrDelete( 579 SCIP* scip, /**< SCIP data structure */ 580 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 581 SCIP_DECL_CONSDELETE ((*consdelete)) /**< free specific constraint data */ 582 ) 583 { 584 assert(scip != NULL); 585 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrDelete", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 586 587 SCIPconshdlrSetDelete(conshdlr, consdelete); 588 589 return SCIP_OKAY; 590 } 591 592 /** sets method of constraint handler to transform constraint data into data belonging to the transformed problem 593 * 594 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 595 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 596 * 597 * @pre This method can be called if SCIP is in one of the following stages: 598 * - \ref SCIP_STAGE_INIT 599 * - \ref SCIP_STAGE_PROBLEM 600 */ 601 SCIP_RETCODE SCIPsetConshdlrTrans( 602 SCIP* scip, /**< SCIP data structure */ 603 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 604 SCIP_DECL_CONSTRANS ((*constrans)) /**< transform constraint data into data belonging to the transformed problem */ 605 ) 606 { 607 assert(scip != NULL); 608 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrTrans", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 609 610 SCIPconshdlrSetTrans(conshdlr, constrans); 611 612 return SCIP_OKAY; 613 } 614 615 /** sets method of constraint handler to initialize LP with relaxations of "initial" constraints 616 * 617 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 618 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 619 * 620 * @pre This method can be called if SCIP is in one of the following stages: 621 * - \ref SCIP_STAGE_INIT 622 * - \ref SCIP_STAGE_PROBLEM 623 */ 624 SCIP_RETCODE SCIPsetConshdlrInitlp( 625 SCIP* scip, /**< SCIP data structure */ 626 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 627 SCIP_DECL_CONSINITLP ((*consinitlp)) /**< initialize LP with relaxations of "initial" constraints */ 628 ) 629 { 630 assert(scip != NULL); 631 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrInitlp", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 632 633 SCIPconshdlrSetInitlp(conshdlr, consinitlp); 634 635 return SCIP_OKAY; 636 } 637 638 /** sets propagation conflict resolving method of constraint handler 639 * 640 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 641 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 642 * 643 * @pre This method can be called if SCIP is in one of the following stages: 644 * - \ref SCIP_STAGE_INIT 645 * - \ref SCIP_STAGE_PROBLEM 646 */ 647 SCIP_RETCODE SCIPsetConshdlrResprop( 648 SCIP* scip, /**< SCIP data structure */ 649 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 650 SCIP_DECL_CONSRESPROP ((*consresprop)) /**< propagation conflict resolving method */ 651 ) 652 { 653 assert(scip != NULL); 654 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrResprop", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 655 656 SCIPconshdlrSetResprop(conshdlr, consresprop); 657 658 return SCIP_OKAY; 659 } 660 661 /** sets activation notification method of constraint handler 662 * 663 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 664 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 665 * 666 * @pre This method can be called if SCIP is in one of the following stages: 667 * - \ref SCIP_STAGE_INIT 668 * - \ref SCIP_STAGE_PROBLEM 669 */ 670 SCIP_RETCODE SCIPsetConshdlrActive( 671 SCIP* scip, /**< SCIP data structure */ 672 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 673 SCIP_DECL_CONSACTIVE ((*consactive)) /**< activation notification method */ 674 ) 675 { 676 assert(scip != NULL); 677 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrActive", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 678 679 SCIPconshdlrSetActive(conshdlr, consactive); 680 681 return SCIP_OKAY; 682 } 683 684 /** sets deactivation notification method of constraint handler 685 * 686 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 687 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 688 * 689 * @pre This method can be called if SCIP is in one of the following stages: 690 * - \ref SCIP_STAGE_INIT 691 * - \ref SCIP_STAGE_PROBLEM 692 */ 693 SCIP_RETCODE SCIPsetConshdlrDeactive( 694 SCIP* scip, /**< SCIP data structure */ 695 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 696 SCIP_DECL_CONSDEACTIVE((*consdeactive)) /**< deactivation notification method */ 697 ) 698 { 699 assert(scip != NULL); 700 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrDeactive", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 701 702 SCIPconshdlrSetDeactive(conshdlr, consdeactive); 703 704 return SCIP_OKAY; 705 } 706 707 /** sets enabling notification method of constraint handler 708 * 709 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 710 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 711 * 712 * @pre This method can be called if SCIP is in one of the following stages: 713 * - \ref SCIP_STAGE_INIT 714 * - \ref SCIP_STAGE_PROBLEM 715 */ 716 SCIP_RETCODE SCIPsetConshdlrEnable( 717 SCIP* scip, /**< SCIP data structure */ 718 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 719 SCIP_DECL_CONSENABLE ((*consenable)) /**< enabling notification method */ 720 ) 721 { 722 assert(scip != NULL); 723 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrEnable", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 724 725 SCIPconshdlrSetEnable(conshdlr, consenable); 726 727 return SCIP_OKAY; 728 } 729 730 /** sets disabling notification method of constraint handler 731 * 732 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 733 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 734 * 735 * @pre This method can be called if SCIP is in one of the following stages: 736 * - \ref SCIP_STAGE_INIT 737 * - \ref SCIP_STAGE_PROBLEM 738 */ 739 SCIP_RETCODE SCIPsetConshdlrDisable( 740 SCIP* scip, /**< SCIP data structure */ 741 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 742 SCIP_DECL_CONSDISABLE ((*consdisable)) /**< disabling notification method */ 743 ) 744 { 745 assert(scip != NULL); 746 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrDisable", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 747 748 SCIPconshdlrSetDisable(conshdlr, consdisable); 749 750 return SCIP_OKAY; 751 } 752 753 /** sets variable deletion method of constraint handler 754 * 755 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 756 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 757 * 758 * @pre This method can be called if SCIP is in one of the following stages: 759 * - \ref SCIP_STAGE_INIT 760 * - \ref SCIP_STAGE_PROBLEM 761 */ 762 SCIP_RETCODE SCIPsetConshdlrDelvars( 763 SCIP* scip, /**< SCIP data structure */ 764 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 765 SCIP_DECL_CONSDELVARS ((*consdelvars)) /**< variable deletion method */ 766 ) 767 { 768 assert(scip != NULL); 769 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrDelvars", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 770 771 SCIPconshdlrSetDelvars(conshdlr, consdelvars); 772 773 return SCIP_OKAY; 774 } 775 776 /** sets constraint display method of constraint handler 777 * 778 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 779 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 780 * 781 * @pre This method can be called if SCIP is in one of the following stages: 782 * - \ref SCIP_STAGE_INIT 783 * - \ref SCIP_STAGE_PROBLEM 784 */ 785 SCIP_RETCODE SCIPsetConshdlrPrint( 786 SCIP* scip, /**< SCIP data structure */ 787 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 788 SCIP_DECL_CONSPRINT ((*consprint)) /**< constraint display method */ 789 ) 790 { 791 assert(scip != NULL); 792 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrPrint", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 793 794 SCIPconshdlrSetPrint(conshdlr, consprint); 795 796 return SCIP_OKAY; 797 } 798 799 /** sets constraint parsing method of constraint handler 800 * 801 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 802 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 803 * 804 * @pre This method can be called if SCIP is in one of the following stages: 805 * - \ref SCIP_STAGE_INIT 806 * - \ref SCIP_STAGE_PROBLEM 807 */ 808 SCIP_RETCODE SCIPsetConshdlrParse( 809 SCIP* scip, /**< SCIP data structure */ 810 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 811 SCIP_DECL_CONSPARSE ((*consparse)) /**< constraint parsing method */ 812 ) 813 { 814 assert(scip != NULL); 815 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrParse", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 816 817 SCIPconshdlrSetParse(conshdlr, consparse); 818 819 return SCIP_OKAY; 820 } 821 822 /** sets constraint variable getter method of constraint handler 823 * 824 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 825 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 826 * 827 * @pre This method can be called if SCIP is in one of the following stages: 828 * - \ref SCIP_STAGE_INIT 829 * - \ref SCIP_STAGE_PROBLEM 830 */ 831 SCIP_RETCODE SCIPsetConshdlrGetVars( 832 SCIP* scip, /**< SCIP data structure */ 833 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 834 SCIP_DECL_CONSGETVARS ((*consgetvars)) /**< constraint variable getter method */ 835 ) 836 { 837 assert(scip != NULL); 838 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrGetVars", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 839 840 SCIPconshdlrSetGetVars(conshdlr, consgetvars); 841 842 return SCIP_OKAY; 843 } 844 845 /** sets constraint variable number getter method of constraint handler 846 * 847 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 848 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 849 * 850 * @pre This method can be called if SCIP is in one of the following stages: 851 * - \ref SCIP_STAGE_INIT 852 * - \ref SCIP_STAGE_PROBLEM 853 */ 854 SCIP_RETCODE SCIPsetConshdlrGetNVars( 855 SCIP* scip, /**< SCIP data structure */ 856 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 857 SCIP_DECL_CONSGETNVARS((*consgetnvars)) /**< constraint variable number getter method */ 858 ) 859 { 860 assert(scip != NULL); 861 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrGetNVars", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 862 863 SCIPconshdlrSetGetNVars(conshdlr, consgetnvars); 864 865 return SCIP_OKAY; 866 } 867 868 /** sets diving bound change method of constraint handler 869 * 870 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 871 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 872 * 873 * @pre This method can be called if SCIP is in one of the following stages: 874 * - \ref SCIP_STAGE_INIT 875 * - \ref SCIP_STAGE_PROBLEM 876 */ 877 SCIP_RETCODE SCIPsetConshdlrGetDiveBdChgs( 878 SCIP* scip, /**< SCIP data structure */ 879 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 880 SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)) /**< constraint handler diving solution enforcement method */ 881 ) 882 { 883 assert(scip != NULL); 884 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrGetDiveBdChgs", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 885 886 SCIPconshdlrSetGetDiveBdChgs(conshdlr, consgetdivebdchgs); 887 888 return SCIP_OKAY; 889 } 890 891 /** sets permutation symmetry detection graph getter method of constraint handler 892 * 893 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 894 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 895 * 896 * @pre This method can be called if SCIP is in one of the following stages: 897 * - \ref SCIP_STAGE_INIT 898 * - \ref SCIP_STAGE_PROBLEM 899 */ 900 SCIP_RETCODE SCIPsetConshdlrGetPermsymGraph( 901 SCIP* scip, /**< SCIP data structure */ 902 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 903 SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)) /**< constraint permutation symmetry detection graph 904 * getter method */ 905 ) 906 { 907 assert(scip != NULL); 908 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrGetPermsymGraph", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 909 910 SCIPconshdlrSetGetPermsymGraph(conshdlr, consgetpermsymgraph); 911 912 return SCIP_OKAY; 913 } 914 915 /** sets signed permutation symmetry detection graph getter method of constraint handler 916 * 917 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 918 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 919 * 920 * @pre This method can be called if SCIP is in one of the following stages: 921 * - \ref SCIP_STAGE_INIT 922 * - \ref SCIP_STAGE_PROBLEM 923 */ 924 SCIP_RETCODE SCIPsetConshdlrGetSignedPermsymGraph( 925 SCIP* scip, /**< SCIP data structure */ 926 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 927 SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)) /**< constraint signed permutation symmetry 928 * detection graph getter method */ 929 ) 930 { 931 assert(scip != NULL); 932 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConshdlrGetSignedPermsymGraph", TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 933 934 SCIPconshdlrSetGetSignedPermsymGraph(conshdlr, consgetsignedpermsymgraph); 935 936 return SCIP_OKAY; 937 } 938 939 /** returns the constraint handler of the given name, or NULL if not existing */ 940 /** returns the constraint handler of the given name, or NULL if not existing */ 941 SCIP_CONSHDLR* SCIPfindConshdlr( 942 SCIP* scip, /**< SCIP data structure */ 943 const char* name /**< name of constraint handler */ 944 ) 945 { 946 assert(scip != NULL); 947 assert(scip->set != NULL); 948 assert(name != NULL); 949 950 return SCIPsetFindConshdlr(scip->set, name); 951 } 952 953 /** returns the array of currently available constraint handlers */ 954 SCIP_CONSHDLR** SCIPgetConshdlrs( 955 SCIP* scip /**< SCIP data structure */ 956 ) 957 { 958 assert(scip != NULL); 959 assert(scip->set != NULL); 960 961 return scip->set->conshdlrs; 962 } 963 964 /** returns the number of currently available constraint handlers */ 965 int SCIPgetNConshdlrs( 966 SCIP* scip /**< SCIP data structure */ 967 ) 968 { 969 assert(scip != NULL); 970 assert(scip->set != NULL); 971 972 return scip->set->nconshdlrs; 973 } 974 975 /** creates and captures a constraint of the given constraint handler 976 * 977 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may 978 * be declared feasible even if it violates this particular constraint. This constellation should only be 979 * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due 980 * to the variable's local bounds. 981 * 982 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 983 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 984 * 985 * @pre This method can be called if @p scip is in one of the following stages: 986 * - \ref SCIP_STAGE_PROBLEM 987 * - \ref SCIP_STAGE_TRANSFORMING 988 * - \ref SCIP_STAGE_INITPRESOLVE 989 * - \ref SCIP_STAGE_PRESOLVING 990 * - \ref SCIP_STAGE_EXITPRESOLVE 991 * - \ref SCIP_STAGE_PRESOLVED 992 * - \ref SCIP_STAGE_INITSOLVE 993 * - \ref SCIP_STAGE_SOLVING 994 * - \ref SCIP_STAGE_EXITSOLVE 995 * 996 * @note the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons() 997 */ 998 SCIP_RETCODE SCIPcreateCons( 999 SCIP* scip, /**< SCIP data structure */ 1000 SCIP_CONS** cons, /**< pointer to constraint */ 1001 const char* name, /**< name of constraint */ 1002 SCIP_CONSHDLR* conshdlr, /**< constraint handler for this constraint */ 1003 SCIP_CONSDATA* consdata, /**< data for this specific constraint */ 1004 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? 1005 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */ 1006 SCIP_Bool separate, /**< should the constraint be separated during LP processing? 1007 * Usually set to TRUE. */ 1008 SCIP_Bool enforce, /**< should the constraint be enforced during node processing? 1009 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 1010 SCIP_Bool check, /**< should the constraint be checked for feasibility? 1011 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 1012 SCIP_Bool propagate, /**< should the constraint be propagated during node processing? 1013 * Usually set to TRUE. */ 1014 SCIP_Bool local, /**< is constraint only valid locally? 1015 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */ 1016 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? 1017 * Usually set to FALSE. In column generation applications, set to TRUE if pricing 1018 * adds coefficients to this constraint. */ 1019 SCIP_Bool dynamic, /**< is constraint subject to aging? 1020 * Usually set to FALSE. Set to TRUE for own cuts which 1021 * are separated as constraints. */ 1022 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? 1023 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */ 1024 SCIP_Bool stickingatnode /**< should the constraint always be kept at the node where it was added, even 1025 * if it may be moved to a more global node? 1026 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */ 1027 ) 1028 { 1029 assert(cons != NULL); 1030 assert(name != NULL); 1031 assert(conshdlr != NULL); 1032 1033 SCIP_CALL( SCIPcheckStage(scip, "SCIPcreateCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE) ); 1034 1035 switch( scip->set->stage ) 1036 { 1037 case SCIP_STAGE_PROBLEM: 1038 SCIP_CALL( SCIPconsCreate(cons, scip->mem->probmem, scip->set, name, conshdlr, consdata, 1039 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, TRUE, TRUE) ); 1040 return SCIP_OKAY; 1041 1042 case SCIP_STAGE_TRANSFORMING: 1043 case SCIP_STAGE_TRANSFORMED: 1044 case SCIP_STAGE_INITPRESOLVE: 1045 case SCIP_STAGE_PRESOLVING: 1046 case SCIP_STAGE_EXITPRESOLVE: 1047 case SCIP_STAGE_PRESOLVED: 1048 case SCIP_STAGE_INITSOLVE: 1049 case SCIP_STAGE_SOLVING: 1050 case SCIP_STAGE_EXITSOLVE: 1051 SCIP_CALL( SCIPconsCreate(cons, scip->mem->probmem, scip->set, name, conshdlr, consdata, 1052 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, FALSE, TRUE) ); 1053 return SCIP_OKAY; 1054 1055 default: 1056 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage); 1057 return SCIP_INVALIDCALL; 1058 } /*lint !e788*/ 1059 } 1060 1061 /** parses constraint information (in cip format) out of a string; if the parsing process was successful a constraint is 1062 * creates and captures; 1063 * 1064 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1065 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1066 * 1067 * @pre This method can be called if @p scip is in one of the following stages: 1068 * - \ref SCIP_STAGE_PROBLEM 1069 * - \ref SCIP_STAGE_TRANSFORMING 1070 * - \ref SCIP_STAGE_INITPRESOLVE 1071 * - \ref SCIP_STAGE_PRESOLVING 1072 * - \ref SCIP_STAGE_EXITPRESOLVE 1073 * - \ref SCIP_STAGE_PRESOLVED 1074 * - \ref SCIP_STAGE_SOLVING 1075 * - \ref SCIP_STAGE_EXITSOLVE 1076 * 1077 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution may 1078 * be declared feasible even if it violates this particular constraint. This constellation should only be 1079 * used, if no LP or pseudo solution can violate the constraint -- e.g. if a local constraint is redundant due 1080 * to the variable's local bounds. 1081 */ 1082 SCIP_RETCODE SCIPparseCons( 1083 SCIP* scip, /**< SCIP data structure */ 1084 SCIP_CONS** cons, /**< pointer to store constraint */ 1085 const char* str, /**< string to parse for constraint */ 1086 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? 1087 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */ 1088 SCIP_Bool separate, /**< should the constraint be separated during LP processing? 1089 * Usually set to TRUE. */ 1090 SCIP_Bool enforce, /**< should the constraint be enforced during node processing? 1091 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 1092 SCIP_Bool check, /**< should the constraint be checked for feasibility? 1093 * TRUE for model constraints, FALSE for additional, redundant constraints. */ 1094 SCIP_Bool propagate, /**< should the constraint be propagated during node processing? 1095 * Usually set to TRUE. */ 1096 SCIP_Bool local, /**< is constraint only valid locally? 1097 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */ 1098 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? 1099 * Usually set to FALSE. In column generation applications, set to TRUE if pricing 1100 * adds coefficients to this constraint. */ 1101 SCIP_Bool dynamic, /**< is constraint subject to aging? 1102 * Usually set to FALSE. Set to TRUE for own cuts which 1103 * are separated as constraints. */ 1104 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? 1105 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */ 1106 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even 1107 * if it may be moved to a more global node? 1108 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */ 1109 SCIP_Bool* success /**< pointer to store if the paring process was successful */ 1110 ) 1111 { 1112 assert(cons != NULL); 1113 1114 SCIP_CALL( SCIPcheckStage(scip, "SCIPparseCons", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) ); 1115 1116 SCIP_CALL( SCIPconsParse(cons, scip->set, scip->messagehdlr, str, 1117 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, success) ); 1118 1119 return SCIP_OKAY; 1120 } 1121 1122 /** increases usage counter of constraint 1123 * 1124 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1125 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1126 * 1127 * @pre This method can be called if @p scip is in one of the following stages: 1128 * - \ref SCIP_STAGE_PROBLEM 1129 * - \ref SCIP_STAGE_TRANSFORMING 1130 * - \ref SCIP_STAGE_TRANSFORMED 1131 * - \ref SCIP_STAGE_INITPRESOLVE 1132 * - \ref SCIP_STAGE_PRESOLVING 1133 * - \ref SCIP_STAGE_EXITPRESOLVE 1134 * - \ref SCIP_STAGE_PRESOLVED 1135 * - \ref SCIP_STAGE_INITSOLVE 1136 * - \ref SCIP_STAGE_SOLVING 1137 * - \ref SCIP_STAGE_SOLVED 1138 */ 1139 SCIP_RETCODE SCIPcaptureCons( 1140 SCIP* scip, /**< SCIP data structure */ 1141 SCIP_CONS* cons /**< constraint to capture */ 1142 ) 1143 { 1144 SCIP_CALL( SCIPcheckStage(scip, "SCIPcaptureCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1145 1146 assert( cons->scip == scip ); 1147 1148 SCIPconsCapture(cons); 1149 1150 return SCIP_OKAY; 1151 } 1152 1153 /** decreases usage counter of constraint, if the usage pointer reaches zero the constraint gets freed 1154 * 1155 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1156 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1157 * 1158 * @pre This method can be called if @p scip is in one of the following stages: 1159 * - \ref SCIP_STAGE_PROBLEM 1160 * - \ref SCIP_STAGE_TRANSFORMING 1161 * - \ref SCIP_STAGE_TRANSFORMED 1162 * - \ref SCIP_STAGE_INITPRESOLVE 1163 * - \ref SCIP_STAGE_PRESOLVING 1164 * - \ref SCIP_STAGE_EXITPRESOLVE 1165 * - \ref SCIP_STAGE_PRESOLVED 1166 * - \ref SCIP_STAGE_INITSOLVE 1167 * - \ref SCIP_STAGE_SOLVING 1168 * - \ref SCIP_STAGE_SOLVED 1169 * - \ref SCIP_STAGE_EXITSOLVE 1170 * - \ref SCIP_STAGE_FREETRANS 1171 * 1172 * @note the pointer of the constraint will be NULLed 1173 */ 1174 SCIP_RETCODE SCIPreleaseCons( 1175 SCIP* scip, /**< SCIP data structure */ 1176 SCIP_CONS** cons /**< pointer to constraint */ 1177 ) 1178 { 1179 assert(cons != NULL); 1180 assert(*cons != NULL); 1181 1182 SCIP_CALL( SCIPcheckStage(scip, "SCIPreleaseCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) ); 1183 1184 switch( scip->set->stage ) 1185 { 1186 case SCIP_STAGE_PROBLEM: 1187 SCIP_CALL( SCIPconsRelease(cons, scip->mem->probmem, scip->set) ); 1188 return SCIP_OKAY; 1189 1190 case SCIP_STAGE_TRANSFORMING: 1191 case SCIP_STAGE_TRANSFORMED: 1192 case SCIP_STAGE_INITPRESOLVE: 1193 case SCIP_STAGE_PRESOLVING: 1194 case SCIP_STAGE_EXITPRESOLVE: 1195 case SCIP_STAGE_PRESOLVED: 1196 case SCIP_STAGE_INITSOLVE: 1197 case SCIP_STAGE_SOLVING: 1198 case SCIP_STAGE_SOLVED: 1199 case SCIP_STAGE_EXITSOLVE: 1200 case SCIP_STAGE_FREETRANS: 1201 if( SCIPconsIsOriginal(*cons) && (*cons)->nuses == 1 && (*cons)->transorigcons != NULL ) 1202 { 1203 SCIPerrorMessage("cannot release last use of original constraint while an associated transformed constraint exists\n"); 1204 return SCIP_INVALIDCALL; 1205 } 1206 SCIP_CALL( SCIPconsRelease(cons, scip->mem->probmem, scip->set) ); 1207 return SCIP_OKAY; 1208 1209 default: 1210 SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage); 1211 return SCIP_INVALIDCALL; 1212 } /*lint !e788*/ 1213 } 1214 1215 /** change constraint name 1216 * 1217 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1218 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1219 * 1220 * @pre This method can be called if @p scip is in one of the following stages: 1221 * - \ref SCIP_STAGE_PROBLEM 1222 * 1223 * @note to get the current name of a constraint, use SCIPconsGetName() from pub_cons.h 1224 */ 1225 SCIP_RETCODE SCIPchgConsName( 1226 SCIP* scip, /**< SCIP data structure */ 1227 SCIP_CONS* cons, /**< constraint */ 1228 const char* name /**< new name of constraint */ 1229 ) 1230 { 1231 SCIP_CALL( SCIPcheckStage(scip, "SCIPchgConsName", FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE , FALSE, FALSE, FALSE) ); 1232 1233 assert( cons->scip == scip ); 1234 1235 if( SCIPgetStage(scip) != SCIP_STAGE_PROBLEM ) 1236 { 1237 SCIPerrorMessage("constraint names can only be changed in problem creation stage\n"); 1238 SCIPABORT(); 1239 return SCIP_INVALIDCALL; /*lint !e527*/ 1240 } 1241 1242 /* remove constraint's name from the namespace if the constraint was already added */ 1243 if( SCIPconsIsAdded(cons) ) 1244 { 1245 SCIP_CALL( SCIPprobRemoveConsName(scip->origprob, cons) ); 1246 } 1247 1248 /* change constraint name */ 1249 SCIP_CALL( SCIPconsChgName(cons, SCIPblkmem(scip), name) ); 1250 1251 /* add constraint's name to the namespace if the constraint was already added */ 1252 if( SCIPconsIsAdded(cons) ) 1253 { 1254 SCIP_CALL( SCIPprobAddConsName(scip->origprob, cons) ); 1255 } 1256 1257 return SCIP_OKAY; 1258 } 1259 1260 /** sets the initial flag of the given constraint 1261 * 1262 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1263 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1264 * 1265 * @pre This method can be called if @p scip is in one of the following stages: 1266 * - \ref SCIP_STAGE_PROBLEM 1267 * - \ref SCIP_STAGE_TRANSFORMING 1268 * - \ref SCIP_STAGE_PRESOLVING 1269 * - \ref SCIP_STAGE_PRESOLVED 1270 * - \ref SCIP_STAGE_SOLVING 1271 */ 1272 SCIP_RETCODE SCIPsetConsInitial( 1273 SCIP* scip, /**< SCIP data structure */ 1274 SCIP_CONS* cons, /**< constraint */ 1275 SCIP_Bool initial /**< new value */ 1276 ) 1277 { 1278 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsInitial", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1279 1280 SCIP_CALL( SCIPconsSetInitial(cons, scip->set, scip->stat, initial) ); 1281 1282 return SCIP_OKAY; 1283 } 1284 1285 /** sets the separate flag of the given constraint 1286 * 1287 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1288 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1289 * 1290 * @pre This method can be called if @p scip is in one of the following stages: 1291 * - \ref SCIP_STAGE_PROBLEM 1292 * - \ref SCIP_STAGE_TRANSFORMING 1293 * - \ref SCIP_STAGE_PRESOLVING 1294 * - \ref SCIP_STAGE_PRESOLVED 1295 * - \ref SCIP_STAGE_SOLVING 1296 */ 1297 SCIP_RETCODE SCIPsetConsSeparated( 1298 SCIP* scip, /**< SCIP data structure */ 1299 SCIP_CONS* cons, /**< constraint */ 1300 SCIP_Bool separate /**< new value */ 1301 ) 1302 { 1303 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsSeparated", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1304 1305 SCIP_CALL( SCIPconsSetSeparated(cons, scip->set, separate) ); 1306 1307 return SCIP_OKAY; 1308 } 1309 1310 /** sets the enforce flag of the given constraint 1311 * 1312 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1313 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1314 * 1315 * @pre This method can be called if @p scip is in one of the following stages: 1316 * - \ref SCIP_STAGE_PROBLEM 1317 * - \ref SCIP_STAGE_TRANSFORMING 1318 * - \ref SCIP_STAGE_PRESOLVING 1319 * - \ref SCIP_STAGE_PRESOLVED 1320 * - \ref SCIP_STAGE_SOLVING 1321 */ 1322 SCIP_RETCODE SCIPsetConsEnforced( 1323 SCIP* scip, /**< SCIP data structure */ 1324 SCIP_CONS* cons, /**< constraint */ 1325 SCIP_Bool enforce /**< new value */ 1326 ) 1327 { 1328 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsEnforced", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1329 1330 SCIP_CALL( SCIPconsSetEnforced(cons, scip->set, enforce) ); 1331 1332 return SCIP_OKAY; 1333 } 1334 1335 /** sets the check flag of the given constraint 1336 * 1337 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1338 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1339 * 1340 * @pre This method can be called if @p scip is in one of the following stages: 1341 * - \ref SCIP_STAGE_PROBLEM 1342 * - \ref SCIP_STAGE_TRANSFORMING 1343 * - \ref SCIP_STAGE_PRESOLVING 1344 * - \ref SCIP_STAGE_PRESOLVED 1345 * - \ref SCIP_STAGE_SOLVING 1346 */ 1347 SCIP_RETCODE SCIPsetConsChecked( 1348 SCIP* scip, /**< SCIP data structure */ 1349 SCIP_CONS* cons, /**< constraint */ 1350 SCIP_Bool check /**< new value */ 1351 ) 1352 { 1353 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsChecked", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1354 1355 SCIP_CALL( SCIPconsSetChecked(cons, scip->set, check) ); 1356 1357 return SCIP_OKAY; 1358 } 1359 1360 /** sets the propagate flag of the given constraint 1361 * 1362 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1363 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1364 * 1365 * @pre This method can be called if @p scip is in one of the following stages: 1366 * - \ref SCIP_STAGE_PROBLEM 1367 * - \ref SCIP_STAGE_TRANSFORMING 1368 * - \ref SCIP_STAGE_PRESOLVING 1369 * - \ref SCIP_STAGE_PRESOLVED 1370 * - \ref SCIP_STAGE_SOLVING 1371 */ 1372 SCIP_RETCODE SCIPsetConsPropagated( 1373 SCIP* scip, /**< SCIP data structure */ 1374 SCIP_CONS* cons, /**< constraint */ 1375 SCIP_Bool propagate /**< new value */ 1376 ) 1377 { 1378 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsPropagated", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1379 1380 SCIP_CALL( SCIPconsSetPropagated(cons, scip->set, propagate) ); 1381 1382 return SCIP_OKAY; 1383 } 1384 1385 /** sets the local flag of the given constraint 1386 * 1387 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1388 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1389 * 1390 * @pre This method can be called if @p scip is in one of the following stages: 1391 * - \ref SCIP_STAGE_PROBLEM 1392 * - \ref SCIP_STAGE_TRANSFORMING 1393 * - \ref SCIP_STAGE_INITPRESOLVE 1394 * - \ref SCIP_STAGE_PRESOLVING 1395 * - \ref SCIP_STAGE_PRESOLVED 1396 * - \ref SCIP_STAGE_INITSOLVE 1397 * - \ref SCIP_STAGE_SOLVING 1398 */ 1399 SCIP_RETCODE SCIPsetConsLocal( 1400 SCIP* scip, /**< SCIP data structure */ 1401 SCIP_CONS* cons, /**< constraint */ 1402 SCIP_Bool local /**< new value */ 1403 ) 1404 { 1405 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsLocal", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1406 1407 SCIPconsSetLocal(cons, local); 1408 1409 return SCIP_OKAY; 1410 } 1411 1412 /** sets the modifiable flag of the given constraint 1413 * 1414 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1415 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1416 * 1417 * @pre This method can be called if @p scip is in one of the following stages: 1418 * - \ref SCIP_STAGE_PROBLEM 1419 * - \ref SCIP_STAGE_TRANSFORMING 1420 * - \ref SCIP_STAGE_PRESOLVING 1421 * - \ref SCIP_STAGE_PRESOLVED 1422 * - \ref SCIP_STAGE_SOLVING 1423 * - \ref SCIP_STAGE_EXITSOLVE 1424 */ 1425 SCIP_RETCODE SCIPsetConsModifiable( 1426 SCIP* scip, /**< SCIP data structure */ 1427 SCIP_CONS* cons, /**< constraint */ 1428 SCIP_Bool modifiable /**< new value */ 1429 ) 1430 { 1431 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsModifiable", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE) ); 1432 1433 SCIPconsSetModifiable(cons, modifiable); 1434 1435 return SCIP_OKAY; 1436 } 1437 1438 /** sets the dynamic flag of the given constraint 1439 * 1440 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1441 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1442 * 1443 * @pre This method can be called if @p scip is in one of the following stages: 1444 * - \ref SCIP_STAGE_PROBLEM 1445 * - \ref SCIP_STAGE_TRANSFORMING 1446 * - \ref SCIP_STAGE_PRESOLVING 1447 * - \ref SCIP_STAGE_PRESOLVED 1448 * - \ref SCIP_STAGE_SOLVING 1449 */ 1450 SCIP_RETCODE SCIPsetConsDynamic( 1451 SCIP* scip, /**< SCIP data structure */ 1452 SCIP_CONS* cons, /**< constraint */ 1453 SCIP_Bool dynamic /**< new value */ 1454 ) 1455 { 1456 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsDynamic", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1457 1458 SCIPconsSetDynamic(cons, dynamic); 1459 1460 return SCIP_OKAY; 1461 } 1462 1463 /** sets the removable flag of the given constraint 1464 * 1465 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1466 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1467 * 1468 * @pre This method can be called if @p scip is in one of the following stages: 1469 * - \ref SCIP_STAGE_PROBLEM 1470 * - \ref SCIP_STAGE_TRANSFORMING 1471 * - \ref SCIP_STAGE_PRESOLVING 1472 * - \ref SCIP_STAGE_PRESOLVED 1473 * - \ref SCIP_STAGE_SOLVING 1474 */ 1475 SCIP_RETCODE SCIPsetConsRemovable( 1476 SCIP* scip, /**< SCIP data structure */ 1477 SCIP_CONS* cons, /**< constraint */ 1478 SCIP_Bool removable /**< new value */ 1479 ) 1480 { 1481 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsRemovable", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1482 1483 SCIPconsSetRemovable(cons, removable); 1484 1485 return SCIP_OKAY; 1486 } 1487 1488 /** sets the stickingatnode flag of the given constraint 1489 * 1490 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1491 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1492 * 1493 * @pre This method can be called if @p scip is in one of the following stages: 1494 * - \ref SCIP_STAGE_PROBLEM 1495 * - \ref SCIP_STAGE_TRANSFORMING 1496 * - \ref SCIP_STAGE_PRESOLVING 1497 * - \ref SCIP_STAGE_PRESOLVED 1498 * - \ref SCIP_STAGE_SOLVING 1499 */ 1500 SCIP_RETCODE SCIPsetConsStickingAtNode( 1501 SCIP* scip, /**< SCIP data structure */ 1502 SCIP_CONS* cons, /**< constraint */ 1503 SCIP_Bool stickingatnode /**< new value */ 1504 ) 1505 { 1506 SCIP_CALL( SCIPcheckStage(scip, "SCIPsetConsStickingAtNode", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1507 1508 SCIPconsSetStickingAtNode(cons, stickingatnode); 1509 1510 return SCIP_OKAY; 1511 } 1512 1513 /** updates the flags of the first constraint according to the ones of the second constraint 1514 * 1515 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1516 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1517 * 1518 * @pre This method can be called if @p scip is in one of the following stages: 1519 * - \ref SCIP_STAGE_PROBLEM 1520 * - \ref SCIP_STAGE_TRANSFORMING 1521 * - \ref SCIP_STAGE_PRESOLVING 1522 * - \ref SCIP_STAGE_PRESOLVED 1523 * - \ref SCIP_STAGE_SOLVING 1524 */ 1525 SCIP_RETCODE SCIPupdateConsFlags( 1526 SCIP* scip, /**< SCIP data structure */ 1527 SCIP_CONS* cons0, /**< constraint that should stay */ 1528 SCIP_CONS* cons1 /**< constraint that should be deleted */ 1529 ) 1530 { 1531 SCIP_CALL( SCIPcheckStage(scip, "SCIPupdateConsFlags", FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1532 1533 if( SCIPconsIsInitial(cons1) ) 1534 { 1535 SCIP_CALL( SCIPsetConsInitial(scip, cons0, TRUE) ); 1536 } 1537 if( SCIPconsIsSeparated(cons1) ) 1538 { 1539 SCIP_CALL( SCIPsetConsSeparated(scip, cons0, TRUE) ); 1540 } 1541 if( SCIPconsIsEnforced(cons1) ) 1542 { 1543 SCIP_CALL( SCIPsetConsEnforced(scip, cons0, TRUE) ); 1544 } 1545 if( SCIPconsIsChecked(cons1) ) 1546 { 1547 SCIP_CALL( SCIPsetConsChecked(scip, cons0, TRUE) ); 1548 } 1549 if( SCIPconsIsPropagated(cons1) ) 1550 { 1551 SCIP_CALL( SCIPsetConsPropagated(scip, cons0, TRUE) ); 1552 } 1553 if( !SCIPconsIsDynamic(cons1) ) 1554 { 1555 SCIP_CALL( SCIPsetConsDynamic(scip, cons0, FALSE) ); 1556 } 1557 if( !SCIPconsIsRemovable(cons1) ) 1558 { 1559 SCIP_CALL( SCIPsetConsRemovable(scip, cons0, FALSE) ); 1560 } 1561 if( SCIPconsIsStickingAtNode(cons1) ) 1562 { 1563 SCIP_CALL( SCIPsetConsStickingAtNode(scip, cons0, TRUE) ); 1564 } 1565 1566 return SCIP_OKAY; 1567 } 1568 1569 /** gets and captures transformed constraint of a given constraint; if the constraint is not yet transformed, 1570 * a new transformed constraint for this constraint is created 1571 * 1572 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1573 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1574 * 1575 * @pre This method can be called if @p scip is in one of the following stages: 1576 * - \ref SCIP_STAGE_TRANSFORMING 1577 * - \ref SCIP_STAGE_TRANSFORMED 1578 * - \ref SCIP_STAGE_INITPRESOLVE 1579 * - \ref SCIP_STAGE_PRESOLVING 1580 * - \ref SCIP_STAGE_EXITPRESOLVE 1581 * - \ref SCIP_STAGE_PRESOLVED 1582 * - \ref SCIP_STAGE_INITSOLVE 1583 * - \ref SCIP_STAGE_SOLVING 1584 */ 1585 SCIP_RETCODE SCIPtransformCons( 1586 SCIP* scip, /**< SCIP data structure */ 1587 SCIP_CONS* cons, /**< constraint to get/create transformed constraint for */ 1588 SCIP_CONS** transcons /**< pointer to store the transformed constraint */ 1589 ) 1590 { 1591 assert(transcons != NULL); 1592 assert(cons->scip == scip); 1593 1594 SCIP_CALL( SCIPcheckStage(scip, "SCIPtransformCons", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1595 1596 if( SCIPconsIsTransformed(cons) ) 1597 { 1598 *transcons = cons; 1599 SCIPconsCapture(*transcons); 1600 } 1601 else 1602 { 1603 SCIP_CALL( SCIPconsTransform(cons, scip->mem->probmem, scip->set, transcons) ); 1604 } 1605 1606 return SCIP_OKAY; 1607 } 1608 1609 /** gets and captures transformed constraints for an array of constraints; 1610 * if a constraint in the array is not yet transformed, a new transformed constraint for this constraint is created; 1611 * it is possible to call this method with conss == transconss 1612 * 1613 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1614 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1615 * 1616 * @pre This method can be called if @p scip is in one of the following stages: 1617 * - \ref SCIP_STAGE_TRANSFORMING 1618 * - \ref SCIP_STAGE_TRANSFORMED 1619 * - \ref SCIP_STAGE_INITPRESOLVE 1620 * - \ref SCIP_STAGE_PRESOLVING 1621 * - \ref SCIP_STAGE_EXITPRESOLVE 1622 * - \ref SCIP_STAGE_PRESOLVED 1623 * - \ref SCIP_STAGE_INITSOLVE 1624 * - \ref SCIP_STAGE_SOLVING 1625 */ 1626 SCIP_RETCODE SCIPtransformConss( 1627 SCIP* scip, /**< SCIP data structure */ 1628 int nconss, /**< number of constraints to get/create transformed constraints for */ 1629 SCIP_CONS** conss, /**< array with constraints to get/create transformed constraints for */ 1630 SCIP_CONS** transconss /**< array to store the transformed constraints */ 1631 ) 1632 { 1633 int c; 1634 1635 assert(nconss == 0 || conss != NULL); 1636 assert(nconss == 0 || transconss != NULL); 1637 1638 SCIP_CALL( SCIPcheckStage(scip, "SCIPtransformConss", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 1639 1640 for( c = 0; c < nconss; ++c ) 1641 { 1642 if( SCIPconsIsTransformed(conss[c]) ) 1643 { 1644 transconss[c] = conss[c]; 1645 SCIPconsCapture(transconss[c]); 1646 } 1647 else 1648 { 1649 SCIP_CALL( SCIPconsTransform(conss[c], scip->mem->probmem, scip->set, &transconss[c]) ); 1650 } 1651 } 1652 1653 return SCIP_OKAY; 1654 } 1655 1656 /** gets corresponding transformed constraint of a given constraint; 1657 * returns NULL as transcons, if transformed constraint is not yet existing 1658 * 1659 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1660 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1661 * 1662 * @pre This method can be called if @p scip is in one of the following stages: 1663 * - \ref SCIP_STAGE_TRANSFORMING 1664 * - \ref SCIP_STAGE_TRANSFORMED 1665 * - \ref SCIP_STAGE_INITPRESOLVE 1666 * - \ref SCIP_STAGE_PRESOLVING 1667 * - \ref SCIP_STAGE_EXITPRESOLVE 1668 * - \ref SCIP_STAGE_PRESOLVED 1669 * - \ref SCIP_STAGE_INITSOLVE 1670 * - \ref SCIP_STAGE_SOLVING 1671 * - \ref SCIP_STAGE_SOLVED 1672 * - \ref SCIP_STAGE_EXITSOLVE 1673 * - \ref SCIP_STAGE_FREETRANS 1674 */ 1675 SCIP_RETCODE SCIPgetTransformedCons( 1676 SCIP* scip, /**< SCIP data structure */ 1677 SCIP_CONS* cons, /**< constraint to get the transformed constraint for */ 1678 SCIP_CONS** transcons /**< pointer to store the transformed constraint */ 1679 ) 1680 { 1681 assert(transcons != NULL); 1682 assert(cons->scip == scip); 1683 1684 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetTransformedCons", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) ); 1685 1686 if( SCIPconsIsTransformed(cons) ) 1687 *transcons = cons; 1688 else 1689 *transcons = SCIPconsGetTransformed(cons); 1690 1691 return SCIP_OKAY; 1692 } 1693 1694 /** gets corresponding transformed constraints for an array of constraints; 1695 * stores NULL in a transconss slot, if the transformed constraint is not yet existing; 1696 * it is possible to call this method with conss == transconss, but remember that constraints that are not 1697 * yet transformed will be replaced with NULL 1698 * 1699 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1700 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1701 * 1702 * @pre This method can be called if @p scip is in one of the following stages: 1703 * - \ref SCIP_STAGE_TRANSFORMING 1704 * - \ref SCIP_STAGE_TRANSFORMED 1705 * - \ref SCIP_STAGE_INITPRESOLVE 1706 * - \ref SCIP_STAGE_PRESOLVING 1707 * - \ref SCIP_STAGE_EXITPRESOLVE 1708 * - \ref SCIP_STAGE_PRESOLVED 1709 * - \ref SCIP_STAGE_INITSOLVE 1710 * - \ref SCIP_STAGE_SOLVING 1711 * - \ref SCIP_STAGE_SOLVED 1712 * - \ref SCIP_STAGE_EXITSOLVE 1713 * - \ref SCIP_STAGE_FREETRANS 1714 */ 1715 SCIP_RETCODE SCIPgetTransformedConss( 1716 SCIP* scip, /**< SCIP data structure */ 1717 int nconss, /**< number of constraints to get the transformed constraints for */ 1718 SCIP_CONS** conss, /**< constraints to get the transformed constraints for */ 1719 SCIP_CONS** transconss /**< array to store the transformed constraints */ 1720 ) 1721 { 1722 int c; 1723 1724 assert(nconss == 0 || conss != NULL); 1725 assert(nconss == 0 || transconss != NULL); 1726 1727 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetTransformedConss", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) ); 1728 1729 for( c = 0; c < nconss; ++c ) 1730 { 1731 if( SCIPconsIsTransformed(conss[c]) ) 1732 transconss[c] = conss[c]; 1733 else 1734 transconss[c] = SCIPconsGetTransformed(conss[c]); 1735 } 1736 1737 return SCIP_OKAY; 1738 } 1739 1740 /** adds given value to age of constraint, but age can never become negative; 1741 * should be called 1742 * - in constraint separation, if no cut was found for this constraint, 1743 * - in constraint enforcing, if constraint was feasible, and 1744 * - in constraint propagation, if no domain reduction was deduced; 1745 * 1746 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1747 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1748 * 1749 * @pre This method can be called if @p scip is in one of the following stages: 1750 * - \ref SCIP_STAGE_TRANSFORMED 1751 * - \ref SCIP_STAGE_PRESOLVING 1752 * - \ref SCIP_STAGE_PRESOLVED 1753 * - \ref SCIP_STAGE_SOLVING 1754 * - \ref SCIP_STAGE_SOLVED 1755 */ 1756 SCIP_RETCODE SCIPaddConsAge( 1757 SCIP* scip, /**< SCIP data structure */ 1758 SCIP_CONS* cons, /**< constraint */ 1759 SCIP_Real deltaage /**< value to add to the constraint's age */ 1760 ) 1761 { 1762 SCIP_CALL( SCIPcheckStage(scip, "SCIPaddConsAge", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1763 1764 SCIP_CALL( SCIPconsAddAge(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob, deltaage, scip->reopt) ); 1765 1766 return SCIP_OKAY; 1767 } 1768 1769 /** increases age of constraint by 1.0; 1770 * should be called 1771 * - in constraint separation, if no cut was found for this constraint, 1772 * - in constraint enforcing, if constraint was feasible, and 1773 * - in constraint propagation, if no domain reduction was deduced; 1774 * 1775 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1776 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1777 * 1778 * @pre This method can be called if @p scip is in one of the following stages: 1779 * - \ref SCIP_STAGE_TRANSFORMED 1780 * - \ref SCIP_STAGE_PRESOLVING 1781 * - \ref SCIP_STAGE_PRESOLVED 1782 * - \ref SCIP_STAGE_SOLVING 1783 * - \ref SCIP_STAGE_SOLVED 1784 */ 1785 SCIP_RETCODE SCIPincConsAge( 1786 SCIP* scip, /**< SCIP data structure */ 1787 SCIP_CONS* cons /**< constraint */ 1788 ) 1789 { 1790 SCIP_CALL( SCIPcheckStage(scip, "SCIPincConsAge", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1791 1792 SCIP_CALL( SCIPconsIncAge(cons, scip->mem->probmem, scip->set, scip->stat, scip->transprob, scip->reopt) ); 1793 1794 return SCIP_OKAY; 1795 } 1796 1797 /** resets age of constraint to zero; 1798 * should be called 1799 * - in constraint separation, if a cut was found for this constraint, 1800 * - in constraint enforcing, if the constraint was violated, and 1801 * - in constraint propagation, if a domain reduction was deduced; 1802 * 1803 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1804 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1805 * 1806 * @pre This method can be called if @p scip is in one of the following stages: 1807 * - \ref SCIP_STAGE_TRANSFORMED 1808 * - \ref SCIP_STAGE_PRESOLVING 1809 * - \ref SCIP_STAGE_PRESOLVED 1810 * - \ref SCIP_STAGE_SOLVING 1811 * - \ref SCIP_STAGE_SOLVED 1812 */ 1813 SCIP_RETCODE SCIPresetConsAge( 1814 SCIP* scip, /**< SCIP data structure */ 1815 SCIP_CONS* cons /**< constraint */ 1816 ) 1817 { 1818 SCIP_CALL( SCIPcheckStage(scip, "SCIPresetConsAge", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1819 1820 SCIP_CALL( SCIPconsResetAge(cons, scip->set) ); 1821 1822 return SCIP_OKAY; 1823 } 1824 1825 /** enables constraint's separation, propagation, and enforcing capabilities 1826 * 1827 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1828 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1829 * 1830 * @pre This method can be called if @p scip is in one of the following stages: 1831 * - \ref SCIP_STAGE_TRANSFORMED 1832 * - \ref SCIP_STAGE_PRESOLVING 1833 * - \ref SCIP_STAGE_PRESOLVED 1834 * - \ref SCIP_STAGE_INITSOLVE 1835 * - \ref SCIP_STAGE_SOLVING 1836 * - \ref SCIP_STAGE_SOLVED 1837 */ 1838 SCIP_RETCODE SCIPenableCons( 1839 SCIP* scip, /**< SCIP data structure */ 1840 SCIP_CONS* cons /**< constraint */ 1841 ) 1842 { 1843 SCIP_CALL( SCIPcheckStage(scip, "SCIPenableCons", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1844 1845 SCIP_CALL( SCIPconsEnable(cons, scip->set, scip->stat) ); 1846 1847 return SCIP_OKAY; 1848 } 1849 1850 /** disables constraint's separation, propagation, and enforcing capabilities, s.t. the constraint is not propagated, 1851 * separated, and enforced anymore until it is enabled again with a call to SCIPenableCons(); 1852 * in contrast to SCIPdelConsLocal() and SCIPdelConsNode(), the disabling is not associated to a node in the tree and 1853 * does not consume memory; therefore, the constraint is neither automatically enabled on leaving the node nor 1854 * automatically disabled again on entering the node again; 1855 * note that the constraints enforcing capabilities are necessary for the solution's feasibility, if the constraint 1856 * is a model constraint; that means, you must be sure that the constraint cannot be violated in the current subtree, 1857 * and you have to enable it again manually by calling SCIPenableCons(), if this subtree is left (e.g. by using 1858 * an appropriate event handler that watches the corresponding variables' domain changes) 1859 * 1860 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1861 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1862 * 1863 * @pre This method can be called if @p scip is in one of the following stages: 1864 * - \ref SCIP_STAGE_TRANSFORMED 1865 * - \ref SCIP_STAGE_INITPRESOLVE 1866 * - \ref SCIP_STAGE_PRESOLVING 1867 * - \ref SCIP_STAGE_PRESOLVED 1868 * - \ref SCIP_STAGE_INITSOLVE 1869 * - \ref SCIP_STAGE_SOLVING 1870 * - \ref SCIP_STAGE_SOLVED 1871 */ 1872 SCIP_RETCODE SCIPdisableCons( 1873 SCIP* scip, /**< SCIP data structure */ 1874 SCIP_CONS* cons /**< constraint */ 1875 ) 1876 { 1877 SCIP_CALL( SCIPcheckStage(scip, "SCIPdisableCons", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1878 1879 SCIP_CALL( SCIPconsDisable(cons, scip->set, scip->stat) ); 1880 1881 return SCIP_OKAY; 1882 } 1883 1884 /** enables constraint's separation capabilities 1885 * 1886 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1887 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1888 * 1889 * @pre This method can be called if @p scip is in one of the following stages: 1890 * - \ref SCIP_STAGE_TRANSFORMED 1891 * - \ref SCIP_STAGE_PRESOLVING 1892 * - \ref SCIP_STAGE_PRESOLVED 1893 * - \ref SCIP_STAGE_INITSOLVE 1894 * - \ref SCIP_STAGE_SOLVING 1895 * - \ref SCIP_STAGE_SOLVED 1896 */ 1897 SCIP_RETCODE SCIPenableConsSeparation( 1898 SCIP* scip, /**< SCIP data structure */ 1899 SCIP_CONS* cons /**< constraint */ 1900 ) 1901 { 1902 SCIP_CALL( SCIPcheckStage(scip, "SCIPenableConsSeparation", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1903 1904 SCIP_CALL( SCIPconsEnableSeparation(cons, scip->set) ); 1905 1906 return SCIP_OKAY; 1907 } 1908 1909 /** disables constraint's separation capabilities s.t. the constraint is not separated anymore until the separation 1910 * is enabled again with a call to SCIPenableConsSeparation(); in contrast to SCIPdelConsLocal() and SCIPdelConsNode(), 1911 * the disabling is not associated to a node in the tree and does not consume memory; therefore, the constraint 1912 * is neither automatically enabled on leaving the node nor automatically disabled again on entering the node again 1913 * 1914 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1915 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1916 * 1917 * @pre This method can be called if @p scip is in one of the following stages: 1918 * - \ref SCIP_STAGE_TRANSFORMED 1919 * - \ref SCIP_STAGE_PRESOLVING 1920 * - \ref SCIP_STAGE_PRESOLVED 1921 * - \ref SCIP_STAGE_INITSOLVE 1922 * - \ref SCIP_STAGE_SOLVING 1923 * - \ref SCIP_STAGE_SOLVED 1924 */ 1925 SCIP_RETCODE SCIPdisableConsSeparation( 1926 SCIP* scip, /**< SCIP data structure */ 1927 SCIP_CONS* cons /**< constraint */ 1928 ) 1929 { 1930 SCIP_CALL( SCIPcheckStage(scip, "SCIPdisableConsSeparation", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1931 1932 SCIP_CALL( SCIPconsDisableSeparation(cons, scip->set) ); 1933 1934 return SCIP_OKAY; 1935 } 1936 1937 /** enables constraint's propagation capabilities 1938 * 1939 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1940 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1941 * 1942 * @pre This method can be called if @p scip is in one of the following stages: 1943 * - \ref SCIP_STAGE_TRANSFORMED 1944 * - \ref SCIP_STAGE_INITPRESOLVE 1945 * - \ref SCIP_STAGE_PRESOLVING 1946 * - \ref SCIP_STAGE_EXITPRESOLVE 1947 * - \ref SCIP_STAGE_PRESOLVED 1948 * - \ref SCIP_STAGE_INITSOLVE 1949 * - \ref SCIP_STAGE_SOLVING 1950 * - \ref SCIP_STAGE_SOLVED 1951 */ 1952 SCIP_RETCODE SCIPenableConsPropagation( 1953 SCIP* scip, /**< SCIP data structure */ 1954 SCIP_CONS* cons /**< constraint */ 1955 ) 1956 { 1957 SCIP_CALL( SCIPcheckStage(scip, "SCIPenableConsPropagation", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1958 1959 SCIP_CALL( SCIPconsEnablePropagation(cons, scip->set) ); 1960 1961 return SCIP_OKAY; 1962 } 1963 1964 /** disables constraint's propagation capabilities s.t. the constraint is not propagated anymore until the propagation 1965 * is enabled again with a call to SCIPenableConsPropagation(); in contrast to SCIPdelConsLocal() and SCIPdelConsNode(), 1966 * the disabling is not associated to a node in the tree and does not consume memory; therefore, the constraint 1967 * is neither automatically enabled on leaving the node nor automatically disabled again on entering the node again 1968 * 1969 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1970 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 1971 * 1972 * @pre This method can be called if @p scip is in one of the following stages: 1973 * - \ref SCIP_STAGE_TRANSFORMED 1974 * - \ref SCIP_STAGE_INITPRESOLVE 1975 * - \ref SCIP_STAGE_PRESOLVING 1976 * - \ref SCIP_STAGE_EXITPRESOLVE 1977 * - \ref SCIP_STAGE_PRESOLVED 1978 * - \ref SCIP_STAGE_INITSOLVE 1979 * - \ref SCIP_STAGE_SOLVING 1980 * - \ref SCIP_STAGE_SOLVED 1981 */ 1982 SCIP_RETCODE SCIPdisableConsPropagation( 1983 SCIP* scip, /**< SCIP data structure */ 1984 SCIP_CONS* cons /**< constraint */ 1985 ) 1986 { 1987 SCIP_CALL( SCIPcheckStage(scip, "SCIPdisableConsPropagation", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 1988 1989 SCIP_CALL( SCIPconsDisablePropagation(cons, scip->set) ); 1990 1991 return SCIP_OKAY; 1992 } 1993 1994 #undef SCIPmarkConsPropagate 1995 1996 /** marks constraint to be propagated 1997 * 1998 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 1999 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2000 * 2001 * @pre This method can be called if @p scip is in one of the following stages: 2002 * - \ref SCIP_STAGE_TRANSFORMING 2003 * - \ref SCIP_STAGE_TRANSFORMED 2004 * - \ref SCIP_STAGE_INITPRESOLVE 2005 * - \ref SCIP_STAGE_PRESOLVING 2006 * - \ref SCIP_STAGE_EXITPRESOLVE 2007 * - \ref SCIP_STAGE_PRESOLVED 2008 * - \ref SCIP_STAGE_INITSOLVE 2009 * - \ref SCIP_STAGE_SOLVING 2010 * - \ref SCIP_STAGE_SOLVED 2011 * - \ref SCIP_STAGE_EXITSOLVE 2012 * 2013 * @note if a constraint is marked to be propagated, the age of the constraint will be ignored for propagation 2014 */ 2015 SCIP_RETCODE SCIPmarkConsPropagate( 2016 SCIP* scip, /**< SCIP data structure */ 2017 SCIP_CONS* cons /**< constraint */ 2018 ) 2019 { 2020 SCIP_CALL( SCIPcheckStage(scip, "SCIPmarkConsPropagate", FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE) ); 2021 2022 SCIP_CALL( SCIPconsMarkPropagate(cons, scip->set) ); 2023 2024 assert(!SCIPconsIsEnabled(cons) || SCIPconsIsMarkedPropagate(cons)); 2025 2026 return SCIP_OKAY; 2027 } 2028 2029 /** unmarks the constraint to be propagated 2030 * 2031 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2032 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2033 * 2034 * @pre This method can be called if @p scip is in one of the following stages: 2035 * - \ref SCIP_STAGE_TRANSFORMED 2036 * - \ref SCIP_STAGE_PRESOLVING 2037 * - \ref SCIP_STAGE_EXITPRESOLVE 2038 * - \ref SCIP_STAGE_PRESOLVED 2039 * - \ref SCIP_STAGE_INITSOLVE 2040 * - \ref SCIP_STAGE_SOLVING 2041 * - \ref SCIP_STAGE_SOLVED 2042 */ 2043 SCIP_RETCODE SCIPunmarkConsPropagate( 2044 SCIP* scip, /**< SCIP data structure */ 2045 SCIP_CONS* cons /**< constraint */ 2046 ) 2047 { 2048 SCIP_CALL( SCIPcheckStage(scip, "SCIPunmarkConsPropagate", FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 2049 2050 SCIP_CALL( SCIPconsUnmarkPropagate(cons, scip->set) ); 2051 2052 assert(!SCIPconsIsEnabled(cons) || !SCIPconsIsMarkedPropagate(cons)); 2053 2054 return SCIP_OKAY; 2055 } 2056 2057 /** adds given values to lock status of type @p locktype of the constraint and updates the rounding locks of the involved variables 2058 * 2059 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2060 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2061 * 2062 * @pre This method can be called if @p scip is in one of the following stages: 2063 * - \ref SCIP_STAGE_PROBLEM 2064 * - \ref SCIP_STAGE_TRANSFORMING 2065 * - \ref SCIP_STAGE_INITPRESOLVE 2066 * - \ref SCIP_STAGE_PRESOLVING 2067 * - \ref SCIP_STAGE_EXITPRESOLVE 2068 * - \ref SCIP_STAGE_INITSOLVE 2069 * - \ref SCIP_STAGE_SOLVING 2070 * - \ref SCIP_STAGE_EXITSOLVE 2071 * - \ref SCIP_STAGE_FREETRANS 2072 */ 2073 SCIP_RETCODE SCIPaddConsLocksType( 2074 SCIP* scip, /**< SCIP data structure */ 2075 SCIP_CONS* cons, /**< constraint */ 2076 SCIP_LOCKTYPE locktype, /**< type of the variable locks */ 2077 int nlockspos, /**< increase in number of rounding locks for constraint */ 2078 int nlocksneg /**< increase in number of rounding locks for constraint's negation */ 2079 ) 2080 { 2081 SCIP_CALL( SCIPcheckStage(scip, "SCIPaddConsLocksType", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE) ); 2082 2083 SCIP_CALL( SCIPconsAddLocks(cons, scip->set, locktype, nlockspos, nlocksneg) ); 2084 2085 return SCIP_OKAY; 2086 } 2087 2088 /** adds given values to lock status of the constraint and updates the rounding locks of the involved variables 2089 * 2090 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2091 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2092 * 2093 * @pre This method can be called if @p scip is in one of the following stages: 2094 * - \ref SCIP_STAGE_PROBLEM 2095 * - \ref SCIP_STAGE_TRANSFORMING 2096 * - \ref SCIP_STAGE_INITPRESOLVE 2097 * - \ref SCIP_STAGE_PRESOLVING 2098 * - \ref SCIP_STAGE_EXITPRESOLVE 2099 * - \ref SCIP_STAGE_INITSOLVE 2100 * - \ref SCIP_STAGE_SOLVING 2101 * - \ref SCIP_STAGE_EXITSOLVE 2102 * - \ref SCIP_STAGE_FREETRANS 2103 * 2104 * @note This methods always adds locks of type model 2105 */ 2106 SCIP_RETCODE SCIPaddConsLocks( 2107 SCIP* scip, /**< SCIP data structure */ 2108 SCIP_CONS* cons, /**< constraint */ 2109 int nlockspos, /**< increase in number of rounding locks for constraint */ 2110 int nlocksneg /**< increase in number of rounding locks for constraint's negation */ 2111 ) 2112 { 2113 SCIP_CALL( SCIPcheckStage(scip, "SCIPaddConsLocks", FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE, FALSE) ); 2114 2115 SCIP_CALL( SCIPaddConsLocksType(scip, cons, SCIP_LOCKTYPE_MODEL, nlockspos, nlocksneg) ); 2116 2117 return SCIP_OKAY; 2118 } 2119 2120 /** checks single constraint for feasibility of the given solution 2121 * 2122 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2123 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2124 * 2125 * @pre This method can be called if @p scip is in one of the following stages: 2126 * - \ref SCIP_STAGE_PROBLEM 2127 * - \ref SCIP_STAGE_TRANSFORMED 2128 * - \ref SCIP_STAGE_INITPRESOLVE 2129 * - \ref SCIP_STAGE_PRESOLVING 2130 * - \ref SCIP_STAGE_EXITPRESOLVE 2131 * - \ref SCIP_STAGE_PRESOLVED 2132 * - \ref SCIP_STAGE_INITSOLVE 2133 * - \ref SCIP_STAGE_SOLVING 2134 * - \ref SCIP_STAGE_SOLVED 2135 */ 2136 SCIP_RETCODE SCIPcheckCons( 2137 SCIP* scip, /**< SCIP data structure */ 2138 SCIP_CONS* cons, /**< constraint to check */ 2139 SCIP_SOL* sol, /**< primal CIP solution */ 2140 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */ 2141 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */ 2142 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */ 2143 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 2144 ) 2145 { 2146 SCIP_CALL( SCIPcheckStage(scip, "SCIPcheckCons", FALSE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE) ); 2147 2148 SCIP_CALL( SCIPconsCheck(cons, scip->set, sol, checkintegrality, checklprows, printreason, result) ); 2149 2150 return SCIP_OKAY; 2151 } 2152 2153 /** enforces single constraint for a given pseudo solution 2154 * 2155 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2156 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2157 * 2158 * @pre This method can be called if @p scip is in one of the following stages: 2159 * - \ref SCIP_STAGE_SOLVING 2160 * 2161 * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not 2162 * added to SCIP beforehand. 2163 */ 2164 SCIP_RETCODE SCIPenfopsCons( 2165 SCIP* scip, /**< SCIP data structure */ 2166 SCIP_CONS* cons, /**< constraint to enforce */ 2167 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */ 2168 SCIP_Bool objinfeasible, /**< is the solution infeasible anyway due to violating lower objective bound? */ 2169 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 2170 ) 2171 { 2172 assert(scip != NULL); 2173 assert(cons != NULL); 2174 assert(!SCIPconsIsAdded(cons)); 2175 assert(result != NULL); 2176 2177 SCIP_CALL( SCIPcheckStage(scip, "SCIPenfopsCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2178 2179 SCIP_CALL( SCIPconsEnfops(cons, scip->set, solinfeasible, objinfeasible, result) ); 2180 2181 return SCIP_OKAY; 2182 } 2183 2184 /** enforces single constraint for a given LP solution 2185 * 2186 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2187 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2188 * 2189 * @pre This method can be called if @p scip is in one of the following stages: 2190 * - \ref SCIP_STAGE_SOLVING 2191 * 2192 * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not 2193 * added to SCIP beforehand. 2194 */ 2195 SCIP_RETCODE SCIPenfolpCons( 2196 SCIP* scip, /**< SCIP data structure */ 2197 SCIP_CONS* cons, /**< constraint to enforce */ 2198 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */ 2199 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 2200 ) 2201 { 2202 assert(scip != NULL); 2203 assert(cons != NULL); 2204 assert(!SCIPconsIsAdded(cons)); 2205 assert(result != NULL); 2206 2207 SCIP_CALL( SCIPcheckStage(scip, "SCIPenfolpCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2208 2209 SCIP_CALL( SCIPconsEnfolp(cons, scip->set, solinfeasible, result) ); 2210 2211 return SCIP_OKAY; 2212 } 2213 2214 /** enforces single constraint for a given relaxation solution 2215 * 2216 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2217 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2218 * 2219 * @pre This method can be called if @p scip is in one of the following stages: 2220 * - \ref SCIP_STAGE_SOLVING 2221 * 2222 * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not 2223 * added to SCIP beforehand. 2224 */ 2225 SCIP_RETCODE SCIPenforelaxCons( 2226 SCIP* scip, /**< SCIP data structure */ 2227 SCIP_CONS* cons, /**< constraint to enforce */ 2228 SCIP_SOL* sol, /**< solution to enforce */ 2229 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */ 2230 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 2231 ) 2232 { 2233 assert(scip != NULL); 2234 assert(cons != NULL); 2235 assert(!SCIPconsIsAdded(cons)); 2236 assert(sol != NULL); 2237 assert(result != NULL); 2238 2239 SCIP_CALL( SCIPcheckStage(scip, "SCIPenforelaxCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2240 2241 SCIP_CALL( SCIPconsEnforelax(cons, scip->set, sol, solinfeasible, result) ); 2242 2243 return SCIP_OKAY; 2244 } 2245 2246 /** calls LP initialization method for single constraint 2247 * 2248 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2249 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2250 * 2251 * @pre This method can be called if @p scip is in one of the following stages: 2252 * - \ref SCIP_STAGE_SOLVING 2253 * 2254 * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not 2255 * added to SCIP beforehand. 2256 */ 2257 SCIP_RETCODE SCIPinitlpCons( 2258 SCIP* scip, /**< SCIP data structure */ 2259 SCIP_CONS* cons, /**< constraint to initialize */ 2260 SCIP_Bool* infeasible /**< pointer to store whether infeasibility was detected while building the LP */ 2261 ) 2262 { 2263 assert(scip != NULL); 2264 assert(cons != NULL); 2265 assert(!SCIPconsIsAdded(cons)); 2266 2267 SCIP_CALL( SCIPcheckStage(scip, "SCIPinitlpCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2268 2269 SCIP_CALL( SCIPconsInitlp(cons, scip->set, infeasible) ); 2270 2271 return SCIP_OKAY; 2272 } 2273 2274 /** calls separation method of single constraint for LP solution 2275 * 2276 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2277 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2278 * 2279 * @pre This method can be called if @p scip is in one of the following stages: 2280 * - \ref SCIP_STAGE_SOLVING 2281 * 2282 * @note This is an advanced method and should be used with caution. 2283 */ 2284 SCIP_RETCODE SCIPsepalpCons( 2285 SCIP* scip, /**< SCIP data structure */ 2286 SCIP_CONS* cons, /**< constraint to separate */ 2287 SCIP_RESULT* result /**< pointer to store the result of the separation call */ 2288 ) 2289 { 2290 assert(scip != NULL); 2291 assert(cons != NULL); 2292 assert(result != NULL); 2293 2294 SCIP_CALL( SCIPcheckStage(scip, "SCIPsepalpCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2295 2296 SCIP_CALL( SCIPconsSepalp(cons, scip->set, result) ); 2297 2298 return SCIP_OKAY; 2299 } 2300 2301 /** calls separation method of single constraint for given primal solution 2302 * 2303 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2304 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2305 * 2306 * @pre This method can be called if @p scip is in one of the following stages: 2307 * - \ref SCIP_STAGE_SOLVING 2308 * 2309 * @note This is an advanced method and should be used with caution. 2310 */ 2311 SCIP_RETCODE SCIPsepasolCons( 2312 SCIP* scip, /**< SCIP data structure */ 2313 SCIP_CONS* cons, /**< constraint to separate */ 2314 SCIP_SOL* sol, /**< primal solution that should be separated*/ 2315 SCIP_RESULT* result /**< pointer to store the result of the separation call */ 2316 ) 2317 { 2318 assert(scip != NULL); 2319 assert(cons != NULL); 2320 assert(sol != NULL); 2321 assert(result != NULL); 2322 2323 SCIP_CALL( SCIPcheckStage(scip, "SCIPsepasolCons", FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2324 2325 SCIP_CALL( SCIPconsSepasol(cons, scip->set, sol, result) ); 2326 2327 return SCIP_OKAY; 2328 } 2329 2330 /** calls domain propagation method of single constraint 2331 * 2332 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2333 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2334 * 2335 * @pre This method can be called if @p scip is in one of the following stages: 2336 * - \ref SCIP_STAGE_PRESOLVING 2337 * - \ref SCIP_STAGE_SOLVING 2338 * 2339 * @note This is an advanced method and should be used with caution. 2340 */ 2341 SCIP_RETCODE SCIPpropCons( 2342 SCIP* scip, /**< SCIP data structure */ 2343 SCIP_CONS* cons, /**< constraint to propagate */ 2344 SCIP_PROPTIMING proptiming, /**< current point in the node solving loop */ 2345 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 2346 ) 2347 { 2348 assert(scip != NULL); 2349 assert(cons != NULL); 2350 assert(result != NULL); 2351 2352 SCIP_CALL( SCIPcheckStage(scip, "SCIPpropCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2353 2354 SCIP_CALL( SCIPconsProp(cons, scip->set, proptiming, result) ); 2355 2356 return SCIP_OKAY; 2357 } 2358 2359 /** resolves propagation conflict of single constraint 2360 * 2361 * 2362 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2363 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2364 * 2365 * @pre This method can be called if @p scip is in one of the following stages: 2366 * - \ref SCIP_STAGE_PRESOLVING 2367 * - \ref SCIP_STAGE_SOLVING 2368 * 2369 * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not 2370 * added to SCIP beforehand. 2371 */ 2372 SCIP_RETCODE SCIPrespropCons( 2373 SCIP* scip, /**< SCIP data structure */ 2374 SCIP_CONS* cons, /**< constraint to resolve conflict for */ 2375 SCIP_VAR* infervar, /**< the conflict variable whose bound change has to be resolved */ 2376 int inferinfo, /**< the user information passed to the corresponding SCIPinferVarLbCons() or SCIPinferVarUbCons() call */ 2377 SCIP_BOUNDTYPE boundtype, /**< the type of the changed bound (lower or upper bound) */ 2378 SCIP_BDCHGIDX* bdchgidx, /**< the index of the bound change, representing the point of time where the change took place */ 2379 SCIP_Real relaxedbd, /**< the relaxed bound which is sufficient to be explained */ 2380 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 2381 ) 2382 { 2383 assert(scip != NULL); 2384 assert(cons != NULL); 2385 assert(!SCIPconsIsAdded(cons)); 2386 assert(infervar != NULL); 2387 assert(bdchgidx != NULL); 2388 assert(result != NULL); 2389 2390 SCIP_CALL( SCIPcheckStage(scip, "SCIPrespropCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2391 2392 SCIP_CALL( SCIPconsResprop(cons, scip->set, infervar, inferinfo, boundtype, bdchgidx, relaxedbd, result) ); 2393 2394 return SCIP_OKAY; 2395 } 2396 2397 /** presolves of single constraint 2398 * 2399 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2400 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2401 * 2402 * @pre This method can be called if @p scip is in one of the following stages: 2403 * - \ref SCIP_STAGE_PRESOLVING 2404 * 2405 * @note This is an advanced method and should be used with caution. 2406 */ 2407 SCIP_RETCODE SCIPpresolCons( 2408 SCIP* scip, /**< SCIP data structure */ 2409 SCIP_CONS* cons, /**< constraint to presolve */ 2410 int nrounds, /**< number of presolving rounds already done */ 2411 SCIP_PRESOLTIMING presoltiming, /**< presolving timing(s) to be performed */ 2412 int nnewfixedvars, /**< number of variables fixed since the last call to the presolving method */ 2413 int nnewaggrvars, /**< number of variables aggregated since the last call to the presolving method */ 2414 int nnewchgvartypes, /**< number of variable type changes since the last call to the presolving method */ 2415 int nnewchgbds, /**< number of variable bounds tightened since the last call to the presolving method */ 2416 int nnewholes, /**< number of domain holes added since the last call to the presolving method */ 2417 int nnewdelconss, /**< number of deleted constraints since the last call to the presolving method */ 2418 int nnewaddconss, /**< number of added constraints since the last call to the presolving method */ 2419 int nnewupgdconss, /**< number of upgraded constraints since the last call to the presolving method */ 2420 int nnewchgcoefs, /**< number of changed coefficients since the last call to the presolving method */ 2421 int nnewchgsides, /**< number of changed left or right hand sides since the last call to the presolving method */ 2422 int* nfixedvars, /**< pointer to count total number of variables fixed of all presolvers */ 2423 int* naggrvars, /**< pointer to count total number of variables aggregated of all presolvers */ 2424 int* nchgvartypes, /**< pointer to count total number of variable type changes of all presolvers */ 2425 int* nchgbds, /**< pointer to count total number of variable bounds tightened of all presolvers */ 2426 int* naddholes, /**< pointer to count total number of domain holes added of all presolvers */ 2427 int* ndelconss, /**< pointer to count total number of deleted constraints of all presolvers */ 2428 int* naddconss, /**< pointer to count total number of added constraints of all presolvers */ 2429 int* nupgdconss, /**< pointer to count total number of upgraded constraints of all presolvers */ 2430 int* nchgcoefs, /**< pointer to count total number of changed coefficients of all presolvers */ 2431 int* nchgsides, /**< pointer to count total number of changed left/right hand sides of all presolvers */ 2432 SCIP_RESULT* result /**< pointer to store the result of the callback method */ 2433 ) 2434 { 2435 assert(scip != NULL); 2436 assert(cons != NULL); 2437 assert(nfixedvars != NULL); 2438 assert(naggrvars != NULL); 2439 assert(nchgvartypes != NULL); 2440 assert(nchgbds != NULL); 2441 assert(naddholes != NULL); 2442 assert(ndelconss != NULL); 2443 assert(naddconss != NULL); 2444 assert(nupgdconss != NULL); 2445 assert(nchgcoefs != NULL); 2446 assert(nchgsides != NULL); 2447 assert(result != NULL); 2448 2449 SCIP_CALL( SCIPcheckStage(scip, "SCIPpresolCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 2450 2451 SCIP_CALL( SCIPconsPresol(cons, scip->set, nrounds, presoltiming, nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewholes, 2452 nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides, nfixedvars, naggrvars, nchgvartypes, 2453 nchgbds, naddholes, ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides , result) ); 2454 2455 return SCIP_OKAY; 2456 } 2457 2458 /** calls constraint activation notification method of single constraint 2459 * 2460 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2461 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2462 * 2463 * @pre This method can be called if @p scip is in one of the following stages: 2464 * - \ref SCIP_STAGE_TRANSFORMING 2465 * 2466 * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not 2467 * added to SCIP beforehand. 2468 */ 2469 SCIP_RETCODE SCIPactiveCons( 2470 SCIP* scip, /**< SCIP data structure */ 2471 SCIP_CONS* cons /**< constraint to notify */ 2472 ) 2473 { 2474 assert(scip != NULL); 2475 assert(cons != NULL); 2476 assert(!SCIPconsIsAdded(cons)); 2477 assert(!SCIPconsIsDeleted(cons)); 2478 2479 SCIP_CALL( SCIPcheckStage(scip, "SCIPactiveCons", FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE) ); 2480 2481 SCIP_CALL( SCIPconsActive(cons, scip->set) ); 2482 2483 return SCIP_OKAY; 2484 } 2485 2486 /** calls constraint deactivation notification method of single constraint 2487 * 2488 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2489 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2490 * 2491 * @pre This method can be called if @p scip is in one of the following stages: 2492 * - \ref SCIP_STAGE_PRESOLVING 2493 * - \ref SCIP_STAGE_SOLVING 2494 * 2495 * @note This is an advanced method and should be used with caution. It may only be called for constraints that were not 2496 * added to SCIP beforehand. 2497 */ 2498 SCIP_RETCODE SCIPdeactiveCons( 2499 SCIP* scip, /**< SCIP data structure */ 2500 SCIP_CONS* cons /**< constraint to notify */ 2501 ) 2502 { 2503 assert(scip != NULL); 2504 assert(cons != NULL); 2505 assert(!SCIPconsIsAdded(cons)); 2506 2507 SCIP_CALL( SCIPcheckStage(scip, "SCIPdeactiveCons", FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2508 2509 SCIP_CALL( SCIPconsDeactive(cons, scip->set) ); 2510 2511 return SCIP_OKAY; 2512 } 2513 2514 /** outputs constraint information to file stream via the message handler system 2515 * 2516 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2517 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2518 * 2519 * @pre This method can be called if @p scip is in one of the following stages: 2520 * - \ref SCIP_STAGE_PROBLEM 2521 * - \ref SCIP_STAGE_TRANSFORMING 2522 * - \ref SCIP_STAGE_TRANSFORMED 2523 * - \ref SCIP_STAGE_INITPRESOLVE 2524 * - \ref SCIP_STAGE_PRESOLVING 2525 * - \ref SCIP_STAGE_EXITPRESOLVE 2526 * - \ref SCIP_STAGE_PRESOLVED 2527 * - \ref SCIP_STAGE_INITSOLVE 2528 * - \ref SCIP_STAGE_SOLVING 2529 * - \ref SCIP_STAGE_SOLVED 2530 * - \ref SCIP_STAGE_EXITSOLVE 2531 * - \ref SCIP_STAGE_FREETRANS 2532 * 2533 * @note If the message handler is set to a NULL pointer nothing will be printed. 2534 * @note The file stream will not be flushed directly, this can be achieved by calling SCIPinfoMessage() printing a 2535 * newline character. 2536 */ 2537 SCIP_RETCODE SCIPprintCons( 2538 SCIP* scip, /**< SCIP data structure */ 2539 SCIP_CONS* cons, /**< constraint */ 2540 FILE* file /**< output file (or NULL for standard output) */ 2541 ) 2542 { 2543 SCIP_CALL( SCIPcheckStage(scip, "SCIPprintCons", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) ); 2544 2545 SCIP_CALL( SCIPconsPrint(cons, scip->set, scip->messagehdlr, file) ); 2546 2547 return SCIP_OKAY; 2548 } 2549 2550 /** method to collect the variables of a constraint 2551 * 2552 * If the number of variables is greater than the available slots in the variable array, nothing happens except that 2553 * the success point is set to FALSE. With the method SCIPgetConsNVars() it is possible to get the number of variables 2554 * a constraint has in its scope. 2555 * 2556 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2557 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2558 * 2559 * @pre This method can be called if @p scip is in one of the following stages: 2560 * - \ref SCIP_STAGE_PROBLEM 2561 * - \ref SCIP_STAGE_TRANSFORMING 2562 * - \ref SCIP_STAGE_TRANSFORMED 2563 * - \ref SCIP_STAGE_INITPRESOLVE 2564 * - \ref SCIP_STAGE_PRESOLVING 2565 * - \ref SCIP_STAGE_EXITPRESOLVE 2566 * - \ref SCIP_STAGE_PRESOLVED 2567 * - \ref SCIP_STAGE_INITSOLVE 2568 * - \ref SCIP_STAGE_SOLVING 2569 * - \ref SCIP_STAGE_SOLVED 2570 * - \ref SCIP_STAGE_EXITSOLVE 2571 * - \ref SCIP_STAGE_FREETRANS 2572 * 2573 * @note The success pointer indicates if all variables were copied into the vars arrray. 2574 * 2575 * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is 2576 * set to FALSE. 2577 */ 2578 SCIP_RETCODE SCIPgetConsVars( 2579 SCIP* scip, /**< SCIP data structure */ 2580 SCIP_CONS* cons, /**< constraint for which the variables are wanted */ 2581 SCIP_VAR** vars, /**< array to store the involved variable of the constraint */ 2582 int varssize, /**< available slots in vars array which is needed to check if the array is large enough */ 2583 SCIP_Bool* success /**< pointer to store whether the variables are successfully copied */ 2584 ) 2585 { 2586 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetConsVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) ); 2587 2588 assert(scip != NULL); 2589 assert(cons != NULL); 2590 assert(vars != NULL); 2591 assert(success != NULL); 2592 2593 SCIP_CALL( SCIPconsGetVars(cons, scip->set, vars, varssize, success) ); 2594 2595 return SCIP_OKAY; 2596 } 2597 2598 /** method to collect the number of variables of a constraint 2599 * 2600 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2601 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2602 * 2603 * @pre This method can be called if @p scip is in one of the following stages: 2604 * - \ref SCIP_STAGE_PROBLEM 2605 * - \ref SCIP_STAGE_TRANSFORMING 2606 * - \ref SCIP_STAGE_TRANSFORMED 2607 * - \ref SCIP_STAGE_INITPRESOLVE 2608 * - \ref SCIP_STAGE_PRESOLVING 2609 * - \ref SCIP_STAGE_EXITPRESOLVE 2610 * - \ref SCIP_STAGE_PRESOLVED 2611 * - \ref SCIP_STAGE_INITSOLVE 2612 * - \ref SCIP_STAGE_SOLVING 2613 * - \ref SCIP_STAGE_SOLVED 2614 * - \ref SCIP_STAGE_EXITSOLVE 2615 * - \ref SCIP_STAGE_FREETRANS 2616 * 2617 * @note The success pointer indicates if the contraint handler was able to return the number of variables 2618 * 2619 * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is 2620 * set to FALSE 2621 */ 2622 SCIP_RETCODE SCIPgetConsNVars( 2623 SCIP* scip, /**< SCIP data structure */ 2624 SCIP_CONS* cons, /**< constraint for which the number of variables is wanted */ 2625 int* nvars, /**< pointer to store the number of variables */ 2626 SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the number of variables */ 2627 ) 2628 { 2629 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetConsNVars", FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE) ); 2630 2631 assert(scip != NULL); 2632 assert(cons != NULL); 2633 assert(nvars != NULL); 2634 assert(success != NULL); 2635 2636 SCIP_CALL( SCIPconsGetNVars(cons, scip->set, nvars, success) ); 2637 2638 return SCIP_OKAY; 2639 } 2640 2641 /** method to get the permutation symmetry detection graph of a constraint 2642 * 2643 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2644 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2645 * 2646 * @pre This method can be called if SCIP is in one of the following stages: 2647 * - \ref SCIP_STAGE_TRANSFORMED 2648 * - \ref SCIP_STAGE_INITPRESOLVE 2649 * - \ref SCIP_STAGE_PRESOLVING 2650 * - \ref SCIP_STAGE_EXITPRESOLVE 2651 * - \ref SCIP_STAGE_PRESOLVED 2652 * - \ref SCIP_STAGE_INITSOLVE 2653 * - \ref SCIP_STAGE_SOLVING 2654 */ 2655 SCIP_RETCODE SCIPgetConsPermsymGraph( 2656 SCIP* scip, /**< SCIP data structure */ 2657 SCIP_CONS* cons, /**< constraint for which the symmetry graph is requested */ 2658 SYM_GRAPH* graph, /**< symmetry detection graph */ 2659 SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the graph */ 2660 ) 2661 { 2662 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetConsGetPermsymGraph", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2663 2664 assert(scip != NULL); 2665 assert(cons != NULL); 2666 assert(graph != NULL); 2667 assert(success != NULL); 2668 2669 SCIP_CALL( SCIPconsGetPermsymGraph(cons, scip->set, graph, success) ); 2670 2671 return SCIP_OKAY; 2672 } 2673 2674 /** method to get the signed permutation symmetry detection graph of a constraint 2675 * 2676 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref 2677 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes. 2678 * 2679 * @pre This method can be called if SCIP is in one of the following stages: 2680 * - \ref SCIP_STAGE_TRANSFORMED 2681 * - \ref SCIP_STAGE_INITPRESOLVE 2682 * - \ref SCIP_STAGE_PRESOLVING 2683 * - \ref SCIP_STAGE_EXITPRESOLVE 2684 * - \ref SCIP_STAGE_PRESOLVED 2685 * - \ref SCIP_STAGE_INITSOLVE 2686 * - \ref SCIP_STAGE_SOLVING 2687 */ 2688 SCIP_RETCODE SCIPgetConsSignedPermsymGraph( 2689 SCIP* scip, /**< SCIP data structure */ 2690 SCIP_CONS* cons, /**< constraint for which the symmetry graph is requested */ 2691 SYM_GRAPH* graph, /**< symmetry detection graph */ 2692 SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the graph */ 2693 ) 2694 { 2695 SCIP_CALL( SCIPcheckStage(scip, "SCIPgetConsGetSignedPermsymGraph", FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) ); 2696 2697 assert(scip != NULL); 2698 assert(cons != NULL); 2699 assert(graph != NULL); 2700 assert(success != NULL); 2701 2702 SCIP_CALL( SCIPconsGetSignedPermsymGraph(cons, scip->set, graph, success) ); 2703 2704 return SCIP_OKAY; 2705 } 2706