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 pub_cons.h 26 * @ingroup PUBLICCOREAPI 27 * @brief public methods for managing constraints 28 * @author Tobias Achterberg 29 */ 30 31 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/ 32 33 #ifndef __SCIP_PUB_CONS_H__ 34 #define __SCIP_PUB_CONS_H__ 35 36 37 #include "scip/def.h" 38 #include "scip/type_misc.h" 39 #include "scip/type_cons.h" 40 41 #ifdef NDEBUG 42 #include "scip/struct_cons.h" 43 #endif 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /* 50 * Constraint handler methods 51 */ 52 53 /**@addtogroup PublicConshdlrMethods 54 * 55 * @{ 56 */ 57 58 /** compares two constraint handlers w.r.t. their separation priority */ 59 SCIP_EXPORT 60 SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompSepa); 61 62 /** compares two constraint handlers w.r.t. their enforcing priority */ 63 SCIP_EXPORT 64 SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompEnfo); 65 66 /** compares two constraint handlers w.r.t. their feasibility check priority */ 67 SCIP_EXPORT 68 SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompCheck); 69 70 /** compares two constraints w.r.t. their feasibility check priority */ 71 SCIP_EXPORT 72 SCIP_DECL_SORTPTRCOMP(SCIPconsCompCheck); 73 74 /** gets name of constraint handler */ 75 SCIP_EXPORT 76 const char* SCIPconshdlrGetName( 77 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 78 ); 79 80 /** gets description of constraint handler */ 81 SCIP_EXPORT 82 const char* SCIPconshdlrGetDesc( 83 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 84 ); 85 86 /** gets user data of constraint handler */ 87 SCIP_EXPORT 88 SCIP_CONSHDLRDATA* SCIPconshdlrGetData( 89 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 90 ); 91 92 /** sets user data of constraint handler; user has to free old data in advance! */ 93 SCIP_EXPORT 94 void SCIPconshdlrSetData( 95 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 96 SCIP_CONSHDLRDATA* conshdlrdata /**< new constraint handler user data */ 97 ); 98 99 /** sets all separation related callbacks of the constraint handler */ 100 SCIP_EXPORT 101 void SCIPconshdlrSetSepa( 102 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 103 SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */ 104 SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */ 105 int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */ 106 int sepapriority, /**< priority of the constraint handler for separation */ 107 SCIP_Bool delaysepa /**< should separation method be delayed, if other separators found cuts? */ 108 ); 109 110 /** sets both the propagation callback and the propagation frequency of the constraint handler */ 111 SCIP_EXPORT 112 void SCIPconshdlrSetProp( 113 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 114 SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */ 115 int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */ 116 SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */ 117 SCIP_PROPTIMING timingmask /**< positions in the node solving loop where propagators should be executed */ 118 ); 119 120 /** sets the relaxation enforcement method of the constraint handler */ 121 SCIP_EXPORT 122 void SCIPconshdlrSetEnforelax( 123 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 124 SCIP_DECL_CONSENFORELAX ((*consenforelax)) /**< constraint copying method */ 125 ); 126 127 /** gets array with constraints of constraint handler; the first SCIPconshdlrGetNActiveConss() entries are the active 128 * constraints, the last SCIPconshdlrGetNConss() - SCIPconshdlrGetNActiveConss() constraints are deactivated 129 * 130 * @note A constraint is active if it is global and was not removed or it was added locally (in that case the local 131 * flag is TRUE) and the current node belongs to the corresponding sub tree. 132 */ 133 SCIP_EXPORT 134 SCIP_CONS** SCIPconshdlrGetConss( 135 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 136 ); 137 138 /** gets array with enforced constraints of constraint handler; this is local information */ 139 SCIP_EXPORT 140 SCIP_CONS** SCIPconshdlrGetEnfoConss( 141 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 142 ); 143 144 /** gets array with checked constraints of constraint handler; this is local information */ 145 SCIP_EXPORT 146 SCIP_CONS** SCIPconshdlrGetCheckConss( 147 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 148 ); 149 150 /** gets array with delayed update constraints 151 * 152 * @attention Usually, there should be no need to access this array. Use this only if you are absolutely sure what you are doing. 153 */ 154 SCIP_EXPORT 155 SCIP_CONS** SCIPconshdlrGetUpdateConss( 156 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 157 ); 158 159 /** gets total number of existing transformed constraints of constraint handler */ 160 SCIP_EXPORT 161 int SCIPconshdlrGetNConss( 162 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 163 ); 164 165 /** gets number of enforced constraints of constraint handler; this is local information */ 166 SCIP_EXPORT 167 int SCIPconshdlrGetNEnfoConss( 168 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 169 ); 170 171 /** gets number of checked constraints of constraint handler; this is local information */ 172 SCIP_EXPORT 173 int SCIPconshdlrGetNCheckConss( 174 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 175 ); 176 177 /** gets number of active constraints of constraint handler 178 * 179 * @note A constraint is active if it is global and was not removed or it was added locally (in that case the local 180 * flag is TRUE) and the current node belongs to the corresponding sub tree. 181 */ 182 SCIP_EXPORT 183 int SCIPconshdlrGetNActiveConss( 184 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 185 ); 186 187 /** gets number of enabled constraints of constraint handler */ 188 SCIP_EXPORT 189 int SCIPconshdlrGetNEnabledConss( 190 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 191 ); 192 193 /** gets number of constraints that have delayed updates */ 194 SCIP_EXPORT 195 int SCIPconshdlrGetNUpdateConss( 196 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 197 ); 198 199 /** gets time in seconds used for setting up this constraint handler for new stages */ 200 SCIP_EXPORT 201 SCIP_Real SCIPconshdlrGetSetupTime( 202 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 203 ); 204 205 /** gets time in seconds used for presolving in this constraint handler */ 206 SCIP_EXPORT 207 SCIP_Real SCIPconshdlrGetPresolTime( 208 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 209 ); 210 211 /** gets time in seconds used for separation in this constraint handler */ 212 SCIP_EXPORT 213 SCIP_Real SCIPconshdlrGetSepaTime( 214 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 215 ); 216 217 /** gets time in seconds used for LP enforcement in this constraint handler */ 218 SCIP_EXPORT 219 SCIP_Real SCIPconshdlrGetEnfoLPTime( 220 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 221 ); 222 223 /** gets time in seconds used for pseudo enforcement in this constraint handler */ 224 SCIP_EXPORT 225 SCIP_Real SCIPconshdlrGetEnfoPSTime( 226 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 227 ); 228 229 /** gets time in seconds used for relaxation enforcement in this constraint handler */ 230 SCIP_EXPORT 231 SCIP_Real SCIPconshdlrGetEnfoRelaxTime( 232 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 233 ); 234 235 /** gets time in seconds used for propagation in this constraint handler */ 236 SCIP_EXPORT 237 SCIP_Real SCIPconshdlrGetPropTime( 238 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 239 ); 240 241 /** gets time in seconds used for propagation in this constraint handler during strong branching */ 242 SCIP_EXPORT 243 SCIP_Real SCIPconshdlrGetStrongBranchPropTime( 244 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 245 ); 246 247 /** gets time in seconds used for feasibility checking in this constraint handler */ 248 SCIP_EXPORT 249 SCIP_Real SCIPconshdlrGetCheckTime( 250 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 251 ); 252 253 /** gets time in seconds used for resolving propagation in this constraint handler */ 254 SCIP_EXPORT 255 SCIP_Real SCIPconshdlrGetRespropTime( 256 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 257 ); 258 259 /** gets number of calls to the constraint handler's separation method */ 260 SCIP_EXPORT 261 SCIP_Longint SCIPconshdlrGetNSepaCalls( 262 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 263 ); 264 265 /** gets number of calls to the constraint handler's LP enforcing method */ 266 SCIP_EXPORT 267 SCIP_Longint SCIPconshdlrGetNEnfoLPCalls( 268 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 269 ); 270 271 /** gets number of calls to the constraint handler's pseudo enforcing method */ 272 SCIP_EXPORT 273 SCIP_Longint SCIPconshdlrGetNEnfoPSCalls( 274 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 275 ); 276 277 /** gets number of calls to the constraint handler's relaxation enforcing method */ 278 SCIP_EXPORT 279 SCIP_Longint SCIPconshdlrGetNEnfoRelaxCalls( 280 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 281 ); 282 283 /** gets number of calls to the constraint handler's propagation method */ 284 SCIP_EXPORT 285 SCIP_Longint SCIPconshdlrGetNPropCalls( 286 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 287 ); 288 289 /** gets number of calls to the constraint handler's checking method */ 290 SCIP_EXPORT 291 SCIP_Longint SCIPconshdlrGetNCheckCalls( 292 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 293 ); 294 295 /** gets number of calls to the constraint handler's resolve propagation method */ 296 SCIP_EXPORT 297 SCIP_Longint SCIPconshdlrGetNRespropCalls( 298 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 299 ); 300 301 /** gets total number of times, this constraint handler detected a cutoff */ 302 SCIP_EXPORT 303 SCIP_Longint SCIPconshdlrGetNCutoffs( 304 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 305 ); 306 307 /** gets total number of cuts found by this constraint handler */ 308 SCIP_EXPORT 309 SCIP_Longint SCIPconshdlrGetNCutsFound( 310 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 311 ); 312 313 /** gets total number of cuts found by this constraint handler applied to lp */ 314 SCIP_EXPORT 315 SCIP_Longint SCIPconshdlrGetNCutsApplied( 316 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 317 ); 318 319 /** gets total number of additional constraints added by this constraint handler */ 320 SCIP_EXPORT 321 SCIP_Longint SCIPconshdlrGetNConssFound( 322 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 323 ); 324 325 /** gets total number of domain reductions found by this constraint handler */ 326 SCIP_EXPORT 327 SCIP_Longint SCIPconshdlrGetNDomredsFound( 328 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 329 ); 330 331 /** gets number of children created by this constraint handler */ 332 SCIP_EXPORT 333 SCIP_Longint SCIPconshdlrGetNChildren( 334 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 335 ); 336 337 /** gets maximum number of active constraints of constraint handler existing at the same time */ 338 SCIP_EXPORT 339 int SCIPconshdlrGetMaxNActiveConss( 340 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 341 ); 342 343 /** gets initial number of active constraints of constraint handler */ 344 SCIP_EXPORT 345 int SCIPconshdlrGetStartNActiveConss( 346 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 347 ); 348 349 /** gets number of variables fixed in presolving method of constraint handler */ 350 SCIP_EXPORT 351 int SCIPconshdlrGetNFixedVars( 352 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 353 ); 354 355 /** gets number of variables aggregated in presolving method of constraint handler */ 356 SCIP_EXPORT 357 int SCIPconshdlrGetNAggrVars( 358 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 359 ); 360 361 /** gets number of variable types changed in presolving method of constraint handler */ 362 SCIP_EXPORT 363 int SCIPconshdlrGetNChgVarTypes( 364 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 365 ); 366 367 /** gets number of bounds changed in presolving method of constraint handler */ 368 SCIP_EXPORT 369 int SCIPconshdlrGetNChgBds( 370 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 371 ); 372 373 /** gets number of holes added to domains of variables in presolving method of constraint handler */ 374 SCIP_EXPORT 375 int SCIPconshdlrGetNAddHoles( 376 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 377 ); 378 379 /** gets number of constraints deleted in presolving method of constraint handler */ 380 SCIP_EXPORT 381 int SCIPconshdlrGetNDelConss( 382 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 383 ); 384 385 /** gets number of constraints added in presolving method of constraint handler */ 386 SCIP_EXPORT 387 int SCIPconshdlrGetNAddConss( 388 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 389 ); 390 391 /** gets number of constraints upgraded in presolving method of constraint handler */ 392 SCIP_EXPORT 393 int SCIPconshdlrGetNUpgdConss( 394 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 395 ); 396 397 /** gets number of coefficients changed in presolving method of constraint handler */ 398 SCIP_EXPORT 399 int SCIPconshdlrGetNChgCoefs( 400 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 401 ); 402 403 /** gets number of constraint sides changed in presolving method of constraint handler */ 404 SCIP_EXPORT 405 int SCIPconshdlrGetNChgSides( 406 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 407 ); 408 409 /** gets number of times the presolving method of the constraint handler was called and tried to find reductions */ 410 SCIP_EXPORT 411 int SCIPconshdlrGetNPresolCalls( 412 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 413 ); 414 415 /** gets separation priority of constraint handler */ 416 SCIP_EXPORT 417 int SCIPconshdlrGetSepaPriority( 418 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 419 ); 420 421 /** gets enforcing priority of constraint handler */ 422 SCIP_EXPORT 423 int SCIPconshdlrGetEnfoPriority( 424 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 425 ); 426 427 /** gets checking priority of constraint handler */ 428 SCIP_EXPORT 429 int SCIPconshdlrGetCheckPriority( 430 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 431 ); 432 433 /** gets separation frequency of constraint handler */ 434 SCIP_EXPORT 435 int SCIPconshdlrGetSepaFreq( 436 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 437 ); 438 439 /** gets propagation frequency of constraint handler */ 440 SCIP_EXPORT 441 int SCIPconshdlrGetPropFreq( 442 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 443 ); 444 445 /** gets frequency of constraint handler for eager evaluations in separation, propagation and enforcement */ 446 SCIP_EXPORT 447 int SCIPconshdlrGetEagerFreq( 448 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 449 ); 450 451 /** needs constraint handler a constraint to be called? */ 452 SCIP_EXPORT 453 SCIP_Bool SCIPconshdlrNeedsCons( 454 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 455 ); 456 457 /** does the constraint handler perform presolving? */ 458 SCIP_EXPORT 459 SCIP_Bool SCIPconshdlrDoesPresolve( 460 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 461 ); 462 463 /** should separation method be delayed, if other separators found cuts? */ 464 SCIP_EXPORT 465 SCIP_Bool SCIPconshdlrIsSeparationDelayed( 466 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 467 ); 468 469 /** should propagation method be delayed, if other propagators found reductions? */ 470 SCIP_EXPORT 471 SCIP_Bool SCIPconshdlrIsPropagationDelayed( 472 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 473 ); 474 475 /** was LP separation method delayed at the last call? */ 476 SCIP_EXPORT 477 SCIP_Bool SCIPconshdlrWasLPSeparationDelayed( 478 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 479 ); 480 481 /** was primal solution separation method delayed at the last call? */ 482 SCIP_EXPORT 483 SCIP_Bool SCIPconshdlrWasSolSeparationDelayed( 484 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 485 ); 486 487 /** was propagation method delayed at the last call? */ 488 SCIP_EXPORT 489 SCIP_Bool SCIPconshdlrWasPropagationDelayed( 490 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 491 ); 492 493 /** is constraint handler initialized? */ 494 SCIP_EXPORT 495 SCIP_Bool SCIPconshdlrIsInitialized( 496 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 497 ); 498 499 /** does the constraint handler have a copy function? */ 500 SCIP_EXPORT 501 SCIP_Bool SCIPconshdlrIsClonable( 502 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 503 ); 504 505 /** returns the timing mask of the propagation method of the constraint handler */ 506 SCIP_EXPORT 507 SCIP_PROPTIMING SCIPconshdlrGetPropTiming( 508 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 509 ); 510 511 /* 512 * Methods for constraint change sets 513 */ 514 /** gets added constraints data for a constraint set change */ 515 SCIP_EXPORT 516 void SCIPconssetchgGetAddedConsData( 517 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to get data from */ 518 SCIP_CONS*** conss, /**< reference to constraints array added in the conssetchg, or NULL */ 519 int* nconss /**< reference to store the size of the constraints array, or NULL */ 520 ); 521 522 /** sets the timing mask of the propagation method of the constraint handler */ 523 SCIP_EXPORT 524 void SCIPconshdlrSetPropTiming( 525 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 526 SCIP_PROPTIMING proptiming /**< timing mask to be set */ 527 ); 528 529 530 /** returns the timing mask of the presolving method of the constraint handler */ 531 SCIP_EXPORT 532 SCIP_PRESOLTIMING SCIPconshdlrGetPresolTiming( 533 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 534 ); 535 536 /** sets the timing mask of the presolving method of the constraint handler */ 537 SCIP_EXPORT 538 void SCIPconshdlrSetPresolTiming( 539 SCIP_CONSHDLR* conshdlr, /**< constraint handler */ 540 SCIP_PRESOLTIMING presoltiming /** timing mask to be set */ 541 ); 542 543 /** returns whether conshdlr supports permutation symmetry detection */ 544 SCIP_EXPORT 545 SCIP_Bool SCIPconshdlrSupportsPermsymDetection( 546 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 547 ); 548 549 /** returns whether conshdlr supports signed permutation symmetry detection */ 550 SCIP_EXPORT 551 SCIP_Bool SCIPconshdlrSupportsSignedPermsymDetection( 552 SCIP_CONSHDLR* conshdlr /**< constraint handler */ 553 ); 554 555 /** @} */ 556 557 /* 558 * Constraint methods 559 */ 560 561 /**@addtogroup PublicConstraintMethods 562 * 563 * @{ 564 */ 565 566 567 /** returns the name of the constraint 568 * 569 * @note to change the name of a constraint, use SCIPchgConsName() from scip.h 570 */ 571 SCIP_EXPORT 572 const char* SCIPconsGetName( 573 SCIP_CONS* cons /**< constraint */ 574 ); 575 576 /** returns the position of constraint in the corresponding handler's conss array */ 577 SCIP_EXPORT 578 int SCIPconsGetPos( 579 SCIP_CONS* cons /**< constraint */ 580 ); 581 582 /** returns the constraint handler of the constraint */ 583 SCIP_EXPORT 584 SCIP_CONSHDLR* SCIPconsGetHdlr( 585 SCIP_CONS* cons /**< constraint */ 586 ); 587 588 /** returns the constraint data field of the constraint */ 589 SCIP_EXPORT 590 SCIP_CONSDATA* SCIPconsGetData( 591 SCIP_CONS* cons /**< constraint */ 592 ); 593 594 /** gets number of times, the constraint is currently captured */ 595 SCIP_EXPORT 596 int SCIPconsGetNUses( 597 SCIP_CONS* cons /**< constraint */ 598 ); 599 600 /** for an active constraint, returns the depth in the tree at which the constraint was activated */ 601 SCIP_EXPORT 602 int SCIPconsGetActiveDepth( 603 SCIP_CONS* cons /**< constraint */ 604 ); 605 606 /** returns the depth in the tree at which the constraint is valid; returns INT_MAX, if the constraint is local 607 * and currently not active 608 */ 609 SCIP_EXPORT 610 int SCIPconsGetValidDepth( 611 SCIP_CONS* cons /**< constraint */ 612 ); 613 614 /** returns TRUE iff constraint is active in the current node */ 615 SCIP_EXPORT 616 SCIP_Bool SCIPconsIsActive( 617 SCIP_CONS* cons /**< constraint */ 618 ); 619 620 /** returns TRUE iff constraint has to be deactivated in update phase */ 621 SCIP_EXPORT 622 SCIP_Bool SCIPconsIsUpdatedeactivate( 623 SCIP_CONS* cons /**< constraint */ 624 ); 625 626 /** returns TRUE iff constraint is enabled in the current node */ 627 SCIP_EXPORT 628 SCIP_Bool SCIPconsIsEnabled( 629 SCIP_CONS* cons /**< constraint */ 630 ); 631 632 /** returns TRUE iff constraint's separation is enabled in the current node */ 633 SCIP_EXPORT 634 SCIP_Bool SCIPconsIsSeparationEnabled( 635 SCIP_CONS* cons /**< constraint */ 636 ); 637 638 /** returns TRUE iff constraint's propagation is enabled in the current node */ 639 SCIP_EXPORT 640 SCIP_Bool SCIPconsIsPropagationEnabled( 641 SCIP_CONS* cons /**< constraint */ 642 ); 643 644 /** returns TRUE iff constraint is deleted or marked to be deleted */ 645 SCIP_EXPORT 646 SCIP_Bool SCIPconsIsDeleted( 647 SCIP_CONS* cons /**< constraint */ 648 ); 649 650 /** returns TRUE iff constraint is marked obsolete */ 651 SCIP_EXPORT 652 SCIP_Bool SCIPconsIsObsolete( 653 SCIP_CONS* cons /**< constraint */ 654 ); 655 656 /** returns TRUE iff constraint is marked as a conflict */ 657 SCIP_EXPORT 658 SCIP_Bool SCIPconsIsConflict( 659 SCIP_CONS* cons /**< constraint */ 660 ); 661 662 /** gets age of constraint */ 663 SCIP_EXPORT 664 SCIP_Real SCIPconsGetAge( 665 SCIP_CONS* cons /**< constraint */ 666 ); 667 668 /** returns TRUE iff the LP relaxation of constraint should be in the initial LP */ 669 SCIP_EXPORT 670 SCIP_Bool SCIPconsIsInitial( 671 SCIP_CONS* cons /**< constraint */ 672 ); 673 674 /** returns TRUE iff constraint should be separated during LP processing */ 675 SCIP_EXPORT 676 SCIP_Bool SCIPconsIsSeparated( 677 SCIP_CONS* cons /**< constraint */ 678 ); 679 680 /** returns TRUE iff constraint should be enforced during node processing */ 681 SCIP_EXPORT 682 SCIP_Bool SCIPconsIsEnforced( 683 SCIP_CONS* cons /**< constraint */ 684 ); 685 686 /** returns TRUE iff constraint should be checked for feasibility */ 687 SCIP_EXPORT 688 SCIP_Bool SCIPconsIsChecked( 689 SCIP_CONS* cons /**< constraint */ 690 ); 691 692 /** returns whether the constraint is marked for propagation */ 693 SCIP_EXPORT 694 SCIP_Bool SCIPconsIsMarkedPropagate( 695 SCIP_CONS* cons /**< constraint */ 696 ); 697 698 /** returns TRUE iff constraint should be propagated during node processing */ 699 SCIP_EXPORT 700 SCIP_Bool SCIPconsIsPropagated( 701 SCIP_CONS* cons /**< constraint */ 702 ); 703 704 /** returns TRUE iff constraint is globally valid */ 705 SCIP_EXPORT 706 SCIP_Bool SCIPconsIsGlobal( 707 SCIP_CONS* cons /**< constraint */ 708 ); 709 710 /** returns TRUE iff constraint is only locally valid or not added to any (sub)problem */ 711 SCIP_EXPORT 712 SCIP_Bool SCIPconsIsLocal( 713 SCIP_CONS* cons /**< constraint */ 714 ); 715 716 /** returns TRUE iff constraint is modifiable (subject to column generation) */ 717 SCIP_EXPORT 718 SCIP_Bool SCIPconsIsModifiable( 719 SCIP_CONS* cons /**< constraint */ 720 ); 721 722 /** returns TRUE iff constraint is subject to aging */ 723 SCIP_EXPORT 724 SCIP_Bool SCIPconsIsDynamic( 725 SCIP_CONS* cons /**< constraint */ 726 ); 727 728 /** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */ 729 SCIP_EXPORT 730 SCIP_Bool SCIPconsIsRemovable( 731 SCIP_CONS* cons /**< constraint */ 732 ); 733 734 /** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */ 735 SCIP_EXPORT 736 SCIP_Bool SCIPconsIsStickingAtNode( 737 SCIP_CONS* cons /**< constraint */ 738 ); 739 740 /** returns TRUE iff constraint belongs to the global problem */ 741 SCIP_EXPORT 742 SCIP_Bool SCIPconsIsInProb( 743 SCIP_CONS* cons /**< constraint */ 744 ); 745 746 /** returns TRUE iff constraint is belonging to original space */ 747 SCIP_EXPORT 748 SCIP_Bool SCIPconsIsOriginal( 749 SCIP_CONS* cons /**< constraint */ 750 ); 751 752 /** returns TRUE iff constraint is belonging to transformed space */ 753 SCIP_EXPORT 754 SCIP_Bool SCIPconsIsTransformed( 755 SCIP_CONS* cons /**< constraint */ 756 ); 757 758 /** returns TRUE iff roundings for variables in constraint are locked */ 759 SCIP_EXPORT 760 SCIP_Bool SCIPconsIsLockedPos( 761 SCIP_CONS* cons /**< constraint */ 762 ); 763 764 /** returns TRUE iff roundings for variables in constraint's negation are locked */ 765 SCIP_EXPORT 766 SCIP_Bool SCIPconsIsLockedNeg( 767 SCIP_CONS* cons /**< constraint */ 768 ); 769 770 /** returns TRUE iff roundings for variables in constraint or in constraint's negation are locked */ 771 SCIP_EXPORT 772 SCIP_Bool SCIPconsIsLocked( 773 SCIP_CONS* cons /**< constraint */ 774 ); 775 776 /** get number of times the roundings for variables in constraint are locked */ 777 SCIP_EXPORT 778 int SCIPconsGetNLocksPos( 779 SCIP_CONS* cons /**< constraint */ 780 ); 781 782 /** get number of times the roundings for variables in constraint's negation are locked */ 783 SCIP_EXPORT 784 int SCIPconsGetNLocksNeg( 785 SCIP_CONS* cons /**< constraint */ 786 ); 787 788 /** returns TRUE iff roundings of the given locktype for variables in constraint are locked */ 789 SCIP_EXPORT 790 SCIP_Bool SCIPconsIsLockedTypePos( 791 SCIP_CONS* cons, /**< constraint */ 792 SCIP_LOCKTYPE locktype /**< variable lock type */ 793 ); 794 795 /** returns TRUE iff roundings of the given locktype for variables in constraint are locked */ 796 SCIP_EXPORT 797 SCIP_Bool SCIPconsIsLockedTypeNeg( 798 SCIP_CONS* cons, /**< constraint */ 799 SCIP_LOCKTYPE locktype /**< variable lock type */ 800 ); 801 802 /** returns TRUE iff roundings of the given locktype for variables in constraint or in constraint's negation are locked */ 803 SCIP_EXPORT 804 SCIP_Bool SCIPconsIsLockedType( 805 SCIP_CONS* cons, /**< constraint */ 806 SCIP_LOCKTYPE locktype /**< variable lock type */ 807 ); 808 809 /** get number of times the roundings of given locktype for variables in constraint are locked */ 810 SCIP_EXPORT 811 int SCIPconsGetNLocksTypePos( 812 SCIP_CONS* cons, /**< constraint */ 813 SCIP_LOCKTYPE locktype /**< variable lock type */ 814 ); 815 816 /** get number of times the roundings of given locktype for variables in constraint's negation are locked */ 817 SCIP_EXPORT 818 int SCIPconsGetNLocksTypeNeg( 819 SCIP_CONS* cons, /**< constraint */ 820 SCIP_LOCKTYPE locktype /**< variable lock type */ 821 ); 822 823 /** returns if the constraint was already added to a SCIP instance */ 824 SCIP_EXPORT 825 SCIP_Bool SCIPconsIsAdded( 826 SCIP_CONS* cons /**< constraint */ 827 ); 828 829 /** adds locks to (dis-)allow upgrading of constraint */ 830 SCIP_EXPORT 831 void SCIPconsAddUpgradeLocks( 832 SCIP_CONS* cons, /**< constraint to add locks */ 833 int nlocks /**< number of locks to add */ 834 ); 835 836 /** gets number of locks against upgrading the constraint, 0 means this constraint can be upgraded */ 837 SCIP_EXPORT 838 int SCIPconsGetNUpgradeLocks( 839 SCIP_CONS* cons /**< constraint */ 840 ); 841 842 #ifdef NDEBUG 843 844 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and 845 * speed up the algorithms. 846 */ 847 848 #define SCIPconsGetName(cons) (cons)->name 849 #define SCIPconsGetPos(cons) (cons)->consspos 850 #define SCIPconsGetHdlr(cons) (cons)->conshdlr 851 #define SCIPconsGetData(cons) (cons)->consdata 852 #define SCIPconsGetNUses(cons) (cons)->nuses 853 #define SCIPconsGetActiveDepth(cons) (cons)->activedepth 854 #define SCIPconsGetValidDepth(cons) (!(cons)->local ? 0 \ 855 : !SCIPconsIsActive(cons) ? INT_MAX \ 856 : (cons)->validdepth == -1 ? SCIPconsGetActiveDepth(cons) \ 857 : (cons)->validdepth) 858 #define SCIPconsIsActive(cons) ((cons)->updateactivate || ((cons)->active && !(cons)->updatedeactivate)) 859 #define SCIPconsIsEnabled(cons) ((cons)->updateenable || ((cons)->enabled && !(cons)->updatedisable)) 860 #define SCIPconsIsSeparationEnabled(cons) \ 861 (SCIPconsIsEnabled(cons) && ((cons)->updatesepaenable || ((cons)->sepaenabled && !(cons)->updatesepadisable))) 862 #define SCIPconsIsPropagationEnabled(cons) \ 863 (SCIPconsIsEnabled(cons) && ((cons)->updatepropenable || ((cons)->propenabled && !(cons)->updatepropdisable))) 864 #define SCIPconsIsDeleted(cons) ((cons)->deleted) 865 #define SCIPconsIsObsolete(cons) ((cons)->updateobsolete || (cons)->obsolete) 866 #define SCIPconsIsConflict(cons) ((cons)->conflict) 867 #define SCIPconsGetAge(cons) (cons)->age 868 #define SCIPconsIsInitial(cons) (cons)->initial 869 #define SCIPconsIsSeparated(cons) (cons)->separate 870 #define SCIPconsIsEnforced(cons) (cons)->enforce 871 #define SCIPconsIsChecked(cons) (cons)->check 872 #define SCIPconsIsMarkedPropagate(cons) ((cons)->updatemarkpropagate || ((cons)->markpropagate && !(cons)->updateunmarkpropagate)) 873 #define SCIPconsIsPropagated(cons) (cons)->propagate 874 #define SCIPconsIsGlobal(cons) !(cons)->local 875 #define SCIPconsIsLocal(cons) (cons)->local 876 #define SCIPconsIsModifiable(cons) (cons)->modifiable 877 #define SCIPconsIsDynamic(cons) (cons)->dynamic 878 #define SCIPconsIsRemovable(cons) (cons)->removable 879 #define SCIPconsIsStickingAtNode(cons) (cons)->stickingatnode 880 #define SCIPconsIsInProb(cons) ((cons)->addconssetchg == NULL && (cons)->addarraypos >= 0) 881 #define SCIPconsIsOriginal(cons) (cons)->original 882 #define SCIPconsIsTransformed(cons) !(cons)->original 883 #define SCIPconsIsLockedPos(cons) ((cons)->nlockspos[SCIP_LOCKTYPE_MODEL] > 0) 884 #define SCIPconsIsLockedNeg(cons) ((cons)->nlocksneg[SCIP_LOCKTYPE_MODEL] > 0) 885 #define SCIPconsIsLocked(cons) ((cons)->nlockspos[SCIP_LOCKTYPE_MODEL] > 0 || (cons)->nlocksneg[SCIP_LOCKTYPE_MODEL] > 0) 886 #define SCIPconsGetNLocksPos(cons) ((cons)->nlockspos[SCIP_LOCKTYPE_MODEL]) 887 #define SCIPconsGetNLocksNeg(cons) ((cons)->nlocksneg[SCIP_LOCKTYPE_MODEL]) 888 #define SCIPconsIsLockedTypePos(cons, locktype) ((cons)->nlockspos[locktype] > 0) 889 #define SCIPconsIsLockedTypeNeg(cons, locktype) ((cons)->nlocksneg[locktype] > 0) 890 #define SCIPconsIsLockedType(cons, locktype) ((cons)->nlockspos[locktype] > 0 || (cons)->nlocksneg[locktype] > 0) 891 #define SCIPconsGetNLocksTypePos(cons, locktype) ((cons)->nlockspos[locktype]) 892 #define SCIPconsGetNLocksTypeNeg(cons, locktype) ((cons)->nlocksneg[locktype]) 893 #define SCIPconsIsAdded(cons) ((cons)->addarraypos >= 0) 894 #define SCIPconsGetNUpgradeLocks(cons) ((cons)->nupgradelocks) 895 896 #endif 897 898 /** @} */ 899 900 /**@addtogroup PublicProblemMethods 901 * 902 * public methods to query linear constraint classification statistics 903 * 904 * @{ 905 */ 906 907 /** create linear constraint statistics */ 908 SCIP_EXPORT 909 SCIP_RETCODE SCIPlinConsStatsCreate( 910 SCIP* scip, /**< scip data structure */ 911 SCIP_LINCONSSTATS** linconsstats /**< pointer to linear constraint classification statistics */ 912 ); 913 914 /** free linear constraint statistics */ 915 SCIP_EXPORT 916 void SCIPlinConsStatsFree( 917 SCIP* scip, /**< scip data structure */ 918 SCIP_LINCONSSTATS** linconsstats /**< pointer to linear constraint classification statistics */ 919 ); 920 921 /** resets linear constraint statistics */ 922 SCIP_EXPORT 923 void SCIPlinConsStatsReset( 924 SCIP_LINCONSSTATS* linconsstats /**< linear constraint classification statistics */ 925 ); 926 927 /** returns the number of occurrences of a specific type of linear constraint */ 928 SCIP_EXPORT 929 int SCIPlinConsStatsGetTypeCount( 930 SCIP_LINCONSSTATS* linconsstats, /**< linear constraint classification statistics */ 931 SCIP_LINCONSTYPE linconstype /**< linear constraint type */ 932 ); 933 934 /** returns the total number of classified constraints */ 935 SCIP_EXPORT 936 int SCIPlinConsStatsGetSum( 937 SCIP_LINCONSSTATS* linconsstats /**< linear constraint classification statistics */ 938 ); 939 940 /** increases the number of occurrences of a specific type of linear constraint */ 941 SCIP_EXPORT 942 void SCIPlinConsStatsIncTypeCount( 943 SCIP_LINCONSSTATS* linconsstats, /**< linear constraint classification statistics */ 944 SCIP_LINCONSTYPE linconstype, /**< linear constraint type */ 945 int increment /**< positive increment */ 946 ); 947 948 /** print linear constraint classification statistics */ 949 SCIP_EXPORT 950 void SCIPprintLinConsStats( 951 SCIP* scip, /**< scip data structure */ 952 FILE* file, /**< file handle or NULL to print to standard out */ 953 SCIP_LINCONSSTATS* linconsstats /**< linear constraint classification statistics */ 954 ); 955 956 /** @} */ 957 958 #ifdef __cplusplus 959 } 960 #endif 961 962 #endif 963