Scippy

SCIP

Solving Constraint Integer Programs

cons.c
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2025 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file cons.c
26 * @ingroup OTHER_CFILES
27 * @brief methods for constraints and constraint handlers
28 * @author Tobias Achterberg
29 * @author Timo Berthold
30 */
31
32/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33
34#include <assert.h>
35
36#include "scip/def.h"
37#include "scip/set.h"
38#include "scip/stat.h"
39#include "scip/clock.h"
40#include "scip/var.h"
41#include "scip/prob.h"
42#include "scip/tree.h"
43#include "scip/scip.h"
44#include "scip/sepastore.h"
45#include "scip/cons.h"
46#include "scip/branch.h"
47#include "scip/reopt.h"
48#include "scip/pub_misc.h"
49
50#ifndef NDEBUG
51#include "scip/struct_cons.h"
52#endif
53
54
55#define AGERESETAVG_INIT 1000.0 /**< initial value of the exponentially decaying weighted sum for ages */
56#define AGERESETAVG_MIN 100.0 /**< minimal value to use for weighted sum of ages */
57#define AGERESETAVG_DECAY 0.0005 /**< weight of a new addend in the exponentially decyaing sum */
58#define AGERESETAVG_AGELIMIT 2.0 /**< in dynamic setting, a constraint is deleted if its age exceeds the
59 * average reset age by this factor */
60#define AGERESETAVG_OBSOLETEAGE 1.8 /**< in dynamic setting, a constraint is marked obsolete if its age exceeds the
61 * average reset age by this factor */
62
63
64/* #define CHECKCONSARRAYS */
65
66
67/*
68 * dynamic memory arrays
69 */
70
71
72/** resizes conss array to be able to store at least num constraints */
73static
75 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
76 SCIP_SET* set, /**< global SCIP settings */
77 int num /**< minimal number of slots in array */
78 )
79{
80 assert(conshdlr != NULL);
81 assert(set != NULL);
82
83 if( num > conshdlr->consssize )
84 {
85 int newsize;
86
87 newsize = SCIPsetCalcMemGrowSize(set, num);
88 SCIP_ALLOC( BMSreallocMemoryArray(&conshdlr->conss, newsize) );
89 conshdlr->consssize = newsize;
90 }
91 assert(num <= conshdlr->consssize);
92
93 return SCIP_OKAY;
94}
95
96/** resizes initconss array to be able to store at least num constraints */
97static
99 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
100 SCIP_SET* set, /**< global SCIP settings */
101 int num /**< minimal number of slots in array */
102 )
103{
104 assert(conshdlr != NULL);
105 assert(set != NULL);
106
107 if( num > conshdlr->initconsssize )
108 {
109 int newsize;
110
111 newsize = SCIPsetCalcMemGrowSize(set, num);
112 SCIP_ALLOC( BMSreallocMemoryArray(&conshdlr->initconss, newsize) );
113 conshdlr->initconsssize = newsize;
114 }
115 assert(num <= conshdlr->initconsssize);
116
117 return SCIP_OKAY;
118}
119
120/** resizes sepaconss array to be able to store at least num constraints */
121static
123 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
124 SCIP_SET* set, /**< global SCIP settings */
125 int num /**< minimal number of slots in array */
126 )
127{
128 assert(conshdlr != NULL);
129 assert(set != NULL);
130
131 if( num > conshdlr->sepaconsssize )
132 {
133 int newsize;
134
135 newsize = SCIPsetCalcMemGrowSize(set, num);
136 SCIP_ALLOC( BMSreallocMemoryArray(&conshdlr->sepaconss, newsize) );
137 conshdlr->sepaconsssize = newsize;
138 }
139 assert(num <= conshdlr->sepaconsssize);
140
141 return SCIP_OKAY;
142}
143
144/** resizes enfoconss array to be able to store at least num constraints */
145static
147 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
148 SCIP_SET* set, /**< global SCIP settings */
149 int num /**< minimal number of slots in array */
150 )
151{
152 assert(conshdlr != NULL);
153 assert(set != NULL);
154
155 if( num > conshdlr->enfoconsssize )
156 {
157 int newsize;
158
159 newsize = SCIPsetCalcMemGrowSize(set, num);
160 SCIP_ALLOC( BMSreallocMemoryArray(&conshdlr->enfoconss, newsize) );
161 conshdlr->enfoconsssize = newsize;
162 }
163 assert(num <= conshdlr->enfoconsssize);
164
165 return SCIP_OKAY;
166}
167
168/** resizes checkconss array to be able to store at least num constraints */
169static
171 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
172 SCIP_SET* set, /**< global SCIP settings */
173 int num /**< minimal number of slots in array */
174 )
175{
176 assert(conshdlr != NULL);
177 assert(set != NULL);
178
179 if( num > conshdlr->checkconsssize )
180 {
181 int newsize;
182
183 newsize = SCIPsetCalcMemGrowSize(set, num);
184 SCIP_ALLOC( BMSreallocMemoryArray(&conshdlr->checkconss, newsize) );
185 conshdlr->checkconsssize = newsize;
186 }
187 assert(num <= conshdlr->checkconsssize);
188
189 return SCIP_OKAY;
190}
191
192/** resizes propconss array to be able to store at least num constraints */
193static
195 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
196 SCIP_SET* set, /**< global SCIP settings */
197 int num /**< minimal number of slots in array */
198 )
199{
200 assert(conshdlr != NULL);
201 assert(set != NULL);
202
203 if( num > conshdlr->propconsssize )
204 {
205 int newsize;
206
207 newsize = SCIPsetCalcMemGrowSize(set, num);
208 SCIP_ALLOC( BMSreallocMemoryArray(&conshdlr->propconss, newsize) );
209 conshdlr->propconsssize = newsize;
210 }
211 assert(num <= conshdlr->propconsssize);
212
213 return SCIP_OKAY;
214}
215
216/** resizes updateconss array to be able to store at least num constraints */
217static
219 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
220 SCIP_SET* set, /**< global SCIP settings */
221 int num /**< minimal number of slots in array */
222 )
223{
224 assert(conshdlr != NULL);
225 assert(set != NULL);
226
227 if( num > conshdlr->updateconsssize )
228 {
229 int newsize;
230
231 newsize = SCIPsetCalcMemGrowSize(set, num);
232 SCIP_ALLOC( BMSreallocMemoryArray(&conshdlr->updateconss, newsize) );
233 conshdlr->updateconsssize = newsize;
234 }
235 assert(num <= conshdlr->updateconsssize);
236
237 return SCIP_OKAY;
238}
239
240
241
242
243/*
244 * Constraint handler methods
245 */
246
247#define checkConssArrays(conshdlr) /**/
248#ifndef NDEBUG
249#ifdef CHECKCONSARRAYS
250#undef checkConssArrays
251/** sanity check for the constraint arrays of the constraint handler (only in debug mode) */
252static
254 SCIP_CONSHDLR* conshdlr /**< constraint handler */
255 )
256{
257 int c;
258
259 assert(conshdlr != NULL);
260 assert(0 <= conshdlr->nactiveconss && conshdlr->nactiveconss <= conshdlr->nconss);
261
262 for( c = 0; c < conshdlr->nconss; ++c )
263 {
264 assert(conshdlr->conss[c] != NULL);
265 assert(!conshdlr->conss[c]->original);
266 assert(conshdlr->conss[c]->active == (c < conshdlr->nactiveconss));
267 assert(conshdlr->conss[c]->consspos == c);
268 }
269
270 for( c = 0; c < conshdlr->ninitconss; ++c )
271 {
272 assert(conshdlr->initconss[c] != NULL);
273 assert(!conshdlr->initconss[c]->original);
274 assert(c < conshdlr->ninitconsskept || conshdlr->initconss[c]->active);
275 assert(conshdlr->initconss[c]->initial);
276 }
277
278 for( c = 0; c < conshdlr->nsepaconss; ++c )
279 {
280 assert(conshdlr->sepaconss[c] != NULL);
281 assert(!conshdlr->sepaconss[c]->original);
282 assert(conshdlr->sepaconss[c]->active);
283 assert(conshdlr->sepaconss[c]->separate);
284 assert(conshdlr->sepaconss[c]->sepaenabled);
285 assert(conshdlr->sepaconss[c]->obsolete == (c >= conshdlr->nusefulsepaconss));
286 }
287
288 for( c = 0; c < conshdlr->nenfoconss; ++c )
289 {
290 assert(conshdlr->enfoconss[c] != NULL);
291 assert(!conshdlr->enfoconss[c]->original);
292 assert(conshdlr->enfoconss[c]->active);
293 assert(conshdlr->enfoconss[c]->enforce);
294 assert(conshdlr->enfoconss[c]->obsolete == (c >= conshdlr->nusefulenfoconss));
295 }
296
297 for( c = 0; c < conshdlr->ncheckconss; ++c )
298 {
299 assert(conshdlr->checkconss[c] != NULL);
300 assert(!conshdlr->checkconss[c]->original);
301 assert(conshdlr->checkconss[c]->active);
302 assert(conshdlr->checkconss[c]->check);
303 assert(conshdlr->checkconss[c]->obsolete == (c >= conshdlr->nusefulcheckconss));
304 }
305
306 for( c = 0; c < conshdlr->npropconss; ++c )
307 {
308 assert(conshdlr->propconss[c] != NULL);
309 assert(!conshdlr->propconss[c]->original);
310 assert(conshdlr->propconss[c]->active);
311 assert(conshdlr->propconss[c]->propagate);
312 assert(conshdlr->propconss[c]->propenabled);
313 assert(conshdlr->propconss[c]->markpropagate == (c < conshdlr->nmarkedpropconss));
314 assert(conshdlr->propconss[c]->markpropagate || (conshdlr->propconss[c]->obsolete == (c >= conshdlr->nusefulpropconss)));
315 }
316 assert(conshdlr->nmarkedpropconss <= conshdlr->npropconss);
317}
318#endif
319#endif
320
321/** returns whether the constraint updates of the constraint handler are currently delayed */
322static
324 SCIP_CONSHDLR* conshdlr /**< constraint handler */
325 )
326{
327 return (conshdlr->delayupdatecount > 0);
328}
329
330/** returns the exponentially decaying weighted age average for age resets */
331static
333 SCIP_CONSHDLR* conshdlr /**< constraint handler */
334 )
335{
336 assert(conshdlr != NULL);
337
338 return MAX(conshdlr->ageresetavg, AGERESETAVG_MIN);
339}
340
341/** updates the exponentially decaying weighted age average for age resets after a constraint age was reset */
342static
344 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
345 SCIP_Real age /**< age of the constraint that is reset to zero */
346 )
347{
348 assert(conshdlr != NULL);
349
350 conshdlr->ageresetavg *= (1.0-AGERESETAVG_DECAY);
351 conshdlr->ageresetavg += AGERESETAVG_DECAY * age;
352}
353
354/** returns whether the constraint's age exceeds the age limit */
355static
357 SCIP_CONS* cons, /**< constraint to check */
358 SCIP_SET* set /**< global SCIP settings */
359 )
360{
361 assert(cons != NULL);
362 assert(set != NULL);
363
364 return (cons->dynamic
365 && ((set->cons_agelimit > 0 && cons->age > set->cons_agelimit)
366 || (set->cons_agelimit == 0 && cons->age > AGERESETAVG_AGELIMIT * conshdlrGetAgeresetavg(cons->conshdlr))));
367}
368
369/** returns whether the constraint's age exceeds the obsolete age limit */
370static
372 SCIP_CONS* cons, /**< constraint to check */
373 SCIP_SET* set /**< global SCIP settings */
374 )
375{
376 assert(cons != NULL);
377 assert(set != NULL);
378
379 return (cons->dynamic
380 && ((set->cons_obsoleteage > 0 && cons->age > set->cons_obsoleteage)
381 || (set->cons_obsoleteage == 0 && cons->age > AGERESETAVG_OBSOLETEAGE * conshdlrGetAgeresetavg(cons->conshdlr))));
382}
383
384/** marks constraint to be obsolete; it will be moved to the last part of the constraint arrays, such that
385 * it is checked, enforced, separated, and propagated after the useful constraints
386 */
387static
389 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
390 SCIP_CONS* cons /**< constraint to be marked obsolete */
391 )
392{
393 SCIP_CONS* tmpcons;
394
395 assert(conshdlr != NULL);
396 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
397 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
398 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
399 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
400 assert(cons != NULL);
401 assert(!cons->original);
402 assert(!cons->obsolete);
403 assert(!conshdlrAreUpdatesDelayed(conshdlr));
404
405 cons->obsolete = TRUE;
406
407 if( cons->active )
408 {
409 if( cons->check )
410 {
411 assert(0 <= cons->checkconsspos && cons->checkconsspos < conshdlr->nusefulcheckconss);
412
413 /* switch the last useful (non-obsolete) check constraint with this constraint */
414 tmpcons = conshdlr->checkconss[conshdlr->nusefulcheckconss-1];
415 assert(tmpcons->checkconsspos == conshdlr->nusefulcheckconss-1);
416
417 conshdlr->checkconss[conshdlr->nusefulcheckconss-1] = cons;
418 conshdlr->checkconss[cons->checkconsspos] = tmpcons;
419 tmpcons->checkconsspos = cons->checkconsspos;
420 cons->checkconsspos = conshdlr->nusefulcheckconss-1;
421
422 conshdlr->nusefulcheckconss--;
423 }
424 }
425 if( cons->enabled )
426 {
427 if( cons->separate && cons->sepaenabled )
428 {
429 assert(0 <= cons->sepaconsspos && cons->sepaconsspos < conshdlr->nusefulsepaconss);
430
431 if( cons->sepaconsspos < conshdlr->lastnusefulsepaconss )
432 conshdlr->lastnusefulsepaconss--;
433
434 /* switch the last useful (non-obsolete) sepa constraint with this constraint */
435 tmpcons = conshdlr->sepaconss[conshdlr->nusefulsepaconss-1];
436 assert(tmpcons->sepaconsspos == conshdlr->nusefulsepaconss-1);
437
438 conshdlr->sepaconss[conshdlr->nusefulsepaconss-1] = cons;
439 conshdlr->sepaconss[cons->sepaconsspos] = tmpcons;
440 tmpcons->sepaconsspos = cons->sepaconsspos;
441 cons->sepaconsspos = conshdlr->nusefulsepaconss-1;
442
443 conshdlr->nusefulsepaconss--;
444 }
445 if( cons->enforce )
446 {
447 assert(0 <= cons->enfoconsspos && cons->enfoconsspos < conshdlr->nusefulenfoconss);
448
449 if( cons->enfoconsspos < conshdlr->lastnusefulenfoconss )
450 conshdlr->lastnusefulenfoconss--;
451 else
452 {
453 /* the constraint that becomes obsolete is not yet enforced on the current solution:
454 * we have to make sure that it will be enforced the next time; this is not done, if the current
455 * solution was already enforced and only enforcement on the additional constraints is performed
456 * (because in this case, only the new useful constraints are enforced);
457 * thus, we have to reset the enforcement counters in order to enforce all constraints again, especially
458 * the now obsolete one;
459 * this case should occur almost never, because a constraint that was not enforced in the last enforcement
460 * is a newly added one, and it is very unlikely that this constraint will become obsolete before the next
461 * enforcement call;
462 * this reset is not performed for separation and propagation, because they are not vital for correctness
463 */
464 conshdlr->lastenfolplpcount = -1;
465 conshdlr->lastenfolpdomchgcount = -1;
466 conshdlr->lastenfopsdomchgcount = -1;
467 conshdlr->lastenforelaxdomchgcount = -1;
468 conshdlr->lastenforelaxrelaxcount = -1;
469 conshdlr->lastenfolpnode = -1;
470 conshdlr->lastenfopsnode = -1;
471 }
472
473 /* switch the last useful (non-obsolete) enfo constraint with this constraint */
474 tmpcons = conshdlr->enfoconss[conshdlr->nusefulenfoconss-1];
475 assert(tmpcons->enfoconsspos == conshdlr->nusefulenfoconss-1);
476
477 conshdlr->enfoconss[conshdlr->nusefulenfoconss-1] = cons;
478 conshdlr->enfoconss[cons->enfoconsspos] = tmpcons;
479 tmpcons->enfoconsspos = cons->enfoconsspos;
480 cons->enfoconsspos = conshdlr->nusefulenfoconss-1;
481
482 conshdlr->nusefulenfoconss--;
483 }
484 /* in case the constraint is marked to be propagated, we do not move it in the propconss array since the first
485 * part of the array contains all marked constraints independently of their age
486 */
487 assert((!cons->markpropagate) == (cons->propconsspos < conshdlr->nmarkedpropconss));
488 if( cons->propagate && cons->propenabled && !cons->markpropagate )
489 {
490 assert(0 <= cons->propconsspos && cons->propconsspos < conshdlr->nusefulpropconss);
491
492 if( cons->propconsspos < conshdlr->lastnusefulpropconss )
493 conshdlr->lastnusefulpropconss--;
494
495 /* switch the last useful (non-obsolete) prop constraint with this constraint */
496 tmpcons = conshdlr->propconss[conshdlr->nusefulpropconss-1];
497 assert(tmpcons->propconsspos == conshdlr->nusefulpropconss-1);
498
499 conshdlr->propconss[conshdlr->nusefulpropconss-1] = cons;
500 conshdlr->propconss[cons->propconsspos] = tmpcons;
501 tmpcons->propconsspos = cons->propconsspos;
502 cons->propconsspos = conshdlr->nusefulpropconss-1;
503
504 conshdlr->nusefulpropconss--;
505 }
506 }
507
508 checkConssArrays(conshdlr);
509
510 return SCIP_OKAY;
511}
512
513/** marks obsolete constraint to be not obsolete anymore;
514 * it will be moved to the first part of the constraint arrays, such that it is checked, enforced, separated,
515 * and propagated before the obsolete constraints
516 */
517static
519 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
520 SCIP_CONS* cons /**< constraint to be marked obsolete */
521 )
522{
523 SCIP_CONS* tmpcons;
524
525 assert(conshdlr != NULL);
526 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
527 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
528 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
529 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
530 assert(cons != NULL);
531 assert(!cons->original);
532 assert(cons->obsolete);
533 assert(!conshdlrAreUpdatesDelayed(conshdlr));
534
535 cons->obsolete = FALSE;
536
537 if( cons->active )
538 {
539 if( cons->check )
540 {
541 assert(conshdlr->nusefulcheckconss <= cons->checkconsspos && cons->checkconsspos < conshdlr->ncheckconss);
542
543 /* switch the first obsolete check constraint with this constraint */
544 tmpcons = conshdlr->checkconss[conshdlr->nusefulcheckconss];
545 assert(tmpcons->checkconsspos == conshdlr->nusefulcheckconss);
546
547 conshdlr->checkconss[conshdlr->nusefulcheckconss] = cons;
548 conshdlr->checkconss[cons->checkconsspos] = tmpcons;
549 tmpcons->checkconsspos = cons->checkconsspos;
550 cons->checkconsspos = conshdlr->nusefulcheckconss;
551
552 conshdlr->nusefulcheckconss++;
553 }
554 }
555 if( cons->enabled )
556 {
557 if( cons->separate && cons->sepaenabled )
558 {
559 assert(conshdlr->nusefulsepaconss <= cons->sepaconsspos && cons->sepaconsspos < conshdlr->nsepaconss);
560
561 /* switch the first obsolete sepa constraint with this constraint */
562 tmpcons = conshdlr->sepaconss[conshdlr->nusefulsepaconss];
563 assert(tmpcons->sepaconsspos == conshdlr->nusefulsepaconss);
564
565 conshdlr->sepaconss[conshdlr->nusefulsepaconss] = cons;
566 conshdlr->sepaconss[cons->sepaconsspos] = tmpcons;
567 tmpcons->sepaconsspos = cons->sepaconsspos;
568 cons->sepaconsspos = conshdlr->nusefulsepaconss;
569
570 conshdlr->nusefulsepaconss++;
571 }
572 if( cons->enforce )
573 {
574 assert(conshdlr->nusefulenfoconss <= cons->enfoconsspos && cons->enfoconsspos < conshdlr->nenfoconss);
575
576 /* switch the first obsolete enfo constraint with this constraint */
577 tmpcons = conshdlr->enfoconss[conshdlr->nusefulenfoconss];
578 assert(tmpcons->enfoconsspos == conshdlr->nusefulenfoconss);
579
580 conshdlr->enfoconss[conshdlr->nusefulenfoconss] = cons;
581 conshdlr->enfoconss[cons->enfoconsspos] = tmpcons;
582 tmpcons->enfoconsspos = cons->enfoconsspos;
583 cons->enfoconsspos = conshdlr->nusefulenfoconss;
584
585 conshdlr->nusefulenfoconss++;
586 }
587 /* in case the constraint is marked to be propagated, we do not move it in the propconss array since the first
588 * part of the array contains all marked constraints independently of their age
589 */
590 assert((!cons->markpropagate) == (cons->propconsspos < conshdlr->nmarkedpropconss));
591 if( cons->propagate && cons->propenabled && !cons->markpropagate)
592 {
593 assert(conshdlr->nusefulpropconss <= cons->propconsspos && cons->propconsspos < conshdlr->npropconss);
594
595 /* switch the first obsolete prop constraint with this constraint */
596 tmpcons = conshdlr->propconss[conshdlr->nusefulpropconss];
597 assert(tmpcons->propconsspos == conshdlr->nusefulpropconss);
598
599 conshdlr->propconss[conshdlr->nusefulpropconss] = cons;
600 conshdlr->propconss[cons->propconsspos] = tmpcons;
601 tmpcons->propconsspos = cons->propconsspos;
602 cons->propconsspos = conshdlr->nusefulpropconss;
603
604 conshdlr->nusefulpropconss++;
605 }
606 }
607
608 checkConssArrays(conshdlr);
609
610 return SCIP_OKAY;
611}
612
613/** marks constraint to be propagated in the next propagation round;
614 *
615 * @note the propagation array is divided into three parts in contrast to the other constraint arrays;
616 * the first part contains constraints which were marked to be propagated (independently of its age)
617 * the second part contains the useful (non-obsolete) constraints which are not marked to be propagated
618 * finally, the third part contains obsolete constraints which are not marked to be propagated
619 *
620 * @note if a constraint gets marked for propagation we put it into the first part regardless of its age
621 */
622static
624 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
625 SCIP_CONS* cons /**< constraint to be marked obsolete */
626 )
627{
628 SCIP_CONS* tmpcons;
629
630 assert(conshdlr != NULL);
631 assert(conshdlr->nmarkedpropconss <= conshdlr->nusefulpropconss);
632 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
633 assert(cons != NULL);
634 assert(!cons->original);
635
636 /* it may happen that the constraint is deleted while updates are delayed: in this case we just return */
637 if( !cons->enabled )
638 return;
639
640 if( cons->markpropagate )
641 return;
642
643 cons->markpropagate = TRUE;
644
645 /* propagation of the constraint is globally or locally disabled, so we do not have to move the constraint in the
646 * propconss array
647 */
648 if( !cons->propagate || !cons->propenabled )
649 {
650 assert(cons->propconsspos == -1);
651 return;
652 }
653 assert(cons->propconsspos >= conshdlr->nmarkedpropconss);
654
655 /* if the constraint is obsolete, we need to move it first to the non-obsolete part of the array */
656 if( cons->obsolete )
657 {
658 assert(conshdlr->nusefulpropconss <= cons->propconsspos && cons->propconsspos < conshdlr->npropconss);
659
660 /* switch the first obsolete prop constraint with this constraint */
661 tmpcons = conshdlr->propconss[conshdlr->nusefulpropconss];
662 assert(tmpcons->propconsspos == conshdlr->nusefulpropconss);
663
664 conshdlr->propconss[conshdlr->nusefulpropconss] = cons;
665 conshdlr->propconss[cons->propconsspos] = tmpcons;
666 tmpcons->propconsspos = cons->propconsspos;
667 cons->propconsspos = conshdlr->nusefulpropconss;
668
669 conshdlr->nusefulpropconss++;
670 }
671 assert(conshdlr->nmarkedpropconss <= cons->propconsspos && cons->propconsspos < conshdlr->nusefulpropconss);
672
673 /* switch the first useful prop constraint with this constraint */
674 tmpcons = conshdlr->propconss[conshdlr->nmarkedpropconss];
675 assert(tmpcons->propconsspos == conshdlr->nmarkedpropconss);
676
677 conshdlr->propconss[conshdlr->nmarkedpropconss] = cons;
678 conshdlr->propconss[cons->propconsspos] = tmpcons;
679 tmpcons->propconsspos = cons->propconsspos;
680 cons->propconsspos = conshdlr->nmarkedpropconss;
681
682 conshdlr->nmarkedpropconss++;
683 assert(conshdlr->nmarkedpropconss <= conshdlr->npropconss);
684
685 checkConssArrays(conshdlr);
686}
687
688/** unmarks constraint to be propagated in the next propagation round;
689 *
690 * @note the propagation array is divided into three parts in contrast to the other constraint arrays;
691 * the first part contains constraints which were marked to be propagated (independently of its age)
692 * the second part contains the useful (non-obsolete) constraints which are not marked to be propagated
693 * finally, the third part contains obsolete constraints which are not marked to be propagated
694 *
695 * @note if a constraint gets unmarked for propagation, it is put into the right part depending on its age
696 */
697static
699 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
700 SCIP_CONS* cons /**< constraint to be marked obsolete */
701 )
702{
703 SCIP_CONS* tmpcons;
704
705 assert(conshdlr != NULL);
706 assert(conshdlr->nmarkedpropconss <= conshdlr->nusefulpropconss);
707 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
708 assert(cons != NULL);
709 assert(!cons->original);
710
711 /* it may happen that the constraint is deleted while updates are delayed: in this case we just return */
712 if( !cons->enabled )
713 return;
714
715 if( !cons->markpropagate )
716 return;
717
718 cons->markpropagate = FALSE;
719
720 /* propagation of the constraint is globally or locally disabled, so we do not have to move the constraint in the
721 * propconss array
722 */
723 if( !cons->propagate || !cons->propenabled )
724 {
725 assert(cons->propconsspos == -1);
726 return;
727 }
728 assert(cons->propconsspos >= 0);
729 assert(cons->propconsspos < conshdlr->nmarkedpropconss);
730
731 /* first, move the constraint out of the first part to the second part of the constraint array */
732 if( cons->propconsspos < conshdlr->nmarkedpropconss - 1 )
733 {
734 conshdlr->nmarkedpropconss--;
735
736 /* switch the last marked prop constraint with this constraint */
737 tmpcons = conshdlr->propconss[conshdlr->nmarkedpropconss];
738 assert(tmpcons->propconsspos == conshdlr->nmarkedpropconss);
739
740 conshdlr->propconss[conshdlr->nmarkedpropconss] = cons;
741 conshdlr->propconss[cons->propconsspos] = tmpcons;
742 tmpcons->propconsspos = cons->propconsspos;
743 cons->propconsspos = conshdlr->nmarkedpropconss;
744 }
745 else if( cons->propconsspos == conshdlr->nmarkedpropconss - 1 )
746 conshdlr->nmarkedpropconss--;
747 assert(cons->propconsspos == conshdlr->nmarkedpropconss);
748
749 /* if the constraint is obsolete, move it to the last part of the constraint array */
750 if( cons->obsolete )
751 {
752 conshdlr->nusefulpropconss--;
753
754 /* switch the last useful prop constraint with this constraint */
755 tmpcons = conshdlr->propconss[conshdlr->nusefulpropconss];
756 assert(tmpcons->propconsspos == conshdlr->nusefulpropconss);
757
758 conshdlr->propconss[conshdlr->nusefulpropconss] = cons;
759 conshdlr->propconss[cons->propconsspos] = tmpcons;
760 tmpcons->propconsspos = cons->propconsspos;
761 cons->propconsspos = conshdlr->nusefulpropconss;
762 }
763
764 checkConssArrays(conshdlr);
765}
766
767
768/** adds constraint to the conss array of constraint handler */
769static
771 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
772 SCIP_SET* set, /**< global SCIP settings */
773 SCIP_CONS* cons /**< constraint to add */
774 )
775{
776 assert(conshdlr != NULL);
777 assert(cons != NULL);
778 assert(cons->conshdlr == conshdlr);
779 assert(!cons->original);
780 assert(!cons->active);
781 assert(cons->consspos == -1);
782 assert(set != NULL);
783 assert(cons->scip == set->scip);
784
785 /* insert the constraint as inactive constraint into the transformed constraints array */
786 SCIP_CALL( conshdlrEnsureConssMem(conshdlr, set, conshdlr->nconss+1) );
787 conshdlr->conss[conshdlr->nconss] = cons;
788 cons->consspos = conshdlr->nconss;
789 conshdlr->nconss++;
790
791 return SCIP_OKAY;
792}
793
794/** deletes constraint from the conss array of constraint handler */
795static
797 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
798 SCIP_CONS* cons /**< constraint to remove */
799 )
800{
801 assert(conshdlr != NULL);
802 assert(cons != NULL);
803 assert(cons->conshdlr == conshdlr);
804 assert(!cons->original);
805 assert(!cons->active);
806 assert(conshdlr->nactiveconss <= cons->consspos && cons->consspos < conshdlr->nconss);
807
808 conshdlr->conss[cons->consspos] = conshdlr->conss[conshdlr->nconss-1];
809 conshdlr->conss[cons->consspos]->consspos = cons->consspos;
810 conshdlr->nconss--;
811 cons->consspos = -1;
812}
813
814/** adds constraint to the initconss array of constraint handler */
815static
817 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
818 SCIP_SET* set, /**< global SCIP settings */
819 SCIP_STAT* stat, /**< dynamic problem statistics */
820 SCIP_CONS* cons /**< constraint to add */
821 )
822{
823 int insertpos;
824
825 assert(conshdlr != NULL);
826 assert(cons != NULL);
827 assert(cons->conshdlr == conshdlr);
828 assert(!cons->original);
829 assert(cons->active);
830 assert(cons->initial);
831 assert(cons->initconsspos == -1 || cons->initconsspos < conshdlr->ninitconsskept);
832
833 SCIP_CALL( conshdlrEnsureInitconssMem(conshdlr, set, conshdlr->ninitconss+1) );
834
835 insertpos = conshdlr->ninitconss;
836
837 conshdlr->initconss[insertpos] = cons;
838 conshdlr->ninitconss++;
839 stat->ninitconssadded++;
840
841 /* if the constraint is kept, we keep the stored position at the beginning of the array */
842 if( cons->initconsspos == -1 )
843 cons->initconsspos = insertpos;
844
845 checkConssArrays(conshdlr);
846
847 return SCIP_OKAY;
848}
849
850/** deletes constraint from the initconss array of constraint handler */
851static
853 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
854 SCIP_CONS* cons /**< constraint to remove */
855 )
856{
857 int delpos;
858
859 assert(conshdlr != NULL);
860 assert(cons != NULL);
861 assert(cons->conshdlr == conshdlr);
862 assert(!cons->original);
863 assert(0 <= cons->initconsspos && cons->initconsspos < conshdlr->ninitconss);
864
865 delpos = cons->initconsspos;
866 if( delpos < conshdlr->ninitconsskept )
867 {
868 conshdlr->ninitconsskept--;
869 conshdlr->initconss[delpos] = conshdlr->initconss[conshdlr->ninitconsskept];
870 conshdlr->initconss[delpos]->initconsspos = delpos;
871 delpos = conshdlr->ninitconsskept;
872 }
873
874 if( delpos < conshdlr->ninitconss-1 )
875 {
876 conshdlr->initconss[delpos] = conshdlr->initconss[conshdlr->ninitconss-1];
877 conshdlr->initconss[delpos]->initconsspos = delpos;
878 }
879 conshdlr->ninitconss--;
880 cons->initconsspos = -1;
881
882 checkConssArrays(conshdlr);
883}
884
885/** adds constraint to the sepaconss array of constraint handler */
886static
888 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
889 SCIP_SET* set, /**< global SCIP settings */
890 SCIP_CONS* cons /**< constraint to add */
891 )
892{
893 int insertpos;
894
895 assert(conshdlr != NULL);
896 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
897 assert(cons != NULL);
898 assert(cons->conshdlr == conshdlr);
899 assert(!cons->original);
900 assert(cons->active);
901 assert(cons->separate);
902 assert(cons->sepaenabled);
903 assert(cons->sepaconsspos == -1);
904 assert(set != NULL);
905 assert(cons->scip == set->scip);
906 assert(!conshdlrAreUpdatesDelayed(conshdlr) || !conshdlr->duringsepa);
907
908 SCIP_CALL( conshdlrEnsureSepaconssMem(conshdlr, set, conshdlr->nsepaconss+1) );
909 insertpos = conshdlr->nsepaconss;
910 if( !cons->obsolete )
911 {
912 if( conshdlr->nusefulsepaconss < conshdlr->nsepaconss )
913 {
914 conshdlr->sepaconss[conshdlr->nsepaconss] = conshdlr->sepaconss[conshdlr->nusefulsepaconss];
915 conshdlr->sepaconss[conshdlr->nsepaconss]->sepaconsspos = conshdlr->nsepaconss;
916 insertpos = conshdlr->nusefulsepaconss;
917 }
918 conshdlr->nusefulsepaconss++;
919 }
920 conshdlr->sepaconss[insertpos] = cons;
921 cons->sepaconsspos = insertpos;
922 conshdlr->nsepaconss++;
923
924 checkConssArrays(conshdlr);
925
926 return SCIP_OKAY;
927}
928
929/** deletes constraint from the sepaconss array of constraint handler */
930static
932 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
933 SCIP_CONS* cons /**< constraint to remove */
934 )
935{
936 int delpos;
937
938 assert(conshdlr != NULL);
939 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
940 assert(cons != NULL);
941 assert(cons->conshdlr == conshdlr);
942 assert(!cons->original);
943 assert(cons->separate);
944 assert(cons->sepaenabled);
945 assert(cons->sepaconsspos != -1);
946 assert(!conshdlrAreUpdatesDelayed(conshdlr) || !conshdlr->duringsepa);
947
948 delpos = cons->sepaconsspos;
949 if( !cons->obsolete )
950 {
951 assert(0 <= delpos && delpos < conshdlr->nusefulsepaconss);
952
953 if( delpos < conshdlr->lastnusefulsepaconss )
954 conshdlr->lastnusefulsepaconss--;
955
956 conshdlr->sepaconss[delpos] = conshdlr->sepaconss[conshdlr->nusefulsepaconss-1];
957 conshdlr->sepaconss[delpos]->sepaconsspos = delpos;
958 delpos = conshdlr->nusefulsepaconss-1;
959 conshdlr->nusefulsepaconss--;
960 assert(conshdlr->nusefulsepaconss >= 0);
961 assert(conshdlr->lastnusefulsepaconss >= 0);
962 }
963 assert(conshdlr->nusefulsepaconss <= delpos && delpos < conshdlr->nsepaconss);
964 if( delpos < conshdlr->nsepaconss-1 )
965 {
966 conshdlr->sepaconss[delpos] = conshdlr->sepaconss[conshdlr->nsepaconss-1];
967 conshdlr->sepaconss[delpos]->sepaconsspos = delpos;
968 }
969 conshdlr->nsepaconss--;
970 cons->sepaconsspos = -1;
971
972 checkConssArrays(conshdlr);
973}
974
975/** adds constraint to the enfoconss array of constraint handler */
976static
978 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
979 SCIP_SET* set, /**< global SCIP settings */
980 SCIP_CONS* cons /**< constraint to add */
981 )
982{
983 int insertpos;
984
985 assert(conshdlr != NULL);
986 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
987 assert(cons != NULL);
988 assert(cons->conshdlr == conshdlr);
989 assert(!cons->original);
990 assert(cons->active);
991 assert(cons->enforce);
992 assert(cons->enfoconsspos == -1);
993 assert(set != NULL);
994 assert(cons->scip == set->scip);
995
996 SCIP_CALL( conshdlrEnsureEnfoconssMem(conshdlr, set, conshdlr->nenfoconss+1) );
997 insertpos = conshdlr->nenfoconss;
998 if( !cons->obsolete )
999 {
1000 if( conshdlr->nusefulenfoconss < conshdlr->nenfoconss )
1001 {
1002 conshdlr->enfoconss[conshdlr->nenfoconss] = conshdlr->enfoconss[conshdlr->nusefulenfoconss];
1003 conshdlr->enfoconss[conshdlr->nenfoconss]->enfoconsspos = conshdlr->nenfoconss;
1004 insertpos = conshdlr->nusefulenfoconss;
1005 }
1006 conshdlr->nusefulenfoconss++;
1007 }
1008 else
1009 {
1010 /* we have to make sure that even this obsolete constraint is enforced in the next enforcement call;
1011 * if the same LP or pseudo solution is enforced again, only the newly added useful constraints are
1012 * enforced; thus, we have to reset the enforcement counters and force all constraints to be
1013 * enforced again; this is not needed for separation and propagation, because they are not vital for correctness
1014 */
1015 conshdlr->lastenfolplpcount = -1;
1016 conshdlr->lastenfolpdomchgcount = -1;
1017 conshdlr->lastenfopsdomchgcount = -1;
1018 conshdlr->lastenforelaxdomchgcount = -1;
1019 conshdlr->lastenforelaxrelaxcount = -1;
1020 conshdlr->lastenfolpnode = -1;
1021 conshdlr->lastenfopsnode = -1;
1022 }
1023 conshdlr->enfoconss[insertpos] = cons;
1024 cons->enfoconsspos = insertpos;
1025 conshdlr->nenfoconss++;
1026
1027 checkConssArrays(conshdlr);
1028
1029 return SCIP_OKAY;
1030}
1031
1032/** deletes constraint from the enfoconss array of constraint handler */
1033static
1035 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1036 SCIP_CONS* cons /**< constraint to remove */
1037 )
1038{
1039 int delpos;
1040
1041 assert(conshdlr != NULL);
1042 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
1043 assert(cons != NULL);
1044 assert(cons->conshdlr == conshdlr);
1045 assert(!cons->original);
1046 assert(cons->enforce);
1047 assert(cons->enfoconsspos != -1);
1048
1049 delpos = cons->enfoconsspos;
1050 if( !cons->obsolete )
1051 {
1052 assert(0 <= delpos && delpos < conshdlr->nusefulenfoconss);
1053
1054 if( delpos < conshdlr->lastnusefulenfoconss )
1055 conshdlr->lastnusefulenfoconss--;
1056
1057 conshdlr->enfoconss[delpos] = conshdlr->enfoconss[conshdlr->nusefulenfoconss-1];
1058 conshdlr->enfoconss[delpos]->enfoconsspos = delpos;
1059 delpos = conshdlr->nusefulenfoconss-1;
1060 conshdlr->nusefulenfoconss--;
1061
1062 /* if the constraint that moved to the free position was a newly added constraint and not enforced in the last
1063 * enforcement, we have to make sure it will be enforced in the next run;
1064 * this check is not performed for separation and propagation, because they are not vital for correctness
1065 */
1066 if( delpos >= conshdlr->lastnusefulenfoconss )
1067 conshdlr->lastnusefulenfoconss = cons->enfoconsspos;
1068
1069 assert(conshdlr->nusefulenfoconss >= 0);
1070 assert(conshdlr->lastnusefulenfoconss >= 0);
1071 }
1072 assert(conshdlr->nusefulenfoconss <= delpos && delpos < conshdlr->nenfoconss);
1073 if( delpos < conshdlr->nenfoconss-1 )
1074 {
1075 conshdlr->enfoconss[delpos] = conshdlr->enfoconss[conshdlr->nenfoconss-1];
1076 conshdlr->enfoconss[delpos]->enfoconsspos = delpos;
1077 }
1078 conshdlr->nenfoconss--;
1079 cons->enfoconsspos = -1;
1080
1081 checkConssArrays(conshdlr);
1082}
1083
1084/** adds constraint to the checkconss array of constraint handler */
1085static
1087 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1088 SCIP_SET* set, /**< global SCIP settings */
1089 SCIP_CONS* cons /**< constraint to add */
1090 )
1091{
1092 int insertpos;
1093
1094 assert(conshdlr != NULL);
1095 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
1096 assert(cons != NULL);
1097 assert(cons->conshdlr == conshdlr);
1098 assert(!cons->original);
1099 assert(cons->active);
1100 assert(cons->check);
1101 assert(cons->checkconsspos == -1);
1102 assert(set != NULL);
1103 assert(cons->scip == set->scip);
1104
1105 SCIP_CALL( conshdlrEnsureCheckconssMem(conshdlr, set, conshdlr->ncheckconss+1) );
1106 insertpos = conshdlr->ncheckconss;
1107 if( !cons->obsolete )
1108 {
1109 if( conshdlr->nusefulcheckconss < conshdlr->ncheckconss )
1110 {
1111 assert(conshdlr->checkconss[conshdlr->nusefulcheckconss] != NULL);
1112 conshdlr->checkconss[conshdlr->ncheckconss] = conshdlr->checkconss[conshdlr->nusefulcheckconss];
1113 conshdlr->checkconss[conshdlr->ncheckconss]->checkconsspos = conshdlr->ncheckconss;
1114 insertpos = conshdlr->nusefulcheckconss;
1115 }
1116 conshdlr->nusefulcheckconss++;
1117 }
1118 assert(0 <= insertpos && insertpos <= conshdlr->ncheckconss);
1119 conshdlr->checkconss[insertpos] = cons;
1120 cons->checkconsspos = insertpos;
1121 conshdlr->ncheckconss++;
1122
1123 checkConssArrays(conshdlr);
1124
1125 return SCIP_OKAY;
1126}
1127
1128/** deletes constraint from the checkconss array of constraint handler */
1129static
1131 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1132 SCIP_CONS* cons /**< constraint to add */
1133 )
1134{
1135 int delpos;
1136
1137 assert(conshdlr != NULL);
1138 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
1139 assert(cons != NULL);
1140 assert(cons->conshdlr == conshdlr);
1141 assert(!cons->original);
1142 assert(cons->active);
1143 assert(cons->check);
1144 assert(cons->checkconsspos != -1);
1145
1146 delpos = cons->checkconsspos;
1147 if( !cons->obsolete )
1148 {
1149 assert(0 <= delpos && delpos < conshdlr->nusefulcheckconss);
1150 conshdlr->checkconss[delpos] = conshdlr->checkconss[conshdlr->nusefulcheckconss-1];
1151 conshdlr->checkconss[delpos]->checkconsspos = delpos;
1152 delpos = conshdlr->nusefulcheckconss-1;
1153 conshdlr->nusefulcheckconss--;
1154 }
1155 assert(conshdlr->nusefulcheckconss <= delpos && delpos < conshdlr->ncheckconss);
1156 if( delpos < conshdlr->ncheckconss-1 )
1157 {
1158 conshdlr->checkconss[delpos] = conshdlr->checkconss[conshdlr->ncheckconss-1];
1159 conshdlr->checkconss[delpos]->checkconsspos = delpos;
1160 }
1161 conshdlr->ncheckconss--;
1162 cons->checkconsspos = -1;
1163
1164 checkConssArrays(conshdlr);
1165}
1166
1167/** adds constraint to the propconss array of constraint handler */
1168static
1170 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1171 SCIP_SET* set, /**< global SCIP settings */
1172 SCIP_CONS* cons /**< constraint to add */
1173 )
1174{
1175 int insertpos;
1176
1177 assert(conshdlr != NULL);
1178 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1179 assert(cons != NULL);
1180 assert(cons->conshdlr == conshdlr);
1181 assert(!cons->original);
1182 assert(cons->active);
1183 assert(cons->enabled);
1184 assert(cons->propagate);
1185 assert(cons->propenabled);
1186 assert(cons->propconsspos == -1);
1187 assert(set != NULL);
1188 assert(cons->scip == set->scip);
1189 assert(!conshdlrAreUpdatesDelayed(conshdlr) || !conshdlr->duringprop);
1190
1191 /* add constraint to the propagation array */
1192 SCIP_CALL( conshdlrEnsurePropconssMem(conshdlr, set, conshdlr->npropconss+1) );
1193 insertpos = conshdlr->npropconss;
1194 if( !cons->obsolete )
1195 {
1196 if( conshdlr->nusefulpropconss < conshdlr->npropconss )
1197 {
1198 conshdlr->propconss[conshdlr->npropconss] = conshdlr->propconss[conshdlr->nusefulpropconss];
1199 conshdlr->propconss[conshdlr->npropconss]->propconsspos = conshdlr->npropconss;
1200 insertpos = conshdlr->nusefulpropconss;
1201 }
1202 conshdlr->nusefulpropconss++;
1203 }
1204 conshdlr->propconss[insertpos] = cons;
1205 cons->propconsspos = insertpos;
1206 conshdlr->npropconss++;
1207
1208 /* if the constraint is marked to be propagated, we have to move it to the first part of the array */
1209 if( cons->markpropagate )
1210 {
1211 /* temporarily unmark the constraint to be propagated, such that we can use the method below */
1212 cons->markpropagate = FALSE;
1213
1215 assert(cons->markpropagate);
1216 }
1217
1218 checkConssArrays(conshdlr);
1219
1220 return SCIP_OKAY;
1221}
1222
1223/** deletes constraint from the propconss array of constraint handler */
1224static
1226 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1227 SCIP_CONS* cons /**< constraint to remove */
1228 )
1229{
1230 int delpos;
1231
1232 assert(conshdlr != NULL);
1233 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1234 assert(cons != NULL);
1235 assert(cons->conshdlr == conshdlr);
1236 assert(!cons->original);
1237 assert(cons->propagate);
1238 assert(cons->propenabled);
1239 assert(cons->propconsspos != -1);
1240 assert(!conshdlrAreUpdatesDelayed(conshdlr) || !conshdlr->duringprop);
1241
1242 /* unmark constraint to be propagated; this will move the constraint to the obsolete or non-obsolete part of the
1243 * array, depending on its age
1244 */
1245 if( cons->markpropagate )
1246 {
1248 assert(!cons->markpropagate);
1249 }
1250
1251 /* delete constraint from the propagation array */
1252 delpos = cons->propconsspos;
1253 assert(delpos >= conshdlr->nmarkedpropconss);
1254 if( !cons->obsolete )
1255 {
1256 assert(0 <= delpos && delpos < conshdlr->nusefulpropconss);
1257
1258 if( delpos < conshdlr->lastnusefulpropconss )
1259 conshdlr->lastnusefulpropconss--;
1260
1261 conshdlr->propconss[delpos] = conshdlr->propconss[conshdlr->nusefulpropconss-1];
1262 conshdlr->propconss[delpos]->propconsspos = delpos;
1263 delpos = conshdlr->nusefulpropconss-1;
1264 conshdlr->nusefulpropconss--;
1265 assert(conshdlr->nusefulpropconss >= 0);
1266 assert(conshdlr->lastnusefulpropconss >= 0);
1267 }
1268 assert(conshdlr->nusefulpropconss <= delpos && delpos < conshdlr->npropconss);
1269
1270 if( delpos < conshdlr->npropconss-1 )
1271 {
1272 conshdlr->propconss[delpos] = conshdlr->propconss[conshdlr->npropconss-1];
1273 conshdlr->propconss[delpos]->propconsspos = delpos;
1274 }
1275 conshdlr->npropconss--;
1276 cons->propconsspos = -1;
1277 assert(conshdlr->nmarkedpropconss <= conshdlr->npropconss);
1278
1279 checkConssArrays(conshdlr);
1280}
1281
1282/** enables separation of constraint */
1283static
1285 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1286 SCIP_SET* set, /**< global SCIP settings */
1287 SCIP_CONS* cons /**< constraint to add */
1288 )
1289{
1290 assert(conshdlr != NULL);
1291 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
1292 assert(cons != NULL);
1293 assert(cons->conshdlr == conshdlr);
1294 assert(!cons->sepaenabled);
1295 assert(cons->sepaconsspos == -1);
1296 assert(set != NULL);
1297 assert(cons->scip == set->scip);
1298
1299 SCIPsetDebugMsg(set, "enable separation of constraint <%s> in constraint handler <%s>\n", cons->name, conshdlr->name);
1300
1301 /* enable separation of constraint */
1302 cons->sepaenabled = TRUE;
1303
1304 /* add constraint to the separation array */
1305 if( cons->enabled && cons->separate )
1306 {
1307 SCIP_CALL( conshdlrAddSepacons(conshdlr, set, cons) );
1308 }
1309
1310 return SCIP_OKAY;
1311}
1312
1313/** disables separation of constraint */
1314static
1316 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1317 SCIP_CONS* cons /**< constraint to remove */
1318 )
1319{
1320 assert(conshdlr != NULL);
1321 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
1322 assert(cons != NULL);
1323 assert(cons->conshdlr == conshdlr);
1324 assert(cons->sepaenabled);
1325 assert((cons->separate && cons->enabled) == (cons->sepaconsspos != -1));
1326
1327 SCIPdebugMessage("disable separation of constraint <%s> in constraint handler <%s>\n", cons->name, conshdlr->name);
1328
1329 /* delete constraint from the separation array */
1330 if( cons->separate && cons->enabled )
1331 {
1332 conshdlrDelSepacons(conshdlr, cons);
1333 }
1334 assert(cons->sepaconsspos == -1);
1335
1336 /* disable separation of constraint */
1337 cons->sepaenabled = FALSE;
1338
1339 return SCIP_OKAY;
1340}
1341
1342/** enables propagation of constraint */
1343static
1345 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1346 SCIP_SET* set, /**< global SCIP settings */
1347 SCIP_CONS* cons /**< constraint to add */
1348 )
1349{
1350 assert(conshdlr != NULL);
1351 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1352 assert(cons != NULL);
1353 assert(cons->conshdlr == conshdlr);
1354 assert(!cons->propenabled);
1355 assert(cons->propconsspos == -1);
1356 assert(set != NULL);
1357 assert(cons->scip == set->scip);
1358
1359 SCIPsetDebugMsg(set, "enable propagation of constraint <%s> in constraint handler <%s>\n", cons->name, conshdlr->name);
1360
1361 /* enable propagation of constraint */
1362 cons->propenabled = TRUE;
1363
1364 /* add constraint to the propagation array */
1365 if( cons->enabled && cons->propagate )
1366 {
1367 SCIP_CALL( conshdlrAddPropcons(conshdlr, set, cons) );
1368 }
1369
1370 return SCIP_OKAY;
1371}
1372
1373/** disables propagation of constraint */
1374static
1376 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1377 SCIP_CONS* cons /**< constraint to remove */
1378 )
1379{
1380 assert(conshdlr != NULL);
1381 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1382 assert(cons != NULL);
1383 assert(cons->conshdlr == conshdlr);
1384 assert(cons->propenabled);
1385 assert((cons->propagate && cons->enabled) == (cons->propconsspos != -1));
1386
1387 SCIPdebugMessage("disable propagation of constraint <%s> in constraint handler <%s>\n", cons->name, conshdlr->name);
1388
1389 /* delete constraint from the propagation array */
1390 if( cons->propagate && cons->enabled )
1391 {
1392 conshdlrDelPropcons(conshdlr, cons);
1393 }
1394 assert(cons->propconsspos == -1);
1395
1396 /* disable propagation of constraint */
1397 cons->propenabled = FALSE;
1398
1399 return SCIP_OKAY;
1400}
1401
1402/** enables separation, enforcement, and propagation of constraint */
1403static
1405 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1406 SCIP_SET* set, /**< global SCIP settings */
1407 SCIP_STAT* stat, /**< dynamic problem statistics */
1408 SCIP_CONS* cons /**< constraint to add */
1409 )
1410{
1411 assert(conshdlr != NULL);
1412 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
1413 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
1414 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
1415 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1416 assert(set != NULL);
1417 assert(stat != NULL);
1418 assert(cons != NULL);
1419 assert(cons->scip == set->scip);
1420 assert(cons->conshdlr == conshdlr);
1421 assert(!cons->original);
1422 assert(cons->active);
1423 assert(!cons->enabled);
1424 assert(cons->sepaconsspos == -1);
1425 assert(cons->enfoconsspos == -1);
1426 assert(cons->propconsspos == -1);
1427
1428 SCIPsetDebugMsg(set, "enable constraint <%s> in constraint handler <%s>\n", cons->name, conshdlr->name);
1429
1430 /* enable constraint */
1431 cons->enabled = TRUE;
1432 conshdlr->nenabledconss++;
1433 stat->nenabledconss++;
1434
1435 /* add constraint to the separation array */
1436 if( cons->separate && cons->sepaenabled )
1437 {
1438 SCIP_CALL( conshdlrAddSepacons(conshdlr, set, cons) );
1439 }
1440
1441 /* add constraint to the enforcement array */
1442 if( cons->enforce )
1443 {
1444 SCIP_CALL( conshdlrAddEnfocons(conshdlr, set, cons) );
1445 }
1446
1447 /* add constraint to the propagation array */
1448 if( cons->propagate && cons->propenabled )
1449 {
1450 SCIP_CALL( conshdlrAddPropcons(conshdlr, set, cons) );
1451 }
1452
1453 /* call constraint handler's enabling notification method */
1454 if( conshdlr->consenable != NULL )
1455 {
1456 SCIP_CALL( conshdlr->consenable(set->scip, conshdlr, cons) );
1457 }
1458
1459 checkConssArrays(conshdlr);
1460
1461 return SCIP_OKAY;
1462}
1463
1464/** disables separation, enforcement, and propagation of constraint */
1465static
1467 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1468 SCIP_SET* set, /**< global SCIP settings */
1469 SCIP_STAT* stat, /**< dynamic problem statistics */
1470 SCIP_CONS* cons /**< constraint to remove */
1471 )
1472{
1473 assert(conshdlr != NULL);
1474 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
1475 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
1476 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
1477 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1478 assert(set != NULL);
1479 assert(stat != NULL);
1480 assert(cons != NULL);
1481 assert(cons->scip == set->scip);
1482 assert(cons->conshdlr == conshdlr);
1483 assert(!cons->original);
1484 assert(cons->active);
1485 assert(cons->enabled);
1486 assert((cons->separate && cons->sepaenabled) == (cons->sepaconsspos != -1));
1487 assert(cons->enforce == (cons->enfoconsspos != -1));
1488 assert((cons->propagate && cons->propenabled) == (cons->propconsspos != -1));
1489
1490 SCIPsetDebugMsg(set, "disable constraint <%s> in constraint handler <%s>\n", cons->name, conshdlr->name);
1491
1492 /* call constraint handler's disabling notification method */
1493 if( conshdlr->consdisable != NULL )
1494 {
1495 SCIP_CALL( conshdlr->consdisable(set->scip, conshdlr, cons) );
1496 }
1497
1498 /* delete constraint from the separation array */
1499 if( cons->separate && cons->sepaenabled )
1500 {
1501 conshdlrDelSepacons(conshdlr, cons);
1502 }
1503
1504 /* delete constraint from the enforcement array */
1505 if( cons->enforce )
1506 {
1507 conshdlrDelEnfocons(conshdlr, cons);
1508 }
1509
1510 /* delete constraint from the propagation array */
1511 if( cons->propagate && cons->propenabled )
1512 {
1513 conshdlrDelPropcons(conshdlr, cons);
1514 }
1515
1516 assert(cons->sepaconsspos == -1);
1517 assert(cons->enfoconsspos == -1);
1518 assert(cons->propconsspos == -1);
1519
1520 /* disable constraint */
1521 cons->enabled = FALSE;
1522 conshdlr->nenabledconss--;
1523 stat->nenabledconss--;
1524
1525 checkConssArrays(conshdlr);
1526
1527 return SCIP_OKAY;
1528}
1529
1530/** activates and adds constraint to constraint handler's constraint arrays */
1531static
1533 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1534 SCIP_SET* set, /**< global SCIP settings */
1535 SCIP_STAT* stat, /**< dynamic problem statistics */
1536 SCIP_CONS* cons, /**< constraint to add */
1537 int depth, /**< depth in the tree where the activation takes place, or -1 for global problem */
1538 SCIP_Bool focusnode /**< does the constraint activation take place at the focus node? */
1539 )
1540{
1541 assert(conshdlr != NULL);
1542 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
1543 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
1544 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
1545 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1546 assert(set != NULL);
1547 assert(stat != NULL);
1548 assert(cons != NULL);
1549 assert(cons->scip == set->scip);
1550 assert(cons->conshdlr == conshdlr);
1551 assert(!cons->original);
1552 assert(!cons->active);
1553 assert(!cons->enabled);
1554 assert(conshdlr->nactiveconss <= cons->consspos && cons->consspos < conshdlr->nconss);
1555 assert(conshdlr->conss[cons->consspos] == cons);
1556 assert(cons->initconsspos < conshdlr->ninitconsskept);
1557 assert(cons->sepaconsspos == -1);
1558 assert(cons->enfoconsspos == -1);
1559 assert(cons->checkconsspos == -1);
1560 assert(cons->propconsspos == -1);
1561 assert(depth >= -1);
1562
1563 SCIPsetDebugMsg(set, "activate constraint <%s> in constraint handler <%s> (depth %d, focus=%u)\n",
1564 cons->name, conshdlr->name, depth, focusnode);
1565
1566 /* activate constraint, switch positions with first inactive constraint */
1567 cons->active = TRUE;
1568 cons->activedepth = depth;
1569 conshdlr->conss[cons->consspos] = conshdlr->conss[conshdlr->nactiveconss];
1570 conshdlr->conss[cons->consspos]->consspos = cons->consspos;
1571 conshdlr->conss[conshdlr->nactiveconss] = cons;
1572 cons->consspos = conshdlr->nactiveconss;
1573 conshdlr->nactiveconss++;
1574 conshdlr->maxnactiveconss = MAX(conshdlr->maxnactiveconss, conshdlr->nactiveconss);
1575 stat->nactiveconss++;
1576
1577 /* add constraint to the check array */
1578 if( cons->check )
1579 {
1580 SCIP_CALL( conshdlrAddCheckcons(conshdlr, set, cons) );
1581 }
1582
1583 /* add constraint to the initconss array if the constraint is initial and added to the focus node */
1584 if( cons->initial )
1585 {
1586 SCIP_CALL( conshdlrAddInitcons(conshdlr, set, stat, cons) );
1587 }
1588
1589 /* call constraint handler's activation notification method */
1590 if( conshdlr->consactive != NULL )
1591 {
1592 SCIP_CALL( conshdlr->consactive(set->scip, conshdlr, cons) );
1593 }
1594
1595 /* enable separation, enforcement, and propagation of constraint */
1596 SCIP_CALL( conshdlrEnableCons(conshdlr, set, stat, cons) );
1597
1598 assert(0 <= cons->consspos && cons->consspos < conshdlr->nactiveconss);
1599
1600 checkConssArrays(conshdlr);
1601
1602 return SCIP_OKAY;
1603}
1604
1605/** deactivates and removes constraint from constraint handler's conss array */
1606static
1608 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1609 SCIP_SET* set, /**< global SCIP settings */
1610 SCIP_STAT* stat, /**< dynamic problem statistics */
1611 SCIP_CONS* cons /**< constraint to remove */
1612 )
1613{
1614 assert(conshdlr != NULL);
1615 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
1616 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
1617 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
1618 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1619 assert(set != NULL);
1620 assert(stat != NULL);
1621 assert(cons != NULL);
1622 assert(cons->scip == set->scip);
1623 assert(cons->conshdlr == conshdlr);
1624 assert(!cons->original);
1625 assert(cons->active);
1626 assert(0 <= cons->consspos && cons->consspos < conshdlr->nactiveconss);
1627 assert(conshdlr->conss[cons->consspos] == cons);
1628 assert(cons->check == (cons->checkconsspos != -1));
1629
1630 SCIPsetDebugMsg(set, "deactivate constraint <%s> in constraint handler <%s>\n", cons->name, conshdlr->name);
1631
1632 /* disable constraint */
1633 if( cons->enabled )
1634 {
1635 SCIP_CALL( conshdlrDisableCons(conshdlr, set, stat, cons) );
1636 }
1637 assert(!cons->enabled);
1638
1639 /* call constraint handler's deactivation notification method */
1640 if( conshdlr->consdeactive != NULL )
1641 {
1642 SCIP_CALL( conshdlr->consdeactive(set->scip, conshdlr, cons) );
1643 }
1644
1645 /* delete constraint from the initconss array */
1646 if( cons->initconsspos >= 0 )
1647 {
1648 conshdlrDelInitcons(conshdlr, cons);
1649 }
1650
1651 /* delete constraint from the check array */
1652 if( cons->check )
1653 {
1654 conshdlrDelCheckcons(conshdlr, cons);
1655 }
1656
1657 /* switch constraint with the last active constraint in the conss array */
1658 conshdlr->conss[cons->consspos] = conshdlr->conss[conshdlr->nactiveconss-1];
1659 conshdlr->conss[cons->consspos]->consspos = cons->consspos;
1660 conshdlr->conss[conshdlr->nactiveconss-1] = cons;
1661 cons->consspos = conshdlr->nactiveconss-1;
1662 conshdlr->nactiveconss--;
1663 cons->active = FALSE;
1664 cons->activedepth = -2;
1665 stat->nactiveconss--;
1666
1667 assert(conshdlr->nactiveconss <= cons->consspos && cons->consspos < conshdlr->nconss);
1668 assert(cons->initconsspos == -1);
1669 assert(cons->sepaconsspos == -1);
1670 assert(cons->enfoconsspos == -1);
1671 assert(cons->checkconsspos == -1);
1672 assert(cons->propconsspos == -1);
1673
1674 checkConssArrays(conshdlr);
1675
1676 return SCIP_OKAY;
1677}
1678
1679/** processes all delayed updates of constraints:
1680 * recently (de)activated constraints will be (de)activated;
1681 * recently en/disabled constraints will be en/disabled;
1682 * recent obsolete non-check constraints will be globally deleted;
1683 * recent obsolete check constraints will be moved to the last positions in the sepa-, enfo-, check-, and prop-arrays;
1684 * recent useful constraints will be moved to the first positions in the sepa-, enfo-, check-, and prop-arrays;
1685 * constraints which were recently marked to be propagated are moved to the first positions in the prop-array;
1686 * no longer used constraints will be freed and removed from the conss array
1687 */
1688static
1690 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1691 BMS_BLKMEM* blkmem, /**< block memory */
1692 SCIP_SET* set, /**< global SCIP settings */
1693 SCIP_STAT* stat /**< dynamic problem statistics */
1694 )
1695{
1696 SCIP_CONS* cons;
1697 int i;
1698
1699 assert(conshdlr != NULL);
1700 assert(!conshdlrAreUpdatesDelayed(conshdlr));
1701 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
1702 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
1703 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
1704 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
1705
1706 SCIPsetDebugMsg(set, "processing %d constraints that have to be updated in constraint handler <%s>\n",
1707 conshdlr->nupdateconss, conshdlr->name);
1708
1709 for( i = conshdlr->nupdateconss - 1; i >= 0; --i )
1710 {
1711 cons = conshdlr->updateconss[i];
1712 assert(cons != NULL);
1713 assert(cons->conshdlr == conshdlr);
1714 assert(cons->update);
1715 assert(cons->updateinsert || cons->updateactivate || cons->updatedeactivate
1716 || cons->updateenable || cons->updatedisable
1717 || cons->updatesepaenable || cons->updatesepadisable
1718 || cons->updatepropenable || cons->updatepropdisable
1719 || cons->updateobsolete || cons->updatefree
1720 || cons->updatemarkpropagate || cons->updateunmarkpropagate);
1721
1722 SCIPsetDebugMsg(set, " -> constraint <%s>: insert=%u, activate=%u, deactivate=%u, enable=%u, disable=%u, sepaenable=%u, sepadisable=%u, propenable=%u, propdisable=%u, obsolete=%u, free=%u (consdata=%p)\n",
1723 cons->name, cons->updateinsert, cons->updateactivate, cons->updatedeactivate,
1724 cons->updateenable, cons->updatedisable,
1727 cons->updateobsolete, cons->updatefree, (void*)cons->consdata);
1728
1729 if( cons->updateinsert )
1730 {
1731 SCIP_CALL( conshdlrAddCons(conshdlr, set, cons) );
1732 cons->updateinsert = FALSE;
1733 }
1734
1735 if( cons->updateactivate )
1736 {
1737 assert(!cons->active);
1738 assert(!cons->updatedeactivate);
1739 assert(!cons->updateenable);
1740 assert(!cons->updatedisable);
1741 assert(!cons->updateobsolete);
1742 assert(!cons->updatefree);
1743
1744 /* the activation depth was already stored in SCIPconsActivate() */
1745 SCIP_CALL( conshdlrActivateCons(conshdlr, set, stat, cons, cons->activedepth, cons->updateactfocus) );
1746 assert(cons->active);
1747 cons->updateactivate = FALSE;
1748 }
1749 else if( cons->updatedeactivate )
1750 {
1751 assert(cons->active);
1752
1753 SCIP_CALL( conshdlrDeactivateCons(conshdlr, set, stat, cons) );
1754 assert(!cons->active);
1755 cons->updatedeactivate = FALSE;
1756 cons->updateenable = FALSE;
1757 cons->updatedisable = FALSE;
1758 cons->obsolete = consExceedsObsoleteage(cons, set);
1759 cons->updateobsolete = FALSE;
1760 }
1761 else if( cons->updateenable )
1762 {
1763 assert(!cons->enabled);
1764 assert(!cons->updatedisable);
1765
1766 SCIP_CALL( conshdlrEnableCons(conshdlr, set, stat, cons) );
1767 assert(cons->enabled);
1768 cons->updateenable = FALSE;
1769 }
1770 else if( cons->updatedisable )
1771 {
1772 assert(cons->enabled);
1773
1774 SCIP_CALL( conshdlrDisableCons(conshdlr, set, stat, cons) );
1775 assert(!cons->enabled);
1776 cons->updatedisable = FALSE;
1777 }
1778
1779 if( cons->updatesepaenable )
1780 {
1781 assert(!cons->updatesepadisable);
1782 if( !cons->sepaenabled )
1783 {
1784 SCIP_CALL( conshdlrEnableConsSeparation(conshdlr, set, cons) );
1785 assert(cons->sepaenabled);
1786 }
1787 cons->updatesepaenable = FALSE;
1788 }
1789 else if( cons->updatesepadisable )
1790 {
1791 if( cons->sepaenabled )
1792 {
1793 SCIP_CALL( conshdlrDisableConsSeparation(conshdlr, cons) );
1794 assert(!cons->sepaenabled);
1795 }
1796 cons->updatesepadisable = FALSE;
1797 }
1798
1799 if( cons->updatepropenable )
1800 {
1801 assert(!cons->updatepropdisable);
1802 if( !cons->propenabled )
1803 {
1804 SCIP_CALL( conshdlrEnableConsPropagation(conshdlr, set, cons) );
1805 assert(cons->propenabled);
1806 }
1807 cons->updatepropenable = FALSE;
1808 }
1809 else if( cons->updatepropdisable )
1810 {
1811 if( cons->propenabled )
1812 {
1813 SCIP_CALL( conshdlrDisableConsPropagation(conshdlr, cons) );
1814 assert(!cons->propenabled);
1815 }
1816 cons->updatepropdisable = FALSE;
1817 }
1818
1819 if( cons->updatefree )
1820 {
1821 /* nothing to do here: the constraint is freed, when it is released from the updateconss array */
1822 assert(cons->nuses == 1); /* it only exists in the updateconss array */
1823 cons->updatefree = FALSE;
1824 cons->updateobsolete = FALSE;
1825 }
1826 else
1827 {
1828 if( cons->updateobsolete )
1829 {
1830 if( !cons->obsolete && consExceedsObsoleteage(cons, set) )
1831 {
1832 /* the constraint's status must be switched to obsolete */
1833 SCIP_CALL( conshdlrMarkConsObsolete(conshdlr, cons) );
1834 }
1835 else if( cons->obsolete && !consExceedsObsoleteage(cons, set) )
1836 {
1837 /* the constraint's status must be switched to useful */
1838 SCIP_CALL( conshdlrMarkConsUseful(conshdlr, cons) );
1839 }
1840 cons->updateobsolete = FALSE;
1841 }
1842
1843 if( cons->updatemarkpropagate )
1844 {
1845 /* the constraint must be marked to be propagated */
1846 conshdlrMarkConsPropagate(conshdlr, cons);
1847 cons->updatemarkpropagate = FALSE;
1848 }
1849 else if( cons->updateunmarkpropagate )
1850 {
1851 /* the constraint must be unmarked to be propagated */
1852 conshdlrUnmarkConsPropagate(conshdlr, cons);
1854 }
1855 }
1856
1857 assert(!cons->updateinsert);
1858 assert(!cons->updateactivate);
1859 assert(!cons->updatedeactivate);
1860 assert(!cons->updateenable);
1861 assert(!cons->updatedisable);
1862 assert(!cons->updatesepaenable);
1863 assert(!cons->updatesepadisable);
1864 assert(!cons->updatepropenable);
1865 assert(!cons->updatepropdisable);
1866 assert(!cons->updateobsolete);
1867 assert(!cons->updatemarkpropagate);
1868 assert(!cons->updateunmarkpropagate);
1869 assert(!cons->updatefree);
1870 cons->update = FALSE;
1871
1872 /* release the constraint */
1873 SCIP_CALL( SCIPconsRelease(&conshdlr->updateconss[i], blkmem, set) );
1874 }
1875
1876 conshdlr->nupdateconss = 0;
1877
1878 return SCIP_OKAY;
1879}
1880
1881/** marks constraint handler to delay all constraint updates until the next conshdlrProcessUpdates() call */
1882static
1884 SCIP_CONSHDLR* conshdlr /**< constraint handler */
1885 )
1886{
1887 assert(conshdlr != NULL);
1888
1889 SCIPdebugMessage("constraint updates of constraint handler <%s> will be delayed (count:%d)\n",
1890 conshdlr->name, conshdlr->delayupdatecount+1);
1891
1892 conshdlr->delayupdatecount++;
1893}
1894
1895/** marks constraint handler to perform all constraint updates immediately;
1896 * all delayed constraint updates will be processed
1897 */
1898static
1900 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1901 BMS_BLKMEM* blkmem, /**< block memory */
1902 SCIP_SET* set, /**< global SCIP settings */
1903 SCIP_STAT* stat /**< dynamic problem statistics */
1904 )
1905{
1906 assert(conshdlr != NULL);
1907 assert(conshdlrAreUpdatesDelayed(conshdlr));
1908
1909 SCIPsetDebugMsg(set, "constraint updates of constraint handler <%s> will be processed immediately (count:%d)\n",
1910 conshdlr->name, conshdlr->delayupdatecount);
1911 conshdlr->delayupdatecount--;
1912
1913 /* only run the update if all delays are taken away (reference counting) */
1914 if( !conshdlrAreUpdatesDelayed(conshdlr) )
1915 {
1916 SCIP_CALL( conshdlrProcessUpdates(conshdlr, blkmem, set, stat) );
1917 assert(conshdlr->nupdateconss == 0);
1918 }
1919
1920 return SCIP_OKAY;
1921}
1922
1923/** adds constraint to constraint handler's update constraint array and captures it */
1924static
1926 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1927 SCIP_SET* set, /**< global SCIP settings */
1928 SCIP_CONS* cons /**< constraint to add */
1929 )
1930{
1931 assert(conshdlr != NULL);
1932 assert(set != NULL);
1933 assert(cons != NULL);
1934 assert(cons->conshdlr == conshdlr);
1935
1936 if( !cons->update )
1937 {
1938 SCIPsetDebugMsg(set, "constraint <%s> of age %g has to be updated in constraint handler <%s> (consdata=%p)\n",
1939 cons->name, cons->age, conshdlr->name, (void*)cons->consdata);
1940
1941 /* add constraint to the updateconss array */
1942 SCIP_CALL( conshdlrEnsureUpdateconssMem(conshdlr, set, conshdlr->nupdateconss+1) );
1943 conshdlr->updateconss[conshdlr->nupdateconss] = cons;
1944 conshdlr->nupdateconss++;
1945
1946 /* capture constraint */
1947 SCIPconsCapture(cons);
1948
1949 cons->update = TRUE;
1950 }
1951
1952 return SCIP_OKAY;
1953}
1954
1955/** compares two constraint handlers w.r.t. their separation priority */
1956SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompSepa)
1957{ /*lint --e{715}*/
1958 return ((SCIP_CONSHDLR*)elem2)->sepapriority - ((SCIP_CONSHDLR*)elem1)->sepapriority;
1959}
1960
1961/** compares two constraint handlers w.r.t. their enforcing priority */
1962SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompEnfo)
1963{ /*lint --e{715}*/
1964 return ((SCIP_CONSHDLR*)elem2)->enfopriority - ((SCIP_CONSHDLR*)elem1)->enfopriority;
1965}
1966
1967/** compares two constraint handlers w.r.t. their feasibility check priority */
1968SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompCheck)
1969{ /*lint --e{715}*/
1970 return ((SCIP_CONSHDLR*)elem2)->checkpriority - ((SCIP_CONSHDLR*)elem1)->checkpriority;
1971}
1972
1973/** compares two constraints w.r.t. their feasibility check priority */
1974SCIP_DECL_SORTPTRCOMP(SCIPconsCompCheck)
1975{ /*lint --e{715}*/
1976 return ((SCIP_CONS*)elem2)->conshdlr->checkpriority - ((SCIP_CONS*)elem1)->conshdlr->checkpriority;
1977}
1978
1979/** copies the given constraint handler to a new scip */
1981 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
1982 SCIP_SET* set, /**< SCIP_SET of SCIP to copy to */
1983 SCIP_Bool* valid /**< was the copying process valid? */
1984 )
1985{
1986 assert(conshdlr != NULL);
1987 assert(set != NULL);
1988 assert(valid != NULL);
1989 assert(set->scip != NULL);
1990
1991 if( conshdlr->conshdlrcopy != NULL )
1992 {
1993 SCIPsetDebugMsg(set, "including constraint handler %s in subscip %p\n", SCIPconshdlrGetName(conshdlr), (void*)set->scip);
1994 SCIP_CALL( conshdlr->conshdlrcopy(set->scip, conshdlr, valid) );
1995 }
1996
1997 return SCIP_OKAY;
1998}
1999
2000/** internal method for creating a constraint handler */
2001static
2003 SCIP_CONSHDLR** conshdlr, /**< pointer to constraint handler data structure */
2004 SCIP_SET* set, /**< global SCIP settings */
2005 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2006 BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
2007 const char* name, /**< name of constraint handler */
2008 const char* desc, /**< description of constraint handler */
2009 int sepapriority, /**< priority of the constraint handler for separation */
2010 int enfopriority, /**< priority of the constraint handler for constraint enforcing */
2011 int checkpriority, /**< priority of the constraint handler for checking feasibility (and propagation) */
2012 int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */
2013 int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */
2014 int eagerfreq, /**< frequency for using all instead of only the useful constraints in separation,
2015 * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
2016 int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */
2017 SCIP_Bool delaysepa, /**< should separation method be delayed, if other separators found cuts? */
2018 SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */
2019 SCIP_Bool needscons, /**< should the constraint handler be skipped, if no constraints are available? */
2020 SCIP_PROPTIMING proptiming, /**< positions in the node solving loop where propagation method of constraint handlers should be executed */
2021 SCIP_PRESOLTIMING presoltiming, /**< timing mask of the constraint handler's presolving method */
2022 SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */
2023 SCIP_DECL_CONSFREE ((*consfree)), /**< destructor of constraint handler */
2024 SCIP_DECL_CONSINIT ((*consinit)), /**< initialize constraint handler */
2025 SCIP_DECL_CONSEXIT ((*consexit)), /**< deinitialize constraint handler */
2026 SCIP_DECL_CONSINITPRE ((*consinitpre)), /**< presolving initialization method of constraint handler */
2027 SCIP_DECL_CONSEXITPRE ((*consexitpre)), /**< presolving deinitialization method of constraint handler */
2028 SCIP_DECL_CONSINITSOL ((*consinitsol)), /**< solving process initialization method of constraint handler */
2029 SCIP_DECL_CONSEXITSOL ((*consexitsol)), /**< solving process deinitialization method of constraint handler */
2030 SCIP_DECL_CONSDELETE ((*consdelete)), /**< free specific constraint data */
2031 SCIP_DECL_CONSTRANS ((*constrans)), /**< transform constraint data into data belonging to the transformed problem */
2032 SCIP_DECL_CONSINITLP ((*consinitlp)), /**< initialize LP with relaxations of "initial" constraints */
2033 SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */
2034 SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */
2035 SCIP_DECL_CONSENFOLP ((*consenfolp)), /**< enforcing constraints for LP solutions */
2036 SCIP_DECL_CONSENFORELAX ((*consenforelax)), /**< enforcing constraints for relaxation solutions */
2037 SCIP_DECL_CONSENFOPS ((*consenfops)), /**< enforcing constraints for pseudo solutions */
2038 SCIP_DECL_CONSCHECK ((*conscheck)), /**< check feasibility of primal solution */
2039 SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */
2040 SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method */
2041 SCIP_DECL_CONSRESPROP ((*consresprop)), /**< propagation conflict resolving method */
2042 SCIP_DECL_CONSLOCK ((*conslock)), /**< variable rounding lock method */
2043 SCIP_DECL_CONSACTIVE ((*consactive)), /**< activation notification method */
2044 SCIP_DECL_CONSDEACTIVE((*consdeactive)), /**< deactivation notification method */
2045 SCIP_DECL_CONSENABLE ((*consenable)), /**< enabling notification method */
2046 SCIP_DECL_CONSDISABLE ((*consdisable)), /**< disabling notification method */
2047 SCIP_DECL_CONSDELVARS ((*consdelvars)), /**< variable deletion method */
2048 SCIP_DECL_CONSPRINT ((*consprint)), /**< constraint display method */
2049 SCIP_DECL_CONSCOPY ((*conscopy)), /**< constraint copying method */
2050 SCIP_DECL_CONSPARSE ((*consparse)), /**< constraint parsing method */
2051 SCIP_DECL_CONSGETVARS ((*consgetvars)), /**< constraint get variables method */
2052 SCIP_DECL_CONSGETNVARS((*consgetnvars)), /**< constraint get number of variable method */
2053 SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)), /**< constraint handler diving solution enforcement method */
2054 SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)), /**< constraint permutation symmetry detection graph
2055 * getter method */
2056 SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)), /**< constraint signed permutation
2057 * symmetry detection graph getter method */
2058 SCIP_CONSHDLRDATA* conshdlrdata /**< constraint handler data */
2059 )
2060{
2062 char paramdesc[SCIP_MAXSTRLEN];
2063
2064 assert(conshdlr != NULL);
2065 assert(name != NULL);
2066 assert(desc != NULL);
2067 assert(conssepalp != NULL || conssepasol != NULL || sepafreq == -1);
2068 assert(consprop != NULL || propfreq == -1);
2069 assert(eagerfreq >= -1);
2070 assert(!needscons || ((conshdlrcopy == NULL) == (conscopy == NULL)));
2071
2072 /* the interface change from delay flags to timings cannot be recognized at compile time: Exit with an appropriate
2073 * error message
2074 */
2075 if( presoltiming < SCIP_PRESOLTIMING_NONE || presoltiming > SCIP_PRESOLTIMING_MAX )
2076 {
2077 SCIPmessagePrintError("ERROR: 'PRESOLDELAY'-flag no longer available since SCIP 3.2, use an appropriate "
2078 "'SCIP_PRESOLTIMING' for <%s> constraint handler instead.\n", name);
2079
2081 }
2082
2083 /* both callbacks have to exist or not exist */
2084 assert((consgetvars != NULL) == (consgetnvars != NULL));
2085
2086 SCIP_ALLOC( BMSallocMemory(conshdlr) );
2087 BMSclearMemory(*conshdlr);
2088
2089 SCIP_ALLOC( BMSduplicateMemoryArray(&(*conshdlr)->name, name, strlen(name)+1) );
2090 SCIP_ALLOC( BMSduplicateMemoryArray(&(*conshdlr)->desc, desc, strlen(desc)+1) );
2091 (*conshdlr)->sepapriority = sepapriority;
2092 (*conshdlr)->enfopriority = enfopriority;
2093 (*conshdlr)->checkpriority = checkpriority;
2094 (*conshdlr)->sepafreq = sepafreq;
2095 (*conshdlr)->propfreq = propfreq;
2096 (*conshdlr)->eagerfreq = eagerfreq;
2097 (*conshdlr)->maxprerounds = maxprerounds;
2098 (*conshdlr)->conshdlrcopy = conshdlrcopy;
2099 (*conshdlr)->consfree = consfree;
2100 (*conshdlr)->consinit = consinit;
2101 (*conshdlr)->consexit = consexit;
2102 (*conshdlr)->consinitpre = consinitpre;
2103 (*conshdlr)->consexitpre = consexitpre;
2104 (*conshdlr)->consinitsol = consinitsol;
2105 (*conshdlr)->consexitsol = consexitsol;
2106 (*conshdlr)->consdelete = consdelete;
2107 (*conshdlr)->constrans = constrans;
2108 (*conshdlr)->consinitlp = consinitlp;
2109 (*conshdlr)->conssepalp = conssepalp;
2110 (*conshdlr)->conssepasol = conssepasol;
2111 (*conshdlr)->consenfolp = consenfolp;
2112 (*conshdlr)->consenforelax = consenforelax;
2113 (*conshdlr)->consenfops = consenfops;
2114 (*conshdlr)->conscheck = conscheck;
2115 (*conshdlr)->consprop = consprop;
2116 (*conshdlr)->conspresol = conspresol;
2117 (*conshdlr)->consresprop = consresprop;
2118 (*conshdlr)->conslock = conslock;
2119 (*conshdlr)->consactive = consactive;
2120 (*conshdlr)->consdeactive = consdeactive;
2121 (*conshdlr)->consenable = consenable;
2122 (*conshdlr)->consdisable = consdisable;
2123 (*conshdlr)->consprint = consprint;
2124 (*conshdlr)->consdelvars = consdelvars;
2125 (*conshdlr)->conscopy = conscopy;
2126 (*conshdlr)->consparse = consparse;
2127 (*conshdlr)->consgetvars = consgetvars;
2128 (*conshdlr)->consgetnvars = consgetnvars;
2129 (*conshdlr)->conshdlrdata = conshdlrdata;
2130 (*conshdlr)->consgetdivebdchgs = consgetdivebdchgs;
2131 (*conshdlr)->consgetpermsymgraph = consgetpermsymgraph;
2132 (*conshdlr)->consgetsignedpermsymgraph = consgetsignedpermsymgraph;
2133 (*conshdlr)->conss = NULL;
2134 (*conshdlr)->consssize = 0;
2135 (*conshdlr)->nconss = 0;
2136 (*conshdlr)->nactiveconss = 0;
2137 (*conshdlr)->maxnactiveconss = 0;
2138 (*conshdlr)->startnactiveconss = 0;
2139 (*conshdlr)->initconss = NULL;
2140 (*conshdlr)->initconsssize = 0;
2141 (*conshdlr)->ninitconss = 0;
2142 (*conshdlr)->ninitconsskept = 0;
2143 (*conshdlr)->sepaconss = NULL;
2144 (*conshdlr)->sepaconsssize = 0;
2145 (*conshdlr)->nsepaconss = 0;
2146 (*conshdlr)->nusefulsepaconss = 0;
2147 (*conshdlr)->enfoconss = NULL;
2148 (*conshdlr)->enfoconsssize = 0;
2149 (*conshdlr)->nenfoconss = 0;
2150 (*conshdlr)->nusefulenfoconss = 0;
2151 (*conshdlr)->checkconss = NULL;
2152 (*conshdlr)->checkconsssize = 0;
2153 (*conshdlr)->ncheckconss = 0;
2154 (*conshdlr)->nusefulcheckconss = 0;
2155 (*conshdlr)->propconss = NULL;
2156 (*conshdlr)->propconsssize = 0;
2157 (*conshdlr)->npropconss = 0;
2158 (*conshdlr)->nusefulpropconss = 0;
2159 (*conshdlr)->nmarkedpropconss = 0;
2160 (*conshdlr)->updateconss = NULL;
2161 (*conshdlr)->updateconsssize = 0;
2162 (*conshdlr)->nupdateconss = 0;
2163 (*conshdlr)->nenabledconss = 0;
2164 (*conshdlr)->lastnusefulpropconss = 0;
2165 (*conshdlr)->lastnusefulsepaconss = 0;
2166 (*conshdlr)->lastnusefulenfoconss = 0;
2167
2168 (*conshdlr)->storedpropconss = NULL;
2169 (*conshdlr)->storedpropconsssize = 0;
2170 (*conshdlr)->storednmarkedpropconss = 0;
2171 (*conshdlr)->storedpropdomchgcount = 0;
2172
2173 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->setuptime, SCIP_CLOCKTYPE_DEFAULT) );
2174 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->presoltime, SCIP_CLOCKTYPE_DEFAULT) );
2175 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->sepatime, SCIP_CLOCKTYPE_DEFAULT) );
2176 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->enfolptime, SCIP_CLOCKTYPE_DEFAULT) );
2177 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->enfopstime, SCIP_CLOCKTYPE_DEFAULT) );
2178 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->enforelaxtime, SCIP_CLOCKTYPE_DEFAULT) );
2179 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->proptime, SCIP_CLOCKTYPE_DEFAULT) );
2180 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->sbproptime, SCIP_CLOCKTYPE_DEFAULT) );
2181 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->checktime, SCIP_CLOCKTYPE_DEFAULT) );
2182 SCIP_CALL( SCIPclockCreate(&(*conshdlr)->resproptime, SCIP_CLOCKTYPE_DEFAULT) );
2183
2184 (*conshdlr)->nsepacalls = 0;
2185 (*conshdlr)->nenfolpcalls = 0;
2186 (*conshdlr)->nenfopscalls = 0;
2187 (*conshdlr)->nenforelaxcalls = 0;
2188 (*conshdlr)->npropcalls = 0;
2189 (*conshdlr)->ncheckcalls = 0;
2190 (*conshdlr)->nrespropcalls = 0;
2191 (*conshdlr)->ncutoffs = 0;
2192 (*conshdlr)->ncutsfound = 0;
2193 (*conshdlr)->ncutsapplied = 0;
2194 (*conshdlr)->nconssfound = 0;
2195 (*conshdlr)->ndomredsfound = 0;
2196 (*conshdlr)->nchildren = 0;
2197 (*conshdlr)->lastpropdomchgcount = -1;
2198 (*conshdlr)->lastsepalpcount = -1;
2199 (*conshdlr)->lastenfolplpcount = -1;
2200 (*conshdlr)->lastenfolpdomchgcount = -1;
2201 (*conshdlr)->lastenfopsdomchgcount = -1;
2202 (*conshdlr)->lastenforelaxdomchgcount = -1;
2203 (*conshdlr)->lastenforelaxrelaxcount = -1;
2204 (*conshdlr)->lastenfolpnode = -1;
2205 (*conshdlr)->lastenfopsnode = -1;
2206 (*conshdlr)->lastenfolpresult = SCIP_DIDNOTRUN;
2207 (*conshdlr)->lastenfopsresult = SCIP_DIDNOTRUN;
2208 (*conshdlr)->lastenforelaxresult = SCIP_DIDNOTRUN;
2209 (*conshdlr)->lastnfixedvars = 0;
2210 (*conshdlr)->lastnaggrvars = 0;
2211 (*conshdlr)->lastnchgvartypes = 0;
2212 (*conshdlr)->lastnchgbds = 0;
2213 (*conshdlr)->lastnaddholes = 0;
2214 (*conshdlr)->lastndelconss = 0;
2215 (*conshdlr)->lastnaddconss = 0;
2216 (*conshdlr)->lastnupgdconss = 0;
2217 (*conshdlr)->lastnchgcoefs = 0;
2218 (*conshdlr)->lastnchgsides = 0;
2219 (*conshdlr)->nfixedvars = 0;
2220 (*conshdlr)->naggrvars = 0;
2221 (*conshdlr)->nchgvartypes = 0;
2222 (*conshdlr)->nchgbds = 0;
2223 (*conshdlr)->naddholes = 0;
2224 (*conshdlr)->ndelconss = 0;
2225 (*conshdlr)->naddconss = 0;
2226 (*conshdlr)->nupgdconss = 0;
2227 (*conshdlr)->nchgcoefs = 0;
2228 (*conshdlr)->nchgsides = 0;
2229 (*conshdlr)->npresolcalls = 0;
2230 (*conshdlr)->delayupdatecount = 0;
2231 (*conshdlr)->ageresetavg = AGERESETAVG_INIT;
2232 (*conshdlr)->needscons = needscons;
2233 (*conshdlr)->sepalpwasdelayed = FALSE;
2234 (*conshdlr)->sepasolwasdelayed = FALSE;
2235 (*conshdlr)->propwasdelayed = FALSE;
2236 (*conshdlr)->duringsepa = FALSE;
2237 (*conshdlr)->duringprop = FALSE;
2238 (*conshdlr)->exact = FALSE;
2239 (*conshdlr)->initialized = FALSE;
2240
2241 /* add parameters */
2242 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/sepafreq", name);
2243 SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname,
2244 "frequency for separating cuts (-1: never, 0: only in root node)",
2245 &(*conshdlr)->sepafreq, FALSE, sepafreq, -1, SCIP_MAXTREEDEPTH, NULL, NULL) );
2246
2247 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/propfreq", name);
2248 SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname,
2249 "frequency for propagating domains (-1: never, 0: only in root node)",
2250 &(*conshdlr)->propfreq, FALSE, propfreq, -1, SCIP_MAXTREEDEPTH, NULL, NULL) );
2251
2252 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/proptiming", name);
2253 (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "timing when constraint propagation should be called (%u:BEFORELP, %u:DURINGLPLOOP, %u:AFTERLPLOOP, %u:ALWAYS)", SCIP_PROPTIMING_BEFORELP, SCIP_PROPTIMING_DURINGLPLOOP, SCIP_PROPTIMING_AFTERLPLOOP, SCIP_PROPTIMING_ALWAYS);
2254 SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
2255 (int*)(&(*conshdlr)->proptiming), TRUE, (int) proptiming, (int) SCIP_PROPTIMING_BEFORELP, (int) SCIP_PROPTIMING_ALWAYS, NULL, NULL) ); /*lint !e713*/
2256
2257 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/eagerfreq", name);
2258 SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname,
2259 "frequency for using all instead of only the useful constraints in separation, propagation and enforcement (-1: never, 0: only in first evaluation)",
2260 &(*conshdlr)->eagerfreq, TRUE, eagerfreq, -1, SCIP_MAXTREEDEPTH, NULL, NULL) );
2261
2262 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/maxprerounds", name);
2263 SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname,
2264 "maximal number of presolving rounds the constraint handler participates in (-1: no limit)",
2265 &(*conshdlr)->maxprerounds, TRUE, maxprerounds, -1, INT_MAX, NULL, NULL) );
2266
2267 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/delaysepa", name);
2268 SCIP_CALL( SCIPsetAddBoolParam(set, messagehdlr, blkmem, paramname,
2269 "should separation method be delayed, if other separators found cuts?",
2270 &(*conshdlr)->delaysepa, TRUE, delaysepa, NULL, NULL) ); /*lint !e740*/
2271
2272 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/delayprop", name);
2273 SCIP_CALL( SCIPsetAddBoolParam(set, messagehdlr, blkmem, paramname,
2274 "should propagation method be delayed, if other propagators found reductions?",
2275 &(*conshdlr)->delayprop, TRUE, delayprop, NULL, NULL) ); /*lint !e740*/
2276
2277 (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "constraints/%s/presoltiming", name);
2278 (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "timing mask of the constraint handler's presolving method (%u:FAST, %u:MEDIUM, %u:EXHAUSTIVE, %u:FINAL)",
2280 SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
2281 (int*)&(*conshdlr)->presoltiming, TRUE, (int) presoltiming, (int) SCIP_PRESOLTIMING_FAST, (int) SCIP_PRESOLTIMING_MAX, NULL, NULL) ); /*lint !e740 !e713*/
2282
2283 return SCIP_OKAY;
2284}
2285
2286/** creates a constraint handler */
2288 SCIP_CONSHDLR** conshdlr, /**< pointer to constraint handler data structure */
2289 SCIP_SET* set, /**< global SCIP settings */
2290 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
2291 BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
2292 const char* name, /**< name of constraint handler */
2293 const char* desc, /**< description of constraint handler */
2294 int sepapriority, /**< priority of the constraint handler for separation */
2295 int enfopriority, /**< priority of the constraint handler for constraint enforcing */
2296 int checkpriority, /**< priority of the constraint handler for checking feasibility (and propagation) */
2297 int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */
2298 int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */
2299 int eagerfreq, /**< frequency for using all instead of only the useful constraints in separation,
2300 * propagation and enforcement, -1 for no eager evaluations, 0 for first only */
2301 int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */
2302 SCIP_Bool delaysepa, /**< should separation method be delayed, if other separators found cuts? */
2303 SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */
2304 SCIP_Bool needscons, /**< should the constraint handler be skipped, if no constraints are available? */
2305 SCIP_PROPTIMING proptiming, /**< positions in the node solving loop where propagation method of constraint handlers should be executed */
2306 SCIP_PRESOLTIMING presoltiming, /**< timing mask of the constraint handler's presolving method */
2307 SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */
2308 SCIP_DECL_CONSFREE ((*consfree)), /**< destructor of constraint handler */
2309 SCIP_DECL_CONSINIT ((*consinit)), /**< initialize constraint handler */
2310 SCIP_DECL_CONSEXIT ((*consexit)), /**< deinitialize constraint handler */
2311 SCIP_DECL_CONSINITPRE ((*consinitpre)), /**< presolving initialization method of constraint handler */
2312 SCIP_DECL_CONSEXITPRE ((*consexitpre)), /**< presolving deinitialization method of constraint handler */
2313 SCIP_DECL_CONSINITSOL ((*consinitsol)), /**< solving process initialization method of constraint handler */
2314 SCIP_DECL_CONSEXITSOL ((*consexitsol)), /**< solving process deinitialization method of constraint handler */
2315 SCIP_DECL_CONSDELETE ((*consdelete)), /**< free specific constraint data */
2316 SCIP_DECL_CONSTRANS ((*constrans)), /**< transform constraint data into data belonging to the transformed problem */
2317 SCIP_DECL_CONSINITLP ((*consinitlp)), /**< initialize LP with relaxations of "initial" constraints */
2318 SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */
2319 SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */
2320 SCIP_DECL_CONSENFOLP ((*consenfolp)), /**< enforcing constraints for LP solutions */
2321 SCIP_DECL_CONSENFORELAX ((*consenforelax)), /**< enforcing constraints for relaxation solutions */
2322 SCIP_DECL_CONSENFOPS ((*consenfops)), /**< enforcing constraints for pseudo solutions */
2323 SCIP_DECL_CONSCHECK ((*conscheck)), /**< check feasibility of primal solution */
2324 SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */
2325 SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method */
2326 SCIP_DECL_CONSRESPROP ((*consresprop)), /**< propagation conflict resolving method */
2327 SCIP_DECL_CONSLOCK ((*conslock)), /**< variable rounding lock method */
2328 SCIP_DECL_CONSACTIVE ((*consactive)), /**< activation notification method */
2329 SCIP_DECL_CONSDEACTIVE((*consdeactive)), /**< deactivation notification method */
2330 SCIP_DECL_CONSENABLE ((*consenable)), /**< enabling notification method */
2331 SCIP_DECL_CONSDISABLE ((*consdisable)), /**< disabling notification method */
2332 SCIP_DECL_CONSDELVARS ((*consdelvars)), /**< variable deletion method */
2333 SCIP_DECL_CONSPRINT ((*consprint)), /**< constraint display method */
2334 SCIP_DECL_CONSCOPY ((*conscopy)), /**< constraint copying method */
2335 SCIP_DECL_CONSPARSE ((*consparse)), /**< constraint parsing method */
2336 SCIP_DECL_CONSGETVARS ((*consgetvars)), /**< constraint get variables method */
2337 SCIP_DECL_CONSGETNVARS((*consgetnvars)), /**< constraint get number of variable method */
2338 SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)), /**< constraint handler diving solution enforcement method */
2339 SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)), /**< constraint permutation symmetry detection graph
2340 * getter method */
2341 SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)), /**< constraint signed permutation symmetry
2342 * detection graph getter method */
2343 SCIP_CONSHDLRDATA* conshdlrdata /**< constraint handler data */
2344 )
2345{
2346 assert(conshdlr != NULL);
2347 assert(name != NULL);
2348 assert(desc != NULL);
2349 assert(conssepalp != NULL || conssepasol != NULL || sepafreq == -1);
2350 assert(consprop != NULL || propfreq == -1);
2351 assert(eagerfreq >= -1);
2352 assert(!needscons || ((conshdlrcopy == NULL) == (conscopy == NULL)));
2353
2354 SCIP_CALL_FINALLY( doConshdlrCreate(conshdlr, set, messagehdlr, blkmem, name, desc, sepapriority, enfopriority,
2355 checkpriority, sepafreq, propfreq, eagerfreq, maxprerounds, delaysepa, delayprop, needscons, proptiming,
2356 presoltiming, conshdlrcopy, consfree, consinit, consexit, consinitpre, consexitpre, consinitsol, consexitsol,
2357 consdelete, constrans, consinitlp, conssepalp, conssepasol, consenfolp, consenforelax, consenfops, conscheck,
2358 consprop, conspresol, consresprop, conslock, consactive, consdeactive, consenable, consdisable, consdelvars,
2359 consprint, conscopy, consparse, consgetvars, consgetnvars, consgetdivebdchgs, consgetpermsymgraph,
2360 consgetsignedpermsymgraph, conshdlrdata),
2361 (void) SCIPconshdlrFree(conshdlr, set) );
2362
2363 return SCIP_OKAY;
2364} /*lint !e715*/
2365
2366/** calls destructor and frees memory of constraint handler */
2368 SCIP_CONSHDLR** conshdlr, /**< pointer to constraint handler data structure */
2369 SCIP_SET* set /**< global SCIP settings */
2370 )
2371{
2372 assert(conshdlr != NULL);
2373 if( *conshdlr == NULL )
2374 return SCIP_OKAY;
2375 assert(!(*conshdlr)->initialized);
2376 assert((*conshdlr)->nconss == 0);
2377 assert(set != NULL);
2378
2379 /* call destructor of constraint handler */
2380 if( (*conshdlr)->consfree != NULL )
2381 {
2382 SCIP_CALL( (*conshdlr)->consfree(set->scip, *conshdlr) );
2383 }
2384
2385 SCIPclockFree(&(*conshdlr)->resproptime);
2386 SCIPclockFree(&(*conshdlr)->checktime);
2387 SCIPclockFree(&(*conshdlr)->sbproptime);
2388 SCIPclockFree(&(*conshdlr)->proptime);
2389 SCIPclockFree(&(*conshdlr)->enforelaxtime);
2390 SCIPclockFree(&(*conshdlr)->enfopstime);
2391 SCIPclockFree(&(*conshdlr)->enfolptime);
2392 SCIPclockFree(&(*conshdlr)->sepatime);
2393 SCIPclockFree(&(*conshdlr)->presoltime);
2394 SCIPclockFree(&(*conshdlr)->setuptime);
2395
2396 BMSfreeMemoryArrayNull(&(*conshdlr)->name);
2397 BMSfreeMemoryArrayNull(&(*conshdlr)->desc);
2398 BMSfreeMemoryArrayNull(&(*conshdlr)->conss);
2399 BMSfreeMemoryArrayNull(&(*conshdlr)->initconss);
2400 BMSfreeMemoryArrayNull(&(*conshdlr)->sepaconss);
2401 BMSfreeMemoryArrayNull(&(*conshdlr)->enfoconss);
2402 BMSfreeMemoryArrayNull(&(*conshdlr)->checkconss);
2403 BMSfreeMemoryArrayNull(&(*conshdlr)->propconss);
2404 BMSfreeMemoryArrayNull(&(*conshdlr)->updateconss);
2405 BMSfreeMemoryArrayNull(&(*conshdlr)->storedpropconss);
2406 BMSfreeMemory(conshdlr);
2407
2408 return SCIP_OKAY;
2409}
2410
2411/** calls initialization method of constraint handler */
2413 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2414 BMS_BLKMEM* blkmem, /**< block memory */
2415 SCIP_SET* set, /**< global SCIP settings */
2416 SCIP_STAT* stat /**< dynamic problem statistics */
2417 )
2418{
2419 assert(conshdlr != NULL);
2420 assert(set != NULL);
2421
2422 /* skip non-exact constraint handlers during exact solving mode */
2423 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2424 if( set->exact_enable && !conshdlr->exact )
2425 return SCIP_OKAY;
2426
2427 if( conshdlr->initialized )
2428 {
2429 SCIPerrorMessage("constraint handler <%s> already initialized\n", conshdlr->name);
2430 return SCIP_INVALIDCALL;
2431 }
2432
2433 if( set->misc_resetstat )
2434 {
2435 SCIPclockReset(conshdlr->setuptime);
2436 SCIPclockReset(conshdlr->presoltime);
2437 SCIPclockReset(conshdlr->sepatime);
2438 SCIPclockReset(conshdlr->enfolptime);
2439 SCIPclockReset(conshdlr->enfopstime);
2440 SCIPclockReset(conshdlr->enforelaxtime);
2441 SCIPclockReset(conshdlr->proptime);
2442 SCIPclockReset(conshdlr->sbproptime);
2443 SCIPclockReset(conshdlr->checktime);
2444 SCIPclockReset(conshdlr->resproptime);
2445
2446 conshdlr->nsepacalls = 0;
2447 conshdlr->nenfolpcalls = 0;
2448 conshdlr->nenfopscalls = 0;
2449 conshdlr->nenforelaxcalls = 0;
2450 conshdlr->npropcalls = 0;
2451 conshdlr->ncheckcalls = 0;
2452 conshdlr->nrespropcalls = 0;
2453 conshdlr->ncutoffs = 0;
2454 conshdlr->ncutsfound = 0;
2455 conshdlr->ncutsapplied = 0;
2456 conshdlr->nconssfound = 0;
2457 conshdlr->ndomredsfound = 0;
2458 conshdlr->nchildren = 0;
2459 conshdlr->lastpropdomchgcount = -1;
2460 conshdlr->lastenfolpdomchgcount = -1;
2461 conshdlr->lastenfopsdomchgcount = -1;
2462 conshdlr->lastenforelaxdomchgcount = -1;
2463 conshdlr->lastenforelaxrelaxcount = -1;
2464 conshdlr->lastenfolpnode = -1;
2465 conshdlr->lastenfopsnode = -1;
2466 conshdlr->lastenfolpresult = SCIP_DIDNOTRUN;
2467 conshdlr->lastenfopsresult = SCIP_DIDNOTRUN;
2468 conshdlr->maxnactiveconss = conshdlr->nactiveconss;
2469 conshdlr->startnactiveconss = 0;
2470 conshdlr->lastsepalpcount = -1;
2471 conshdlr->lastenfolplpcount = -1;
2472 conshdlr->lastnusefulpropconss = 0;
2473 conshdlr->lastnusefulsepaconss = 0;
2474 conshdlr->lastnusefulenfoconss = 0;
2475 conshdlr->lastnfixedvars = 0;
2476 conshdlr->lastnaggrvars = 0;
2477 conshdlr->lastnchgvartypes = 0;
2478 conshdlr->lastnchgbds = 0;
2479 conshdlr->lastnaddholes = 0;
2480 conshdlr->lastndelconss = 0;
2481 conshdlr->lastnaddconss = 0;
2482 conshdlr->lastnupgdconss = 0;
2483 conshdlr->lastnchgcoefs = 0;
2484 conshdlr->lastnchgsides = 0;
2485 conshdlr->nfixedvars = 0;
2486 conshdlr->naggrvars = 0;
2487 conshdlr->nchgvartypes = 0;
2488 conshdlr->nchgbds = 0;
2489 conshdlr->naddholes = 0;
2490 conshdlr->ndelconss = 0;
2491 conshdlr->naddconss = 0;
2492 conshdlr->nupgdconss = 0;
2493 conshdlr->nchgcoefs = 0;
2494 conshdlr->nchgsides = 0;
2495 conshdlr->npresolcalls = 0;
2496 conshdlr->ageresetavg = AGERESETAVG_INIT;
2497 conshdlr->sepalpwasdelayed = FALSE;
2498 conshdlr->sepasolwasdelayed = FALSE;
2499 conshdlr->propwasdelayed = FALSE;
2500 }
2501
2502 /* call initialization method of constraint handler */
2503 if( conshdlr->consinit != NULL )
2504 {
2505 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
2506 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
2507 * external method; to avoid this, these changes will be buffered and processed after the method call
2508 */
2509 conshdlrDelayUpdates(conshdlr);
2510
2511 /* start timing */
2512 SCIPclockStart(conshdlr->setuptime, set);
2513
2514 /* call external method */
2515 SCIP_CALL( conshdlr->consinit(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss) );
2516
2517 /* stop timing */
2518 SCIPclockStop(conshdlr->setuptime, set);
2519
2520 /* perform the cached constraint updates */
2521 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
2522 }
2523 conshdlr->initialized = TRUE;
2524 assert(!conshdlrAreUpdatesDelayed(conshdlr));
2525
2526 return SCIP_OKAY;
2527}
2528
2529/** calls exit method of constraint handler */
2531 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2532 BMS_BLKMEM* blkmem, /**< block memory */
2533 SCIP_SET* set, /**< global SCIP settings */
2534 SCIP_STAT* stat /**< dynamic problem statistics */
2535 )
2536{
2537 assert(conshdlr != NULL);
2538 assert(set != NULL);
2539
2540 /* skip non-exact constraint handlers during exact solving mode */
2541 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2542 if( set->exact_enable && !conshdlr->exact )
2543 return SCIP_OKAY;
2544
2545 if( !conshdlr->initialized )
2546 {
2547 SCIPerrorMessage("constraint handler <%s> not initialized\n", conshdlr->name);
2548 return SCIP_INVALIDCALL;
2549 }
2550
2551 /* call deinitialization method of constraint handler */
2552 if( conshdlr->consexit != NULL )
2553 {
2554 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
2555 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
2556 * external method; to avoid this, these changes will be buffered and processed after the method call
2557 */
2558 conshdlrDelayUpdates(conshdlr);
2559
2560 /* start timing */
2561 SCIPclockStart(conshdlr->setuptime, set);
2562
2563 /* call external method */
2564 SCIP_CALL( conshdlr->consexit(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss) );
2565
2566 /* stop timing */
2567 SCIPclockStop(conshdlr->setuptime, set);
2568
2569 /* perform the cached constraint updates */
2570 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
2571 }
2572 conshdlr->initialized = FALSE;
2573
2574 return SCIP_OKAY;
2575}
2576
2577/** informs constraint handler that the presolving process is being started */
2579 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2580 BMS_BLKMEM* blkmem, /**< block memory */
2581 SCIP_SET* set, /**< global SCIP settings */
2582 SCIP_STAT* stat /**< dynamic problem statistics */
2583 )
2584{
2585 assert(conshdlr != NULL);
2586 assert(set != NULL);
2587
2588 /* skip non-exact constraint handlers during exact solving mode */
2589 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2590 if( set->exact_enable && !conshdlr->exact )
2591 return SCIP_OKAY;
2592
2593 /* reset conshdlr last presolved data in case of a restart */
2594 conshdlr->lastpropdomchgcount = -1;
2595 conshdlr->lastenfolpdomchgcount = -1;
2596 conshdlr->lastenfopsdomchgcount = -1;
2597 conshdlr->lastenforelaxdomchgcount = -1;
2598 conshdlr->lastenforelaxrelaxcount = -1;
2599 conshdlr->lastenfolpnode = -1;
2600 conshdlr->lastenfopsnode = -1;
2601 conshdlr->lastenfolpresult = SCIP_DIDNOTRUN;
2602 conshdlr->lastenfopsresult = SCIP_DIDNOTRUN;
2604 conshdlr->maxnactiveconss = conshdlr->nactiveconss;
2605 conshdlr->startnactiveconss = 0;
2606 conshdlr->lastsepalpcount = -1;
2607 conshdlr->lastenfolplpcount = -1;
2608 conshdlr->lastnusefulpropconss = 0;
2609 conshdlr->lastnusefulsepaconss = 0;
2610 conshdlr->lastnusefulenfoconss = 0;
2611 conshdlr->lastnfixedvars = 0;
2612 conshdlr->lastnaggrvars = 0;
2613 conshdlr->lastnchgvartypes = 0;
2614 conshdlr->lastnchgbds = 0;
2615 conshdlr->lastnaddholes = 0;
2616 conshdlr->lastndelconss = 0;
2617 conshdlr->lastnaddconss = 0;
2618 conshdlr->lastnupgdconss = 0;
2619 conshdlr->lastnchgcoefs = 0;
2620 conshdlr->lastnchgsides = 0;
2621 conshdlr->propwasdelayed = FALSE;
2622
2623 /* call presolving initialization method of constraint handler */
2624 if( conshdlr->consinitpre != NULL )
2625 {
2626 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
2627 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
2628 * external method; to avoid this, these changes will be buffered and processed after the method call
2629 */
2630 conshdlrDelayUpdates(conshdlr);
2631
2632 /* start timing */
2633 SCIPclockStart(conshdlr->setuptime, set);
2634
2635 /* call external method */
2636 SCIP_CALL( conshdlr->consinitpre(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss) );
2637
2638 /* stop timing */
2639 SCIPclockStop(conshdlr->setuptime, set);
2640
2641 /* perform the cached constraint updates */
2642 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
2643 }
2644
2645 /* after a restart the LP is empty but the initial constraints are not included in the initialconss array anymore;
2646 * we have to put them back into this array in order to obtain the correct initial root relaxation
2647 */
2648 if( stat->nruns >= 2 )
2649 {
2650 int c;
2651
2652 for( c = 0; c < conshdlr->nconss; ++c )
2653 {
2654 /**@todo should only active constraints be added to the initconss array? at least cons->active is asserted in
2655 * conshdlrAddInitcons(conshdlr, set, conshdlr->conss[c])
2656 */
2657 if( conshdlr->conss[c]->addarraypos >= 0 && !conshdlr->conss[c]->deleted &&
2658 conshdlr->conss[c]->initial && conshdlr->conss[c]->initconsspos == -1 )
2659 {
2660 SCIP_CALL( conshdlrAddInitcons(conshdlr, set, stat, conshdlr->conss[c]) );
2661 }
2662 }
2663 }
2664
2665 return SCIP_OKAY;
2666}
2667
2668/** informs constraint handler that the presolving is finished */
2670 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2671 BMS_BLKMEM* blkmem, /**< block memory */
2672 SCIP_SET* set, /**< global SCIP settings */
2673 SCIP_STAT* stat /**< dynamic problem statistics */
2674 )
2675{
2676 assert(conshdlr != NULL);
2677 assert(set != NULL);
2678
2679 /* skip non-exact constraint handlers during exact solving mode */
2680 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2681 if( set->exact_enable && !conshdlr->exact )
2682 return SCIP_OKAY;
2683
2684 /* call presolving deinitialization method of constraint handler */
2685 if( conshdlr->consexitpre != NULL )
2686 {
2687 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
2688 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
2689 * external method; to avoid this, these changes will be buffered and processed after the method call
2690 */
2691 conshdlrDelayUpdates(conshdlr);
2692
2693 /* start timing */
2694 SCIPclockStart(conshdlr->setuptime, set);
2695
2696 /* call external method */
2697 SCIP_CALL( conshdlr->consexitpre(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss) );
2698
2699 /* stop timing */
2700 SCIPclockStop(conshdlr->setuptime, set);
2701
2702 /* perform the cached constraint updates */
2703 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
2704 }
2705
2706 /* update statistics */
2707 conshdlr->maxnactiveconss = conshdlr->nactiveconss;
2708 conshdlr->startnactiveconss = conshdlr->nactiveconss;
2709
2710 return SCIP_OKAY;
2711}
2712
2713/** informs constraint handler that the branch and bound process is being started */
2715 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2716 BMS_BLKMEM* blkmem, /**< block memory */
2717 SCIP_SET* set, /**< global SCIP settings */
2718 SCIP_STAT* stat /**< dynamic problem statistics */
2719 )
2720{
2721 assert(conshdlr != NULL);
2722 assert(set != NULL);
2723 assert(stat != NULL);
2724
2725 /* skip non-exact constraint handlers during exact solving mode */
2726 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2727 if( set->exact_enable && !conshdlr->exact )
2728 return SCIP_OKAY;
2729
2730 conshdlr->sepalpwasdelayed = FALSE;
2731 conshdlr->sepasolwasdelayed = FALSE;
2732
2733 /* call solving process initialization method of constraint handler */
2734 if( conshdlr->consinitsol != NULL )
2735 {
2736 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
2737 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
2738 * external method; to avoid this, these changes will be buffered and processed after the method call
2739 */
2740 conshdlrDelayUpdates(conshdlr);
2741
2742 /* start timing */
2743 SCIPclockStart(conshdlr->setuptime, set);
2744
2745 /* call external method */
2746 SCIP_CALL( conshdlr->consinitsol(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss) );
2747
2748 /* stop timing */
2749 SCIPclockStop(conshdlr->setuptime, set);
2750
2751 /* perform the cached constraint updates */
2752 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
2753 }
2754
2755 return SCIP_OKAY;
2756}
2757
2758/** informs constraint handler that the branch and bound process data is being freed */
2760 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2761 BMS_BLKMEM* blkmem, /**< block memory */
2762 SCIP_SET* set, /**< global SCIP settings */
2763 SCIP_STAT* stat, /**< dynamic problem statistics */
2764 SCIP_Bool restart /**< was this exit solve call triggered by a restart? */
2765 )
2766{
2767 assert(conshdlr != NULL);
2768 assert(set != NULL);
2769
2770 /* skip non-exact constraint handlers during exact solving mode */
2771 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2772 if( set->exact_enable && !conshdlr->exact )
2773 return SCIP_OKAY;
2774
2775 /* call solving process deinitialization method of constraint handler */
2776 if( conshdlr->consexitsol != NULL )
2777 {
2778 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
2779 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
2780 * external method; to avoid this, these changes will be buffered and processed after the method call
2781 */
2782 conshdlrDelayUpdates(conshdlr);
2783
2784 /* start timing */
2785 SCIPclockStart(conshdlr->setuptime, set);
2786
2787 /* call external method */
2788 SCIP_CALL( conshdlr->consexitsol(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss, restart) );
2789
2790 /* stop timing */
2791 SCIPclockStop(conshdlr->setuptime, set);
2792
2793 /* perform the cached constraint updates */
2794 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
2795 }
2796
2797 return SCIP_OKAY;
2798}
2799
2800/** calls LP initialization method of constraint handler to separate all initial active constraints */
2802 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2803 BMS_BLKMEM* blkmem, /**< block memory */
2804 SCIP_SET* set, /**< global SCIP settings */
2805 SCIP_STAT* stat, /**< dynamic problem statistics */
2806 SCIP_TREE* tree, /**< branch and bound tree */
2807 SCIP_Bool initkeptconss, /**< Also initialize constraints which are valid at a more global node,
2808 * but were not activated there? Should be FALSE for repeated calls at
2809 * one node or if the current focusnode is a child of the former one */
2810 SCIP_Bool* cutoff /**< pointer to store whether infeasibility was detected while building the LP */
2811 )
2812{
2813 assert(conshdlr != NULL);
2814 assert(cutoff != NULL);
2815#ifdef MORE_DEBUG
2816 assert(stat->nnodes > 1 || conshdlr->ninitconsskept == 0 || SCIPtreeProbing(tree));
2817#endif
2818
2819 *cutoff = FALSE;
2820
2821 /* skip non-exact constraint handlers during exact solving mode */
2822 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2823 if( set->exact_enable && !conshdlr->exact )
2824 return SCIP_OKAY;
2825
2826 if( conshdlr->consinitlp != NULL )
2827 {
2828 int currentdepth;
2829 int oldninitconss;
2830 int c;
2831
2832 SCIPsetDebugMsg(set, "initializing LP with %d initial constraints of handler <%s> (ninitconss=%d, kept=%d, initkept=%u)\n",
2833 initkeptconss ? conshdlr->ninitconss : conshdlr->ninitconss - conshdlr->ninitconsskept, conshdlr->name,
2834 conshdlr->ninitconss, conshdlr->ninitconsskept, initkeptconss);
2835
2836 /* no constraints to initialize (or only kept constraints which do not need to be initialized this time) -> return */
2837 if( conshdlr->needscons && (conshdlr->ninitconss == 0 || (!initkeptconss && conshdlr->ninitconss == conshdlr->ninitconsskept)) )
2838 return SCIP_OKAY;
2839
2840 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
2841 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
2842 * external method; to avoid this, these changes will be buffered and processed after the method call
2843 */
2844 conshdlrDelayUpdates(conshdlr);
2845
2846 oldninitconss = conshdlr->ninitconss;
2847
2848 /* start timing */
2849 SCIPclockStart(conshdlr->sepatime, set);
2850
2851 if( initkeptconss )
2852 {
2853 /* add all kept initial constraints which are currently active to the second part of the initconss array */
2854 /* @todo keep track of where a constraint was already initialized (e.g., in the conssetchg)? */
2855 for( c = 0; c < conshdlr->ninitconsskept; ++c )
2856 {
2857 assert(conshdlr->initconss[c]->initconsspos == c);
2858
2859 if( SCIPconsIsActive(conshdlr->initconss[c]) )
2860 {
2861 SCIP_CALL( conshdlrAddInitcons(conshdlr, set, stat, conshdlr->initconss[c]) );
2862 }
2863 }
2864 }
2865
2866 /* call external method */
2867 SCIP_CALL( conshdlr->consinitlp(set->scip, conshdlr, &conshdlr->initconss[conshdlr->ninitconsskept],
2868 conshdlr->ninitconss - conshdlr->ninitconsskept, cutoff) );
2869
2870 /* stop timing */
2871 SCIPclockStop(conshdlr->sepatime, set);
2872
2873 /* perform the cached constraint updates */
2874 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
2875
2876 currentdepth = SCIPtreeGetCurrentDepth(tree);
2877 assert(currentdepth >= 0);
2878
2879 /* clear the initconss array */
2880 for( c = conshdlr->ninitconsskept; c < oldninitconss; ++c )
2881 {
2882 assert(SCIPconsGetActiveDepth(conshdlr->initconss[c]) >= -1);
2883 assert(SCIPconsGetActiveDepth(conshdlr->initconss[c]) <= currentdepth);
2884
2885 /* if the constraint was not initialized at its valid node, we keep it */
2886 if( currentdepth > 0 ? SCIPconsGetActiveDepth(conshdlr->initconss[c]) != currentdepth :
2887 SCIPconsGetActiveDepth(conshdlr->initconss[c]) > 0 )
2888 {
2889 conshdlr->initconss[conshdlr->ninitconsskept] = conshdlr->initconss[c];
2890 conshdlr->initconss[conshdlr->ninitconsskept]->initconsspos = conshdlr->ninitconsskept;
2891 ++(conshdlr->ninitconsskept);
2892 }
2893 else
2894 conshdlr->initconss[c]->initconsspos = -1;
2895 }
2896#ifndef NDEBUG
2897 for( ; c < conshdlr->ninitconss; ++c )
2898 assert(conshdlr->initconss[c]->initconsspos < conshdlr->ninitconsskept);
2899#endif
2900 conshdlr->ninitconss = conshdlr->ninitconsskept;
2901
2902 if( conshdlr->ninitconss == 0 )
2903 {
2905 conshdlr->initconsssize = 0;
2906 }
2907 }
2908
2909 return SCIP_OKAY;
2910}
2911
2912/** calls separator method of constraint handler to separate LP solution */
2914 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
2915 BMS_BLKMEM* blkmem, /**< block memory */
2916 SCIP_SET* set, /**< global SCIP settings */
2917 SCIP_STAT* stat, /**< dynamic problem statistics */
2918 SCIP_SEPASTORE* sepastore, /**< separation storage */
2919 int depth, /**< depth of current node */
2920 SCIP_Bool execdelayed, /**< execute separation method even if it is marked to be delayed */
2921 SCIP_RESULT* result /**< pointer to store the result of the callback method */
2922 )
2923{
2924 assert(conshdlr != NULL);
2925 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
2926 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
2927 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
2928 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
2929 assert(stat != NULL);
2930 assert(conshdlr->lastsepalpcount != stat->lpcount
2931 || (0 <= conshdlr->lastnusefulsepaconss && conshdlr->lastnusefulsepaconss <= conshdlr->nusefulsepaconss));
2932 assert(set != NULL);
2933 assert(result != NULL);
2934
2935 *result = SCIP_DIDNOTRUN;
2936
2937 /* skip non-exact constraint handlers during exact solving mode */
2938 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
2939 if( set->exact_enable && !conshdlr->exact )
2940 return SCIP_OKAY;
2941
2942 if( conshdlr->conssepalp != NULL
2943 && ((depth == 0 && conshdlr->sepafreq == 0)
2944 || (conshdlr->sepafreq > 0 && depth % conshdlr->sepafreq == 0)
2945 || conshdlr->sepalpwasdelayed) )
2946 {
2947 /* check, if separation method should be delayed */
2948 if( !conshdlr->delaysepa || execdelayed )
2949 {
2950 int nconss;
2951 int nusefulconss;
2952 int firstcons;
2953
2954 /* check, if this LP solution was already separated */
2955 if( conshdlr->lastsepalpcount == stat->lpcount )
2956 {
2957 /* all constraints that were not yet separated on the new LP solution must be useful constraints, which means,
2958 * that the new constraints are the last constraints of the useful ones
2959 */
2960 nconss = conshdlr->nusefulsepaconss - conshdlr->lastnusefulsepaconss;
2961 nusefulconss = nconss;
2962 firstcons = conshdlr->lastnusefulsepaconss;
2963 }
2964 else
2965 {
2966 /* on a new LP solution, we want to separate all constraints */
2967 nconss = conshdlr->nsepaconss;
2968 nusefulconss = conshdlr->nusefulsepaconss;
2969 firstcons = 0;
2970 }
2971 assert(firstcons >= 0);
2972 assert(firstcons + nconss <= conshdlr->nsepaconss);
2973 assert(nusefulconss <= nconss);
2974
2975 /* constraint handlers without constraints should only be called once */
2976 if( nconss > 0 || (!conshdlr->needscons && conshdlr->lastsepalpcount != stat->lpcount) )
2977 {
2978 SCIP_CONS** conss;
2979 SCIP_Longint oldndomchgs;
2980 SCIP_Longint oldnprobdomchgs;
2981 SCIP_Longint lastsepalpcount;
2982 int oldncuts;
2983 int oldnactiveconss;
2984 int lastnusefulsepaconss;
2985
2986 SCIPsetDebugMsg(set, "separating constraints %d to %d of %d constraints of handler <%s> (%s LP solution)\n",
2987 firstcons, firstcons + nconss - 1, conshdlr->nsepaconss, conshdlr->name,
2988 conshdlr->lastsepalpcount == stat->lpcount ? "old" : "new");
2989
2990 /* remember the number of processed constraints on the current LP solution */
2991 lastsepalpcount = stat->lpcount;
2992 lastnusefulsepaconss = conshdlr->nusefulsepaconss;
2993
2994 /* get the array of the constraints to be processed */
2995 conss = &(conshdlr->sepaconss[firstcons]);
2996
2997 oldndomchgs = stat->nboundchgs + stat->nholechgs;
2998 oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
2999 oldncuts = SCIPsepastoreGetNCuts(sepastore);
3000 oldnactiveconss = stat->nactiveconss;
3001
3002 /* check, if we want to use eager evaluation */
3003 if( (conshdlr->eagerfreq == 0 && conshdlr->nsepacalls == 0)
3004 || (conshdlr->eagerfreq > 0 && conshdlr->nsepacalls % conshdlr->eagerfreq == 0) )
3005 nusefulconss = nconss;
3006
3007 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3008 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3009 * external method; to avoid this, these changes will be buffered and processed after the method call
3010 */
3011 conshdlrDelayUpdates(conshdlr);
3012 conshdlr->duringsepa = TRUE;
3013
3014 /* start timing */
3015 SCIPclockStart(conshdlr->sepatime, set);
3016
3017 /* call external method */
3018 SCIP_CALL( conshdlr->conssepalp(set->scip, conshdlr, conss, nconss, nusefulconss, result) );
3019 SCIPsetDebugMsg(set, " -> separating LP returned result <%d>\n", *result);
3020
3021 /* stop timing */
3022 SCIPclockStop(conshdlr->sepatime, set);
3023
3024 /* perform the cached constraint updates */
3025 conshdlr->duringsepa = FALSE;
3026 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3027
3028 /* update statistics */
3029 if( *result != SCIP_DIDNOTRUN && *result != SCIP_DELAYED )
3030 {
3031 conshdlr->lastsepalpcount = lastsepalpcount;
3032 conshdlr->lastnusefulsepaconss = MIN(lastnusefulsepaconss, conshdlr->nusefulsepaconss);
3033 conshdlr->nsepacalls++;
3034 }
3035 if( *result == SCIP_CUTOFF )
3036 conshdlr->ncutoffs++;
3037 conshdlr->ncutsfound += SCIPsepastoreGetNCuts(sepastore) - oldncuts; /*lint !e776*/
3038 conshdlr->nconssfound += MAX(stat->nactiveconss - oldnactiveconss, 0); /*lint !e776*/
3039
3040 /* update domain reductions; therefore remove the domain
3041 * reduction counts which were generated in probing mode */
3042 conshdlr->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
3043 conshdlr->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
3044
3045 /* evaluate result */
3046 if( *result != SCIP_CUTOFF
3047 && *result != SCIP_CONSADDED
3048 && *result != SCIP_REDUCEDDOM
3049 && *result != SCIP_SEPARATED
3050 && *result != SCIP_NEWROUND
3051 && *result != SCIP_DIDNOTFIND
3052 && *result != SCIP_DIDNOTRUN
3053 && *result != SCIP_DELAYED )
3054 {
3055 SCIPerrorMessage("LP separation method of constraint handler <%s> returned invalid result <%d>\n",
3056 conshdlr->name, *result);
3057 return SCIP_INVALIDRESULT;
3058 }
3059 }
3060 }
3061 else
3062 {
3063 SCIPsetDebugMsg(set, "LP separation method of constraint handler <%s> was delayed\n", conshdlr->name);
3064 *result = SCIP_DELAYED;
3065 }
3066
3067 /* remember whether separation method was delayed */
3068 conshdlr->sepalpwasdelayed = (*result == SCIP_DELAYED);
3069 }
3070
3071 return SCIP_OKAY;
3072}
3073
3074/** calls separator method of constraint handler to separate given primal solution */
3076 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3077 BMS_BLKMEM* blkmem, /**< block memory */
3078 SCIP_SET* set, /**< global SCIP settings */
3079 SCIP_STAT* stat, /**< dynamic problem statistics */
3080 SCIP_SEPASTORE* sepastore, /**< separation storage */
3081 SCIP_SOL* sol, /**< primal solution that should be separated */
3082 int depth, /**< depth of current node */
3083 SCIP_Bool execdelayed, /**< execute separation method even if it is marked to be delayed */
3084 SCIP_RESULT* result /**< pointer to store the result of the callback method */
3085 )
3086{
3087 assert(conshdlr != NULL);
3088 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3089 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3090 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3091 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3092 assert(set != NULL);
3093 assert(stat != NULL);
3094 assert(result != NULL);
3095
3096 *result = SCIP_DIDNOTRUN;
3097
3098 /* skip non-exact constraint handlers during exact solving mode */
3099 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
3100 if( set->exact_enable && !conshdlr->exact )
3101 return SCIP_OKAY;
3102
3103 if( conshdlr->conssepasol != NULL
3104 && ((depth == 0 && conshdlr->sepafreq == 0)
3105 || (conshdlr->sepafreq > 0 && depth % conshdlr->sepafreq == 0)
3106 || conshdlr->sepasolwasdelayed) )
3107 {
3108 /* check, if separation method should be delayed */
3109 if( !conshdlr->delaysepa || execdelayed )
3110 {
3111 int nconss;
3112 int nusefulconss;
3113
3114 /* always separate all constraints */
3115 nconss = conshdlr->nsepaconss;
3116 nusefulconss = conshdlr->nusefulsepaconss;
3117 assert(nusefulconss <= nconss);
3118
3119 if( nconss > 0 || !conshdlr->needscons )
3120 {
3121 SCIP_CONS** conss;
3122 SCIP_Longint oldndomchgs;
3123 SCIP_Longint oldnprobdomchgs;
3124 int oldncuts;
3125 int oldnactiveconss;
3126
3127 SCIPsetDebugMsg(set, "separating %d constraints of handler <%s> (primal solution %p)\n",
3128 nconss, conshdlr->name, (void*)sol);
3129
3130 /* get the array of the constraints to be processed */
3131 conss = conshdlr->sepaconss;
3132
3133 oldndomchgs = stat->nboundchgs + stat->nholechgs;
3134 oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
3135 oldncuts = SCIPsepastoreGetNCuts(sepastore);
3136 oldnactiveconss = stat->nactiveconss;
3137
3138 /* check, if we want to use eager evaluation */
3139 if( (conshdlr->eagerfreq == 0 && conshdlr->nsepacalls == 0)
3140 || (conshdlr->eagerfreq > 0 && conshdlr->nsepacalls % conshdlr->eagerfreq == 0) )
3141 nusefulconss = nconss;
3142
3143 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3144 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3145 * external method; to avoid this, these changes will be buffered and processed after the method call
3146 */
3147 conshdlrDelayUpdates(conshdlr);
3148 conshdlr->duringsepa = TRUE;
3149
3150 /* start timing */
3151 SCIPclockStart(conshdlr->sepatime, set);
3152
3153 /* call external method */
3154 SCIP_CALL( conshdlr->conssepasol(set->scip, conshdlr, conss, nconss, nusefulconss, sol, result) );
3155 SCIPsetDebugMsg(set, " -> separating sol returned result <%d>\n", *result);
3156
3157 /* stop timing */
3158 SCIPclockStop(conshdlr->sepatime, set);
3159
3160 /* perform the cached constraint updates */
3161 conshdlr->duringsepa = FALSE;
3162 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3163
3164 /* update statistics */
3165 if( *result != SCIP_DIDNOTRUN && *result != SCIP_DELAYED )
3166 conshdlr->nsepacalls++;
3167 if( *result == SCIP_CUTOFF )
3168 conshdlr->ncutoffs++;
3169 conshdlr->ncutsfound += SCIPsepastoreGetNCuts(sepastore) - oldncuts; /*lint !e776*/
3170 conshdlr->nconssfound += MAX(stat->nactiveconss - oldnactiveconss, 0); /*lint !e776*/
3171
3172 /* update domain reductions; therefore remove the domain
3173 * reduction counts which were generated in probing mode */
3174 conshdlr->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
3175 conshdlr->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
3176
3177 /* evaluate result */
3178 if( *result != SCIP_CUTOFF
3179 && *result != SCIP_CONSADDED
3180 && *result != SCIP_REDUCEDDOM
3181 && *result != SCIP_SEPARATED
3182 && *result != SCIP_NEWROUND
3183 && *result != SCIP_DIDNOTFIND
3184 && *result != SCIP_DIDNOTRUN
3185 && *result != SCIP_DELAYED )
3186 {
3187 SCIPerrorMessage("SOL separation method of constraint handler <%s> returned invalid result <%d>\n",
3188 conshdlr->name, *result);
3189 return SCIP_INVALIDRESULT;
3190 }
3191 }
3192 }
3193 else
3194 {
3195 SCIPsetDebugMsg(set, "SOL separation method of constraint handler <%s> was delayed\n", conshdlr->name);
3196 *result = SCIP_DELAYED;
3197 }
3198
3199 /* remember whether separation method was delayed */
3200 conshdlr->sepasolwasdelayed = (*result == SCIP_DELAYED);
3201 }
3202
3203 return SCIP_OKAY;
3204}
3205
3206/** calls enforcing method of constraint handler for a relaxation solution for all constraints added after last
3207 * conshdlrResetEnfo() call
3208 */
3210 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3211 BMS_BLKMEM* blkmem, /**< block memory */
3212 SCIP_SET* set, /**< global SCIP settings */
3213 SCIP_STAT* stat, /**< dynamic problem statistics */
3214 SCIP_TREE* tree, /**< branch and bound tree */
3215 SCIP_SEPASTORE* sepastore, /**< separation storage */
3216 SCIP_SOL* relaxsol, /**< solution to be enforced */
3217 SCIP_Bool solinfeasible, /**< was the solution already found out to be infeasible? */
3218 SCIP_RESULT* result /**< pointer to store the result of the callback method */
3219 )
3220{
3221 int nconss;
3222 int nusefulconss;
3223 int firstcons;
3224 SCIP_Bool relaxchanged;
3225 SCIP_Bool lastinfeasible;
3226
3227 assert(conshdlr != NULL);
3228 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3229 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3230 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3231 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3232 assert(stat != NULL);
3233 assert(conshdlr->lastenfopsdomchgcount != stat->domchgcount
3234 || conshdlr->lastenfopsnode != stat->nnodes
3235 || (0 <= conshdlr->lastnusefulenfoconss && conshdlr->lastnusefulenfoconss <= conshdlr->nusefulenfoconss));
3236 assert(set != NULL);
3237 assert(tree != NULL);
3238 assert(tree->nchildren == 0);
3239 assert(relaxsol != NULL);
3240 assert(result != NULL);
3241
3242 *result = SCIP_FEASIBLE;
3243
3244 /* skip non-exact constraint handlers during exact solving mode */
3245 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
3246 if( set->exact_enable && !conshdlr->exact )
3247 return SCIP_OKAY;
3248
3249 /* check, if this relaxation solution was already enforced at this node
3250 * the integrality constraint handler always needs to be enforced for all constraints since external branching
3251 * candidates are cleared before each resolve
3252 */
3253 if( conshdlr->lastenforelaxrelaxcount == stat->relaxcount
3254 && conshdlr->lastenforelaxdomchgcount == stat->domchgcount
3255 && conshdlr->lastenforelaxnode == stat->nnodes
3256 && conshdlr->lastenforelaxresult != SCIP_CONSADDED
3257 && conshdlr->lastenforelaxresult != SCIP_SOLVELP
3258 && ( strcmp(conshdlr->name, "integral") != 0 )
3259 )
3260 {
3261 assert(conshdlr->lastenforelaxresult != SCIP_CUTOFF);
3262 assert(conshdlr->lastenforelaxresult != SCIP_BRANCHED);
3263 assert(conshdlr->lastenforelaxresult != SCIP_REDUCEDDOM);
3264 assert(conshdlr->lastenforelaxresult != SCIP_DIDNOTRUN);
3265
3266 /* if we already enforced the same relaxation solution at this node, we will only enforce new constraints in the
3267 * following; however, the result of the last call for the old constraint is still valid and we have to ensure
3268 * that an infeasibility in the last call is not lost because we only enforce new constraints
3269 */
3270 if( conshdlr->lastenforelaxresult == SCIP_INFEASIBLE )
3271 {
3272 *result = SCIP_INFEASIBLE;
3273 lastinfeasible = TRUE;
3274 }
3275 else
3276 lastinfeasible = FALSE;
3277
3278 /* all constraints that were not yet enforced on the new relaxation solution must be useful constraints, which means,
3279 * that the new constraints are the last constraints of the useful ones
3280 */
3281 nconss = conshdlr->nusefulenfoconss - conshdlr->lastnusefulenfoconss;
3282 nusefulconss = nconss;
3283 firstcons = conshdlr->lastnusefulenfoconss;
3284 relaxchanged = FALSE;
3285 }
3286 else
3287 {
3288 /* on a new relaxation solution or a new node, we want to enforce all constraints */
3289 nconss = conshdlr->nenfoconss;
3290 nusefulconss = conshdlr->nusefulenfoconss;
3291 firstcons = 0;
3292 relaxchanged = TRUE;
3293 lastinfeasible = FALSE;
3294 }
3295 assert(firstcons >= 0);
3296 assert(firstcons + nconss <= conshdlr->nenfoconss);
3297 assert(nusefulconss <= nconss);
3298
3299 /* constraint handlers without constraints should only be called once */
3300 if( nconss > 0 || (!conshdlr->needscons && relaxchanged) )
3301 {
3302 SCIP_CONS** conss = NULL;
3303 SCIP_Longint oldndomchgs;
3304 SCIP_Longint oldnprobdomchgs;
3305 int oldncuts;
3306 int oldnactiveconss;
3307
3308 assert(conshdlr->consenforelax != NULL);
3309
3310 SCIPdebugMessage("enforcing constraints %d to %d of %d constraints of handler <%s> (%s relaxation solution)\n",
3311 firstcons, firstcons + nconss - 1, conshdlr->nenfoconss, conshdlr->name, relaxchanged ? "new" : "old");
3312
3313 /* remember the number of processed constraints on the current relaxation solution */
3314 conshdlr->lastenforelaxrelaxcount = stat->relaxcount;
3315 conshdlr->lastenforelaxdomchgcount = stat->domchgcount;
3316 conshdlr->lastenforelaxnode = stat->nnodes;
3317 conshdlr->lastnusefulenfoconss = conshdlr->nusefulenfoconss;
3318
3319 /* get the array of the constraints to be processed */
3320 if( conshdlr->needscons )
3321 {
3322 assert(conshdlr->enfoconss != NULL);
3323 conss = conshdlr->enfoconss + firstcons;
3324 }
3325
3326 oldncuts = SCIPsepastoreGetNCuts(sepastore);
3327 oldnactiveconss = stat->nactiveconss;
3328 oldndomchgs = stat->nboundchgs + stat->nholechgs;
3329 oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
3330
3331 /* check, if we want to use eager evaluation */
3332 if( (conshdlr->eagerfreq == 0 && conshdlr->nenforelaxcalls == 0)
3333 || (conshdlr->eagerfreq > 0 && conshdlr->nenforelaxcalls % conshdlr->eagerfreq == 0) )
3334 nusefulconss = nconss;
3335
3336 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3337 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3338 * external method; to avoid this, these changes will be buffered and processed after the method call
3339 */
3340 conshdlrDelayUpdates(conshdlr);
3341
3342 /* start timing */
3343 SCIPclockStart(conshdlr->enforelaxtime, set);
3344
3345 /* call external method */
3346 SCIP_CALL( conshdlr->consenforelax(set->scip, relaxsol, conshdlr, conss, nconss, nusefulconss, solinfeasible, result) );
3347 SCIPdebugMessage(" -> enforcing returned result <%d>\n", *result);
3348
3349 /* stop timing */
3350 SCIPclockStop(conshdlr->enforelaxtime, set);
3351
3352 /* perform the cached constraint updates */
3353 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3354
3355 /* update statistics */
3356 conshdlr->nenforelaxcalls++;
3357 if( *result == SCIP_CUTOFF )
3358 conshdlr->ncutoffs++;
3359 conshdlr->ncutsfound += SCIPsepastoreGetNCuts(sepastore) - oldncuts; /*lint !e776*/
3360 conshdlr->nconssfound += MAX(stat->nactiveconss - oldnactiveconss, 0); /*lint !e776*/
3361
3362 if( *result != SCIP_BRANCHED )
3363 {
3364 assert(tree->nchildren == 0);
3365
3366 /* update domain reductions; therefore remove the domain
3367 * reduction counts which were generated in probing mode */
3368 conshdlr->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
3369 conshdlr->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
3370 }
3371 else
3372 conshdlr->nchildren += tree->nchildren;
3373
3374 /* remember the result of the enforcement call */
3375 conshdlr->lastenforelaxresult = *result;
3376
3377 /* evaluate result */
3378 if( *result != SCIP_CUTOFF
3379 && *result != SCIP_CONSADDED
3380 && *result != SCIP_REDUCEDDOM
3381 && *result != SCIP_SEPARATED
3382 && *result != SCIP_BRANCHED
3383 && *result != SCIP_SOLVELP
3384 && *result != SCIP_INFEASIBLE
3385 && *result != SCIP_FEASIBLE )
3386 {
3387 SCIPerrorMessage("enforcing method of constraint handler <%s> for relaxation solutions returned invalid result <%d>\n",
3388 conshdlr->name, *result);
3389 return SCIP_INVALIDRESULT;
3390 }
3391
3392 /* if the same relaxation solution was already enforced at this node, we only enforced new constraints this time;
3393 * if the enforelax call returns feasible now, the solution is only feasible w.r.t. the new constraints, if the
3394 * last call detected infeasibility for the old constraints, we have to change the result to infeasible
3395 */
3396 if( lastinfeasible && *result == SCIP_FEASIBLE )
3397 *result = SCIP_INFEASIBLE;
3398 }
3399
3400 return SCIP_OKAY;
3401}
3402
3403/** calls enforcing method of constraint handler for LP solution for all constraints added after last
3404 * conshdlrResetEnfo() call
3405 */
3407 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3408 BMS_BLKMEM* blkmem, /**< block memory */
3409 SCIP_SET* set, /**< global SCIP settings */
3410 SCIP_STAT* stat, /**< dynamic problem statistics */
3411 SCIP_TREE* tree, /**< branch and bound tree */
3412 SCIP_SEPASTORE* sepastore, /**< separation storage */
3413 SCIP_Bool solinfeasible, /**< was the solution already found out to be infeasible? */
3414 SCIP_RESULT* result /**< pointer to store the result of the callback method */
3415 )
3416{
3417 assert(conshdlr != NULL);
3418 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3419 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3420 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3421 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3422 assert(stat != NULL);
3423 assert(conshdlr->lastenfolplpcount != stat->lpcount
3424 || conshdlr->lastenfolpdomchgcount != stat->domchgcount
3425 || conshdlr->lastenfolpnode != stat->nnodes
3426 || (0 <= conshdlr->lastnusefulenfoconss && conshdlr->lastnusefulenfoconss <= conshdlr->nusefulenfoconss));
3427 assert(set != NULL);
3428 assert(tree != NULL);
3429 assert(tree->nchildren == 0);
3430 assert(result != NULL);
3431
3432 *result = SCIP_FEASIBLE;
3433
3434 /* skip non-exact constraint handlers during exact solving mode */
3435 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
3436 if( set->exact_enable && !conshdlr->exact )
3437 return SCIP_OKAY;
3438
3439 if( conshdlr->consenfolp != NULL )
3440 {
3441 int nconss;
3442 int nusefulconss;
3443 int firstcons;
3444 SCIP_Bool lpchanged;
3445 SCIP_Bool lastinfeasible;
3446
3447 /* check, if this LP solution was already enforced at this node */
3448 if( conshdlr->lastenfolplpcount == stat->lpcount
3449 && conshdlr->lastenfolpdomchgcount == stat->domchgcount
3450 && conshdlr->lastenfolpnode == stat->nnodes
3451 && conshdlr->lastenfolpresult != SCIP_CONSADDED )
3452 {
3453 assert(conshdlr->lastenfolpresult == SCIP_FEASIBLE || conshdlr->lastenfolpresult == SCIP_INFEASIBLE
3454 || conshdlr->lastenfolpresult == SCIP_SEPARATED );
3455
3456 /* if we already enforced the same pseudo solution at this node, we will only enforce new constraints in the
3457 * following; however, the result of the last call for the old constraint is still valid and we have to ensure
3458 * that an infeasibility in the last call is not lost because we only enforce new constraints
3459 */
3460 if( conshdlr->lastenfolpresult == SCIP_FEASIBLE )
3461 lastinfeasible = FALSE;
3462 else
3463 {
3464 assert(conshdlr->lastenfolpresult == SCIP_INFEASIBLE || conshdlr->lastenfolpresult == SCIP_SEPARATED);
3465 *result = SCIP_INFEASIBLE;
3466 lastinfeasible = TRUE;
3467 }
3468
3469 /* all constraints that were not yet enforced on the new LP solution must be useful constraints, which means,
3470 * that the new constraints are the last constraints of the useful ones
3471 */
3472 nconss = conshdlr->nusefulenfoconss - conshdlr->lastnusefulenfoconss;
3473 nusefulconss = nconss;
3474 firstcons = conshdlr->lastnusefulenfoconss;
3475 lpchanged = FALSE;
3476 }
3477 else
3478 {
3479 /* on a new LP solution or a new node, we want to enforce all constraints */
3480 nconss = conshdlr->nenfoconss;
3481 nusefulconss = conshdlr->nusefulenfoconss;
3482 firstcons = 0;
3483 lpchanged = TRUE;
3484 lastinfeasible = FALSE;
3485 }
3486 assert(firstcons >= 0);
3487 assert(firstcons + nconss <= conshdlr->nenfoconss);
3488 assert(nusefulconss <= nconss);
3489
3490 /* constraint handlers without constraints should only be called once */
3491 if( nconss > 0 || (!conshdlr->needscons && lpchanged) )
3492 {
3493 SCIP_CONS** conss;
3494 SCIP_Longint oldndomchgs;
3495 SCIP_Longint oldnprobdomchgs;
3496 int oldncuts;
3497 int oldnactiveconss;
3498
3499 SCIPsetDebugMsg(set, "enforcing constraints %d to %d of %d constraints of handler <%s> (%s LP solution)\n",
3500 firstcons, firstcons + nconss - 1, conshdlr->nenfoconss, conshdlr->name, lpchanged ? "new" : "old");
3501
3502 /* remember the number of processed constraints on the current LP solution */
3503 conshdlr->lastenfolplpcount = stat->lpcount;
3504 conshdlr->lastenfolpdomchgcount = stat->domchgcount;
3505 conshdlr->lastenfolpnode = stat->nnodes;
3506 conshdlr->lastnusefulenfoconss = conshdlr->nusefulenfoconss;
3507
3508 /* get the array of the constraints to be processed */
3509 conss = nconss > 0 ? conshdlr->enfoconss + firstcons : NULL;
3510
3511 oldncuts = SCIPsepastoreGetNCuts(sepastore);
3512 oldnactiveconss = stat->nactiveconss;
3513 oldndomchgs = stat->nboundchgs + stat->nholechgs;
3514 oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
3515
3516 /* check, if we want to use eager evaluation */
3517 if( (conshdlr->eagerfreq == 0 && conshdlr->nenfolpcalls == 0)
3518 || (conshdlr->eagerfreq > 0 && conshdlr->nenfolpcalls % conshdlr->eagerfreq == 0) )
3519 nusefulconss = nconss;
3520
3521 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3522 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3523 * external method; to avoid this, these changes will be buffered and processed after the method call
3524 */
3525 conshdlrDelayUpdates(conshdlr);
3526
3527 /* start timing */
3528 SCIPclockStart(conshdlr->enfolptime, set);
3529
3530 /* call external method */
3531 SCIP_CALL( conshdlr->consenfolp(set->scip, conshdlr, conss, nconss, nusefulconss, solinfeasible, result) );
3532 SCIPsetDebugMsg(set, " -> enforcing returned result <%d>\n", *result);
3533
3534 /* stop timing */
3535 SCIPclockStop(conshdlr->enfolptime, set);
3536
3537 /* perform the cached constraint updates */
3538 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3539
3540 /* remember the result of the enforcement call */
3541 conshdlr->lastenfolpresult = *result;
3542
3543 /* update statistics */
3544 conshdlr->nenfolpcalls++;
3545 if( *result == SCIP_CUTOFF )
3546 conshdlr->ncutoffs++;
3547 conshdlr->ncutsfound += SCIPsepastoreGetNCuts(sepastore) - oldncuts; /*lint !e776*/
3548 conshdlr->nconssfound += MAX(stat->nactiveconss - oldnactiveconss, 0); /*lint !e776*/
3549 if( *result != SCIP_BRANCHED )
3550 {
3551 assert(tree->nchildren == 0);
3552
3553 /* update domain reductions; therefore remove the domain
3554 * reduction counts which were generated in probing mode */
3555 conshdlr->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
3556 conshdlr->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
3557 }
3558 else
3559 conshdlr->nchildren += tree->nchildren;
3560
3561 /* evaluate result */
3562 if( *result != SCIP_CUTOFF
3563 && *result != SCIP_CONSADDED
3564 && *result != SCIP_REDUCEDDOM
3565 && *result != SCIP_SEPARATED
3566 && *result != SCIP_SOLVELP
3567 && *result != SCIP_BRANCHED
3568 && *result != SCIP_INFEASIBLE
3569 && *result != SCIP_FEASIBLE )
3570 {
3571 SCIPerrorMessage("enforcing method of constraint handler <%s> for LP solutions returned invalid result <%d>\n",
3572 conshdlr->name, *result);
3573 return SCIP_INVALIDRESULT;
3574 }
3575
3576 /* if the same LP solution was already enforced at this node, we only enforced new constraints this time;
3577 * if the enfolp call returns feasible now, the solution is only feasible w.r.t. the new constraints, if the
3578 * last call detected infeasibility for the old constraints, we have to change the result to infeasible
3579 */
3580 if( lastinfeasible && *result == SCIP_FEASIBLE )
3581 *result = SCIP_INFEASIBLE;
3582 }
3583 }
3584
3585 return SCIP_OKAY;
3586}
3587
3588/** calls diving solution enforcement callback of constraint handler, if it exists */
3590 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3591 SCIP_SET* set, /**< global SCIP settings */
3592 SCIP_DIVESET* diveset, /**< diving settings to control scoring */
3593 SCIP_SOL* sol, /**< current solution of diving mode */
3594 SCIP_Bool* success, /**< pointer to store whether constraint handler successfully found a variable */
3595 SCIP_Bool* infeasible /**< pointer to store whether the current node was detected to be infeasible */
3596 )
3597{
3598 assert(conshdlr != NULL);
3599 assert(set != NULL);
3600 assert(diveset != NULL);
3601 assert(sol != NULL);
3602 assert(success != NULL);
3603 assert(infeasible != NULL);
3604
3605 *success = FALSE;
3606 *infeasible = FALSE;
3607
3608 /* skip non-exact constraint handlers during exact solving mode */
3609 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
3610 if( set->exact_enable && !conshdlr->exact )
3611 return SCIP_OKAY;
3612
3613 if( conshdlr->consgetdivebdchgs != NULL )
3614 {
3615 SCIP_CALL( conshdlr->consgetdivebdchgs(set->scip, conshdlr, diveset, sol, success, infeasible) );
3616 }
3617
3618 return SCIP_OKAY;
3619}
3620
3621/** calls enforcing method of constraint handler for pseudo solution for all constraints added after last
3622 * conshdlrResetEnfo() call
3623 */
3625 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3626 BMS_BLKMEM* blkmem, /**< block memory */
3627 SCIP_SET* set, /**< global SCIP settings */
3628 SCIP_STAT* stat, /**< dynamic problem statistics */
3629 SCIP_TREE* tree, /**< branch and bound tree */
3630 SCIP_BRANCHCAND* branchcand, /**< branching candidate storage */
3631 SCIP_Bool solinfeasible, /**< was the solution already found out to be infeasible? */
3632 SCIP_Bool objinfeasible, /**< is the solution infeasible anyway due to violating lower objective bound? */
3633 SCIP_Bool forced, /**< should enforcement of pseudo solution be forced? */
3634 SCIP_RESULT* result /**< pointer to store the result of the callback method */
3635 )
3636{
3637 assert(conshdlr != NULL);
3638 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3639 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3640 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3641 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3642 assert(stat != NULL);
3643 assert(conshdlr->lastenfopsdomchgcount != stat->domchgcount
3644 || conshdlr->lastenfopsnode != stat->nnodes
3645 || (0 <= conshdlr->lastnusefulenfoconss && conshdlr->lastnusefulenfoconss <= conshdlr->nusefulenfoconss));
3646 assert(set != NULL);
3647 assert(tree != NULL);
3648 assert(tree->nchildren == 0);
3649 assert(result != NULL);
3650
3651 /* no enforcing of pseudo solution */
3652 if( set->cons_disableenfops && SCIPbranchcandGetNPseudoCands(branchcand) > 0 )
3653 {
3654 *result = SCIP_INFEASIBLE;
3655 return SCIP_OKAY;
3656 }
3657
3658 *result = SCIP_FEASIBLE;
3659
3660 /* skip non-exact constraint handlers during exact solving mode */
3661 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
3662 if( set->exact_enable && !conshdlr->exact )
3663 return SCIP_OKAY;
3664
3665 if( conshdlr->consenfops != NULL )
3666 {
3667 int nconss;
3668 int nusefulconss;
3669 int firstcons;
3670 SCIP_Bool pschanged;
3671 SCIP_Bool lastinfeasible;
3672
3673 /* check, if this pseudo solution was already enforced at this node */
3674 if( !forced && conshdlr->lastenfopsdomchgcount == stat->domchgcount
3675 && conshdlr->lastenfopsnode == stat->nnodes
3676 && conshdlr->lastenfopsresult != SCIP_CONSADDED
3677 && conshdlr->lastenfopsresult != SCIP_SOLVELP
3678 )
3679 {
3680 assert(conshdlr->lastenfopsresult != SCIP_CUTOFF);
3681 assert(conshdlr->lastenfopsresult != SCIP_BRANCHED);
3682 assert(conshdlr->lastenfopsresult != SCIP_REDUCEDDOM);
3683 assert(conshdlr->lastenfopsresult != SCIP_DIDNOTRUN || objinfeasible);
3684
3685 /* if we already enforced the same pseudo solution at this node, we will only enforce new constraints in the
3686 * following; however, the result of the last call for the old constraint is still valid and we have to ensure
3687 * that an infeasibility in the last call is not lost because we only enforce new constraints
3688 */
3689 if( conshdlr->lastenfopsresult == SCIP_INFEASIBLE )
3690 {
3691 *result = SCIP_INFEASIBLE;
3692 lastinfeasible = TRUE;
3693 }
3694 else
3695 lastinfeasible = FALSE;
3696
3697 /* all constraints that were not yet enforced on the new LP solution must be useful constraints, which means,
3698 * that the new constraints are the last constraints of the useful ones
3699 */
3700 nconss = conshdlr->nusefulenfoconss - conshdlr->lastnusefulenfoconss;
3701 nusefulconss = nconss;
3702 firstcons = conshdlr->lastnusefulenfoconss;
3703 pschanged = FALSE;
3704 }
3705 else
3706 {
3707 /* on a new pseudo solution or a new node, we want to enforce all constraints */
3708 nconss = conshdlr->nenfoconss;
3709 nusefulconss = conshdlr->nusefulenfoconss;
3710 firstcons = 0;
3711 pschanged = TRUE;
3712 lastinfeasible = FALSE;
3713 }
3714 assert(firstcons >= 0);
3715 assert(firstcons + nconss <= conshdlr->nenfoconss);
3716 assert(nusefulconss <= nconss);
3717
3718 /* constraint handlers without constraints should only be called once */
3719 if( nconss > 0 || (!conshdlr->needscons && pschanged) )
3720 {
3721 SCIP_CONS** conss = NULL;
3722 SCIP_Longint oldndomchgs;
3723 SCIP_Longint oldnprobdomchgs;
3724
3725 SCIPsetDebugMsg(set, "enforcing constraints %d to %d of %d constraints of handler <%s> (%s pseudo solution, objinfeasible=%u)\n",
3726 firstcons, firstcons + nconss - 1, conshdlr->nenfoconss, conshdlr->name, pschanged ? "new" : "old", objinfeasible);
3727
3728 /* remember the number of processed constraints on the current pseudo solution */
3729 conshdlr->lastenfopsdomchgcount = stat->domchgcount;
3730 conshdlr->lastenfopsnode = stat->nnodes;
3731 conshdlr->lastnusefulenfoconss = conshdlr->nusefulenfoconss;
3732
3733 /* get the array of the constraints to be processed */
3734 if( conshdlr->needscons )
3735 {
3736 assert(conshdlr->enfoconss != NULL);
3737 conss = conshdlr->enfoconss + firstcons;
3738 }
3739
3740 oldndomchgs = stat->nboundchgs + stat->nholechgs;
3741 oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
3742
3743 /* check, if we want to use eager evaluation */
3744 if( (conshdlr->eagerfreq == 0 && conshdlr->nenfopscalls == 0)
3745 || (conshdlr->eagerfreq > 0 && conshdlr->nenfopscalls % conshdlr->eagerfreq == 0) )
3746 nusefulconss = nconss;
3747
3748 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3749 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3750 * external method; to avoid this, these changes will be buffered and processed after the method call
3751 */
3752 conshdlrDelayUpdates(conshdlr);
3753
3754 /* start timing */
3755 SCIPclockStart(conshdlr->enfopstime, set);
3756
3757 /* call external method */
3758 SCIP_CALL( conshdlr->consenfops(set->scip, conshdlr, conss, nconss, nusefulconss, solinfeasible, objinfeasible, result) );
3759 SCIPsetDebugMsg(set, " -> enforcing returned result <%d>\n", *result);
3760
3761 /* stop timing */
3762 SCIPclockStop(conshdlr->enfopstime, set);
3763
3764 /* perform the cached constraint updates */
3765 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3766
3767 /* update statistics */
3768 if( *result != SCIP_DIDNOTRUN )
3769 conshdlr->nenfopscalls++;
3770 else if( !objinfeasible )
3771 {
3772 SCIPerrorMessage("enforcing method of constraint handler <%s> for pseudo solutions was skipped, even though the solution was not objective-infeasible\n",
3773 conshdlr->name);
3774 conshdlr->lastenfopsresult = *result;
3775
3776 return SCIP_INVALIDRESULT;
3777 }
3778 /* A constraint handler might return SCIP_DIDNOTRUN and not check any constraints in case objinfeasible was
3779 * TRUE; we change the result pointer to SCIP_INFEASIBLE in this case.
3780 */
3781 else
3782 *result = SCIP_INFEASIBLE;
3783
3784 if( *result == SCIP_CUTOFF )
3785 conshdlr->ncutoffs++;
3786
3787 if( *result != SCIP_BRANCHED )
3788 {
3789 assert(tree->nchildren == 0);
3790
3791 /* update domain reductions; therefore remove the domain
3792 * reduction counts which were generated in probing mode */
3793 conshdlr->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
3794 conshdlr->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
3795 }
3796 else
3797 conshdlr->nchildren += tree->nchildren;
3798
3799 /* remember the result of the enforcement call */
3800 conshdlr->lastenfopsresult = *result;
3801
3802 /* evaluate result */
3803 if( *result != SCIP_CUTOFF
3804 && *result != SCIP_CONSADDED
3805 && *result != SCIP_REDUCEDDOM
3806 && *result != SCIP_BRANCHED
3807 && *result != SCIP_SOLVELP
3808 && *result != SCIP_INFEASIBLE
3809 && *result != SCIP_FEASIBLE
3810 && *result != SCIP_DIDNOTRUN )
3811 {
3812 SCIPerrorMessage("enforcing method of constraint handler <%s> for pseudo solutions returned invalid result <%d>\n",
3813 conshdlr->name, *result);
3814 return SCIP_INVALIDRESULT;
3815 }
3816
3817 /* if the same pseudo solution was already enforced at this node, we only enforced new constraints this time;
3818 * if the enfops call returns feasible now, the solution is only feasible w.r.t. the new constraints, if the
3819 * last call detected infeasibility for the old constraints, we have to change the result to infeasible
3820 */
3821 if( lastinfeasible && *result == SCIP_FEASIBLE )
3822 *result = SCIP_INFEASIBLE;
3823 }
3824 else if( objinfeasible )
3825 {
3826 /*
3827 * Even if nothing is enforced, the solution might still be infeasible due to violating lower bound.
3828 * Make sure the result is updated in this case as well.
3829 */
3830 *result = SCIP_INFEASIBLE;
3831 }
3832 }
3833
3834 return SCIP_OKAY;
3835}
3836
3837/** calls feasibility check method of constraint handler */
3839 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3840 BMS_BLKMEM* blkmem, /**< block memory */
3841 SCIP_SET* set, /**< global SCIP settings */
3842 SCIP_STAT* stat, /**< dynamic problem statistics */
3843 SCIP_SOL* sol, /**< primal CIP solution */
3844 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
3845 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
3846 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
3847 SCIP_Bool completely, /**< Should all violations be checked? */
3848 SCIP_RESULT* result /**< pointer to store the result of the callback method */
3849 )
3850{
3851 assert(conshdlr != NULL);
3852 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3853 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3854 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3855 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3856 assert(set != NULL);
3857 assert(result != NULL);
3858
3859 *result = SCIP_FEASIBLE;
3860
3861 /* skip non-exact constraint handlers during exact solving mode */
3862 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
3863 if( set->exact_enable && !conshdlr->exact )
3864 return SCIP_OKAY;
3865
3866 if( conshdlr->conscheck != NULL && (!conshdlr->needscons || conshdlr->ncheckconss > 0) )
3867 {
3868 SCIPsetDebugMsg(set, "checking %d constraints of handler <%s>\n", conshdlr->ncheckconss, conshdlr->name);
3869
3870 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3871 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3872 * external method; to avoid this, these changes will be buffered and processed after the method call
3873 */
3874 conshdlrDelayUpdates(conshdlr);
3875
3876 /* start timing */
3877 SCIPclockStart(conshdlr->checktime, set);
3878
3879 /* call external method */
3880 SCIP_CALL( conshdlr->conscheck(set->scip, conshdlr, conshdlr->checkconss, conshdlr->ncheckconss,
3881 sol, checkintegrality, checklprows, printreason, completely, result) );
3882 SCIPsetDebugMsg(set, " -> checking returned result <%d>\n", *result);
3883
3884 /* stop timing */
3885 SCIPclockStop(conshdlr->checktime, set);
3886
3887 /* update statistics */
3888 conshdlr->ncheckcalls++;
3889
3890 /* perform the cached constraint updates */
3891 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3892
3893 /* evaluate result */
3894 if( *result != SCIP_INFEASIBLE && *result != SCIP_FEASIBLE )
3895 {
3896 SCIPerrorMessage("feasibility check of constraint handler <%s> returned invalid result <%d>\n", conshdlr->name, *result);
3897 return SCIP_INVALIDRESULT;
3898 }
3899 }
3900
3901 return SCIP_OKAY;
3902}
3903
3904/** calls propagation method of constraint handler */
3906 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3907 BMS_BLKMEM* blkmem, /**< block memory */
3908 SCIP_SET* set, /**< global SCIP settings */
3909 SCIP_STAT* stat, /**< dynamic problem statistics */
3910 int depth, /**< depth of current node */
3911 SCIP_Bool fullpropagation, /**< should all constraints be propagated (or only new ones)? */
3912 SCIP_Bool execdelayed, /**< execute propagation method even if it is marked to be delayed */
3913 SCIP_Bool instrongbranching, /**< are we currently doing strong branching? */
3914 SCIP_PROPTIMING proptiming, /**< current point in the node solving process */
3915 SCIP_RESULT* result /**< pointer to store the result of the callback method */
3916 )
3917{
3918 assert(conshdlr != NULL);
3919 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3920 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3921 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3922 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3923 assert(stat != NULL);
3924 assert(conshdlr->lastpropdomchgcount != stat->domchgcount
3925 || (0 <= conshdlr->lastnusefulpropconss && conshdlr->lastnusefulpropconss <= conshdlr->nusefulpropconss));
3926 assert(set != NULL);
3927 assert(depth >= 0);
3928 assert(result != NULL);
3929
3930 *result = SCIP_DIDNOTRUN;
3931
3932 /* skip non-exact constraint handlers during exact solving mode */
3933 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
3934 if( set->exact_enable && !conshdlr->exact )
3935 return SCIP_OKAY;
3936
3937 if( conshdlr->consprop != NULL
3938 && (!conshdlr->needscons || conshdlr->npropconss > 0)
3939 && ((depth == 0 && conshdlr->propfreq == 0)
3940 || (conshdlr->propfreq > 0 && depth % conshdlr->propfreq == 0)
3941 || conshdlr->propwasdelayed) )
3942 {
3943 /* check, if propagation method should be delayed */
3944 if( !conshdlr->delayprop || execdelayed )
3945 {
3946 int nconss;
3947 int nusefulconss;
3948 int nmarkedpropconss;
3949 int firstcons;
3950
3951 /* check, if the current domains were already propagated */
3952 if( !fullpropagation && conshdlr->lastpropdomchgcount == stat->domchgcount && conshdlr->nmarkedpropconss == 0 )
3953 {
3954 /* all constraints that were not yet propagated on the new domains must be useful constraints, which means,
3955 * that the new constraints are the last constraints of the useful ones
3956 */
3957 nconss = conshdlr->nusefulpropconss - conshdlr->lastnusefulpropconss;
3958 nusefulconss = nconss;
3959 firstcons = conshdlr->lastnusefulpropconss;
3960 }
3961 else
3962 {
3963 /* on new domains, we want to propagate all constraints */
3964 nconss = conshdlr->npropconss;
3965 nusefulconss = conshdlr->nusefulpropconss;
3966 firstcons = 0;
3967 }
3968 assert(firstcons >= 0);
3969 assert(firstcons + nconss <= conshdlr->npropconss);
3970 assert(nusefulconss <= nconss);
3971
3972 nmarkedpropconss = conshdlr->nmarkedpropconss;
3973
3974 /* constraint handlers without constraints should only be called once */
3975 if( nconss > 0 || fullpropagation
3976 || (!conshdlr->needscons && conshdlr->lastpropdomchgcount != stat->domchgcount) )
3977 {
3978 SCIP_CONS** conss;
3979 SCIP_Longint oldndomchgs;
3980 SCIP_Longint oldnprobdomchgs;
3981 SCIP_Longint lastpropdomchgcount;
3982 int lastnusefulpropconss;
3983
3984 SCIPsetDebugMsg(set, "propagating constraints %d to %d of %d constraints of handler <%s> (%s pseudo solution, %d useful)\n",
3985 firstcons, firstcons + nconss - 1, conshdlr->npropconss, conshdlr->name,
3986 !fullpropagation && conshdlr->lastpropdomchgcount == stat->domchgcount ? "old" : "new", nusefulconss);
3987
3988 /* remember the number of processed constraints on the current domains */
3989 lastpropdomchgcount = stat->domchgcount;
3990 lastnusefulpropconss = conshdlr->nusefulpropconss;
3991
3992 /* get the array of the constraints to be processed */
3993 conss = nconss > 0 ? (conshdlr->propconss + firstcons) : NULL;
3994
3995 oldndomchgs = stat->nboundchgs + stat->nholechgs;
3996 oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
3997
3998 /* check, if we want to use eager evaluation */
3999 if( (conshdlr->eagerfreq == 0 && conshdlr->npropcalls == 0)
4000 || (conshdlr->eagerfreq > 0 && conshdlr->npropcalls % conshdlr->eagerfreq == 0) )
4001 nusefulconss = nconss;
4002
4003 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
4004 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
4005 * external method; to avoid this, these changes will be buffered and processed after the method call
4006 */
4007 conshdlrDelayUpdates(conshdlr);
4008 conshdlr->duringprop = TRUE;
4009
4010 /* start timing */
4011 if( instrongbranching )
4012 SCIPclockStart(conshdlr->sbproptime, set);
4013 else
4014 SCIPclockStart(conshdlr->proptime, set);
4015
4016 assert(nusefulconss <= nconss);
4017 assert(nmarkedpropconss <= nconss);
4018
4019 /* call external method */
4020 SCIP_CALL( conshdlr->consprop(set->scip, conshdlr, conss, nconss, nusefulconss, nmarkedpropconss, proptiming, result) );
4021 SCIPsetDebugMsg(set, " -> propagation returned result <%d>\n", *result);
4022
4023 /* stop timing */
4024 if( instrongbranching )
4025 SCIPclockStop(conshdlr->sbproptime, set);
4026 else
4027 SCIPclockStop(conshdlr->proptime, set);
4028
4029 /* perform the cached constraint updates */
4030 conshdlr->duringprop = FALSE;
4031 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
4032
4033 /* update statistics */
4034 if( *result != SCIP_DIDNOTRUN && *result != SCIP_DELAYED )
4035 {
4036 conshdlr->lastpropdomchgcount = lastpropdomchgcount;
4037 conshdlr->lastnusefulpropconss = MIN(conshdlr->nusefulpropconss, lastnusefulpropconss);
4038 conshdlr->npropcalls++;
4039 }
4040 else
4041 {
4042 assert(lastpropdomchgcount == stat->domchgcount);
4043 assert(lastnusefulpropconss == conshdlr->nusefulpropconss);
4044 }
4045 if( *result == SCIP_CUTOFF )
4046 conshdlr->ncutoffs++;
4047
4048 /* update domain reductions; therefore remove the domain
4049 * reduction counts which were generated in probing mode */
4050 conshdlr->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
4051 conshdlr->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
4052
4053 /* check result code of callback method */
4054 if( *result != SCIP_CUTOFF
4055 && *result != SCIP_REDUCEDDOM
4056 && *result != SCIP_DIDNOTFIND
4057 && *result != SCIP_DIDNOTRUN
4058 && *result != SCIP_DELAYED
4059 && *result != SCIP_DELAYNODE )
4060 {
4061 SCIPerrorMessage("propagation method of constraint handler <%s> returned invalid result <%d>\n",
4062 conshdlr->name, *result);
4063 return SCIP_INVALIDRESULT;
4064 }
4065 }
4066 }
4067 else
4068 {
4069 SCIPsetDebugMsg(set, "propagation method of constraint handler <%s> was delayed\n", conshdlr->name);
4070 *result = SCIP_DELAYED;
4071 }
4072
4073 /* remember whether propagation method was delayed */
4074 conshdlr->propwasdelayed = (*result == SCIP_DELAYED);
4075 }
4076
4077 return SCIP_OKAY;
4078}
4079
4080/** calls presolving method of constraint handler */
4082 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4083 BMS_BLKMEM* blkmem, /**< block memory */
4084 SCIP_SET* set, /**< global SCIP settings */
4085 SCIP_STAT* stat, /**< dynamic problem statistics */
4086 SCIP_PRESOLTIMING timing, /**< current presolving timing */
4087 int nrounds, /**< number of presolving rounds already done */
4088 int* nfixedvars, /**< pointer to total number of variables fixed of all presolvers */
4089 int* naggrvars, /**< pointer to total number of variables aggregated of all presolvers */
4090 int* nchgvartypes, /**< pointer to total number of variable type changes of all presolvers */
4091 int* nchgbds, /**< pointer to total number of variable bounds tightened of all presolvers */
4092 int* naddholes, /**< pointer to total number of domain holes added of all presolvers */
4093 int* ndelconss, /**< pointer to total number of deleted constraints of all presolvers */
4094 int* naddconss, /**< pointer to total number of added constraints of all presolvers */
4095 int* nupgdconss, /**< pointer to total number of upgraded constraints of all presolvers */
4096 int* nchgcoefs, /**< pointer to total number of changed coefficients of all presolvers */
4097 int* nchgsides, /**< pointer to total number of changed left/right hand sides of all presolvers */
4098 SCIP_RESULT* result /**< pointer to store the result of the callback method */
4099 )
4100{
4101 assert(conshdlr != NULL);
4102 assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
4103 assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
4104 assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
4105 assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
4106 assert(set != NULL);
4107 assert(nfixedvars != NULL);
4108 assert(naggrvars != NULL);
4109 assert(nchgvartypes != NULL);
4110 assert(nchgbds != NULL);
4111 assert(naddholes != NULL);
4112 assert(ndelconss != NULL);
4113 assert(naddconss != NULL);
4114 assert(nupgdconss != NULL);
4115 assert(nchgcoefs != NULL);
4116 assert(nchgsides != NULL);
4117 assert(result != NULL);
4118
4119 *result = SCIP_DIDNOTRUN;
4120
4121 /* skip non-exact constraint handlers during exact solving mode */
4122 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
4123 if( set->exact_enable && !conshdlr->exact )
4124 return SCIP_OKAY;
4125
4126 if( conshdlr->conspresol != NULL
4127 && (!conshdlr->needscons || conshdlr->nactiveconss > 0)
4128 && (conshdlr->maxprerounds == -1 || conshdlr->npresolcalls < conshdlr->maxprerounds ) )
4129 {
4130 SCIPsetDebugMsg(set, "presolving %d constraints of handler <%s>\n", conshdlr->nactiveconss, conshdlr->name);
4131
4132 /* check, if presolving method should be executed for the current timing */
4133 if( timing & conshdlr->presoltiming )
4134 {
4135 int nnewfixedvars;
4136 int nnewaggrvars;
4137 int nnewchgvartypes;
4138 int nnewchgbds;
4139 int nnewholes;
4140 int nnewdelconss;
4141 int nnewaddconss;
4142 int nnewupgdconss;
4143 int nnewchgcoefs;
4144 int nnewchgsides;
4145
4146 /* calculate the number of changes since last call */
4147 nnewfixedvars = *nfixedvars - conshdlr->lastnfixedvars;
4148 nnewaggrvars = *naggrvars - conshdlr->lastnaggrvars;
4149 nnewchgvartypes = *nchgvartypes - conshdlr->lastnchgvartypes;
4150 nnewchgbds = *nchgbds - conshdlr->lastnchgbds;
4151 nnewholes = *naddholes - conshdlr->lastnaddholes;
4152 nnewdelconss = *ndelconss - conshdlr->lastndelconss;
4153 nnewaddconss = *naddconss - conshdlr->lastnaddconss;
4154 nnewupgdconss = *nupgdconss - conshdlr->lastnupgdconss;
4155 nnewchgcoefs = *nchgcoefs - conshdlr->lastnchgcoefs;
4156 nnewchgsides = *nchgsides - conshdlr->lastnchgsides;
4157
4158 /* remember the old number of changes */
4159 conshdlr->lastnfixedvars = *nfixedvars;
4160 conshdlr->lastnaggrvars = *naggrvars;
4161 conshdlr->lastnchgvartypes = *nchgvartypes;
4162 conshdlr->lastnchgbds = *nchgbds;
4163 conshdlr->lastnaddholes = *naddholes;
4164 conshdlr->lastndelconss = *ndelconss;
4165 conshdlr->lastnaddconss = *naddconss;
4166 conshdlr->lastnupgdconss = *nupgdconss;
4167 conshdlr->lastnchgcoefs = *nchgcoefs;
4168 conshdlr->lastnchgsides = *nchgsides;
4169
4170 /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
4171 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
4172 * external method; to avoid this, these changes will be buffered and processed after the method call
4173 */
4174 conshdlrDelayUpdates(conshdlr);
4175
4176 /* start timing */
4177 SCIPclockStart(conshdlr->presoltime, set);
4178
4179 /* call external method */
4180 SCIP_CALL( conshdlr->conspresol(set->scip, conshdlr, conshdlr->conss, conshdlr->nactiveconss, nrounds, timing,
4181 nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewholes,
4182 nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides,
4183 nfixedvars, naggrvars, nchgvartypes, nchgbds, naddholes,
4184 ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides, result) );
4185
4186 /* stop timing */
4187 SCIPclockStop(conshdlr->presoltime, set);
4188
4189 /* perform the cached constraint updates */
4190 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
4191
4192 /* count the new changes */
4193 assert( *nfixedvars - conshdlr->lastnfixedvars >= 0 );
4194 assert( *naggrvars - conshdlr->lastnaggrvars >= 0 );
4195 assert( *nchgvartypes - conshdlr->lastnchgvartypes >= 0 );
4196 assert( *nchgbds - conshdlr->lastnchgbds >= 0 );
4197 assert( *naddholes - conshdlr->lastnaddholes >= 0 );
4198 assert( *ndelconss - conshdlr->lastndelconss >= 0 );
4199 assert( *naddconss - conshdlr->lastnaddconss >= 0 );
4200 assert( *nupgdconss - conshdlr->lastnupgdconss >= 0 );
4201 assert( *nchgcoefs - conshdlr->lastnchgcoefs >= 0 );
4202 assert( *nchgsides - conshdlr->lastnchgsides >= 0 );
4203
4204 conshdlr->nfixedvars += *nfixedvars - conshdlr->lastnfixedvars;
4205 conshdlr->naggrvars += *naggrvars - conshdlr->lastnaggrvars;
4206 conshdlr->nchgvartypes += *nchgvartypes - conshdlr->lastnchgvartypes;
4207 conshdlr->nchgbds += *nchgbds - conshdlr->lastnchgbds;
4208 conshdlr->naddholes += *naddholes - conshdlr->lastnaddholes;
4209 conshdlr->ndelconss += *ndelconss - conshdlr->lastndelconss;
4210 conshdlr->naddconss += *naddconss - conshdlr->lastnaddconss;
4211 conshdlr->nupgdconss += *nupgdconss - conshdlr->lastnupgdconss;
4212 conshdlr->nchgcoefs += *nchgcoefs - conshdlr->lastnchgcoefs;
4213 conshdlr->nchgsides += *nchgsides - conshdlr->lastnchgsides;
4214
4215 /* check result code of callback method */
4216 if( *result != SCIP_CUTOFF
4217 && *result != SCIP_UNBOUNDED
4218 && *result != SCIP_SUCCESS
4219 && *result != SCIP_DIDNOTFIND
4220 && *result != SCIP_DIDNOTRUN
4221 && *result != SCIP_DELAYED )
4222 {
4223 SCIPerrorMessage("presolving method of constraint handler <%s> returned invalid result <%d>\n",
4224 conshdlr->name, *result);
4225 return SCIP_INVALIDRESULT;
4226 }
4227
4228 /* increase the number of calls, if the presolving method tried to find reductions */
4229 if( *result != SCIP_DIDNOTRUN )
4230 ++(conshdlr->npresolcalls);
4231 }
4232
4233 SCIPsetDebugMsg(set, "after presolving %d constraints left of handler <%s>\n", conshdlr->nactiveconss, conshdlr->name);
4234 }
4235
4236 return SCIP_OKAY;
4237}
4238
4239/** calls variable deletion method of constraint handler */
4241 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4242 BMS_BLKMEM* blkmem, /**< block memory */
4243 SCIP_SET* set, /**< global SCIP settings */
4244 SCIP_STAT* stat /**< dynamic problem statistics */
4245 )
4246{
4247 assert(conshdlr != NULL);
4248 assert(set != NULL);
4249
4250 /* skip non-exact constraint handlers during exact solving mode */
4251 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
4252 if( set->exact_enable && !conshdlr->exact )
4253 return SCIP_OKAY;
4254
4255 if( conshdlr->consdelvars != NULL )
4256 {
4257 SCIPsetDebugMsg(set, "deleting variables in constraints of handler <%s>\n", conshdlr->name);
4258
4259 /* during constraint processing, constraints of this handler may be deleted, activated, deactivated,
4260 * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
4261 * external method; to avoid this, these changes will be buffered and processed after the method call
4262 */
4263 conshdlrDelayUpdates(conshdlr);
4264
4265 /* call external method */
4266 SCIP_CALL( conshdlr->consdelvars(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss) );
4267
4268 /* perform the cached constraint updates */
4269 SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
4270 }
4271
4272 return SCIP_OKAY;
4273}
4274
4275/** locks rounding of variables involved in the given constraint constraint handler that doesn't need constraints */
4277 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4278 SCIP_SET* set /**< global SCIP settings */
4279 )
4280{
4281 assert(conshdlr != NULL);
4282 assert(conshdlr->conslock != NULL);
4283 assert(!conshdlr->needscons);
4284
4285 /* skip non-exact constraint handlers during exact solving mode */
4286 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
4287 if( set->exact_enable && !conshdlr->exact )
4288 return SCIP_OKAY;
4289
4290 SCIP_CALL( conshdlr->conslock(set->scip, conshdlr, NULL, SCIP_LOCKTYPE_MODEL, +1, 0) );
4291
4292 return SCIP_OKAY;
4293}
4294
4295/** unlocks rounding of variables involved in the given constraint constraint handler that doesn't need constraints */
4297 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4298 SCIP_SET* set /**< global SCIP settings */
4299 )
4300{
4301 assert(conshdlr != NULL);
4302 assert(conshdlr->conslock != NULL);
4303 assert(!conshdlr->needscons);
4304
4305 /* skip non-exact constraint handlers during exact solving mode */
4306 assert(!set->exact_enable || conshdlr->exact || !conshdlr->needscons || conshdlr->nconss == 0);
4307 if( set->exact_enable && !conshdlr->exact )
4308 return SCIP_OKAY;
4309
4310 SCIP_CALL( conshdlr->conslock(set->scip, conshdlr, NULL, SCIP_LOCKTYPE_MODEL, -1, 0) );
4311
4312 return SCIP_OKAY;
4313}
4314
4315/** gets name of constraint handler */
4317 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4318 )
4319{
4320 assert(conshdlr != NULL);
4321
4322 return conshdlr->name;
4323}
4324
4325/** gets description of constraint handler */
4327 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4328 )
4329{
4330 assert(conshdlr != NULL);
4331
4332 return conshdlr->desc;
4333}
4334
4335/** gets user data of constraint handler */
4337 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4338 )
4339{
4340 assert(conshdlr != NULL);
4341
4342 return conshdlr->conshdlrdata;
4343}
4344
4345/** sets user data of constraint handler; user has to free old data in advance! */
4347 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4348 SCIP_CONSHDLRDATA* conshdlrdata /**< new constraint handler user data */
4349 )
4350{
4351 assert(conshdlr != NULL);
4352
4353 conshdlr->conshdlrdata = conshdlrdata;
4354}
4355
4356/** is constraint handler safe to use in exact solving mode? */
4358 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4359 )
4360{
4361 assert(conshdlr != NULL);
4362
4363 return conshdlr->exact;
4364}
4365
4366/** marks the constraint handler as safe to use in exact solving mode
4367 *
4368 * @note Constraint handlers that are not marked as exact are skipped during exact solving mode.
4369 */
4371 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4372 )
4373{
4374 assert(conshdlr != NULL);
4375
4376 conshdlr->exact = TRUE;
4377}
4378
4379/** sets all separation related callbacks of the constraint handler */
4381 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4382 SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */
4383 SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */
4384 int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */
4385 int sepapriority, /**< priority of the constraint handler for separation */
4386 SCIP_Bool delaysepa /**< should separation method be delayed, if other separators found cuts? */
4387 )
4388{
4389 assert(conshdlr != NULL);
4390
4391 assert(conssepalp != NULL || conssepasol != NULL || sepafreq == -1);
4392
4393 conshdlr->conssepalp = conssepalp;
4394 conshdlr->conssepasol = conssepasol;
4395 conshdlr->sepafreq = sepafreq;
4396 conshdlr->sepapriority = sepapriority;
4397 conshdlr->delaysepa = delaysepa;
4398}
4399
4400/** sets both the propagation callback and the propagation frequency of the constraint handler */
4402 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4403 SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */
4404 int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */
4405 SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */
4406 SCIP_PROPTIMING timingmask /**< positions in the node solving loop where propagators should be executed */
4407 )
4408{
4409 assert(conshdlr != NULL);
4410
4411 assert(consprop != NULL || propfreq == -1);
4412
4413 conshdlr->consprop = consprop;
4414 conshdlr->propfreq = propfreq;
4415 conshdlr->delayprop = delayprop;
4416 conshdlr->proptiming = timingmask;
4417}
4418
4419/** sets copy method of both the constraint handler and each associated constraint */
4421 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4422 SCIP_DECL_CONSENFORELAX ((*consenforelax)) /**< constraint copying method */
4423 )
4424{
4425 assert(conshdlr != NULL);
4426
4427 conshdlr->consenforelax = consenforelax;
4428}
4429
4430/** sets copy method of both the constraint handler and each associated constraint */
4432 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4433 SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */
4434 SCIP_DECL_CONSCOPY ((*conscopy)) /**< constraint copying method */
4435 )
4436{
4437 assert(conshdlr != NULL);
4438
4439 assert(!conshdlr->needscons || (conshdlrcopy == NULL) == (conscopy == NULL));
4440
4441 conshdlr->conshdlrcopy = conshdlrcopy;
4442 conshdlr->conscopy = conscopy;
4443}
4444
4445/** sets destructor method of constraint handler */
4447 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4448 SCIP_DECL_CONSFREE ((*consfree)) /**< destructor of constraint handler */
4449 )
4450{
4451 assert(conshdlr != NULL);
4452
4453 conshdlr->consfree = consfree;
4454}
4455
4456/** sets initialization method of constraint handler */
4458 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4459 SCIP_DECL_CONSINIT ((*consinit)) /**< initialize constraint handler */
4460 )
4461{
4462 assert(conshdlr != NULL);
4463
4464 conshdlr->consinit = consinit;
4465}
4466
4467/** sets deinitialization method of constraint handler */
4469 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4470 SCIP_DECL_CONSEXIT ((*consexit)) /**< deinitialize constraint handler */
4471 )
4472{
4473 assert(conshdlr != NULL);
4474
4475 conshdlr->consexit = consexit;
4476}
4477
4478/** sets solving process initialization method of constraint handler */
4480 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4481 SCIP_DECL_CONSINITSOL((*consinitsol)) /**< solving process initialization method of constraint handler */
4482 )
4483{
4484 assert(conshdlr != NULL);
4485
4486 conshdlr->consinitsol = consinitsol;
4487}
4488
4489/** sets solving process deinitialization method of constraint handler */
4491 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4492 SCIP_DECL_CONSEXITSOL ((*consexitsol)) /**< solving process deinitialization method of constraint handler */
4493 )
4494{
4495 assert(conshdlr != NULL);
4496
4497 conshdlr->consexitsol = consexitsol;
4498}
4499
4500/** sets preprocessing initialization method of constraint handler */
4502 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4503 SCIP_DECL_CONSINITPRE((*consinitpre)) /**< preprocessing initialization method of constraint handler */
4504 )
4505{
4506 assert(conshdlr != NULL);
4507
4508 conshdlr->consinitpre = consinitpre;
4509}
4510
4511/** sets preprocessing deinitialization method of constraint handler */
4513 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4514 SCIP_DECL_CONSEXITPRE((*consexitpre)) /**< preprocessing deinitialization method of constraint handler */
4515 )
4516{
4517 assert(conshdlr != NULL);
4518
4519 conshdlr->consexitpre = consexitpre;
4520}
4521
4522/** sets presolving method of constraint handler */
4524 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4525 SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method of constraint handler */
4526 int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */
4527 SCIP_PRESOLTIMING presoltiming /**< timing mask of the constraint handler's presolving method */
4528 )
4529{
4530 assert(conshdlr != NULL);
4531
4532 conshdlr->conspresol = conspresol;
4533 conshdlr->maxprerounds = maxprerounds;
4534
4535 /* the interface change from delay flags to timings cannot be recognized at compile time: Exit with an appropriate
4536 * error message
4537 */
4538 if( presoltiming < SCIP_PRESOLTIMING_FAST || presoltiming > SCIP_PRESOLTIMING_MAX )
4539 {
4540 SCIPmessagePrintError("ERROR: 'PRESOLDELAY'-flag no longer available since SCIP 3.2, use an appropriate "
4541 "'SCIP_PRESOLTIMING' for <%s> constraint handler instead.\n", conshdlr->name);
4542
4544 }
4545
4546 conshdlr->presoltiming = presoltiming;
4547
4548 return SCIP_OKAY;
4549}
4550
4551/** sets method of constraint handler to free specific constraint data */
4553 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4554 SCIP_DECL_CONSDELETE ((*consdelete)) /**< free specific constraint data */
4555 )
4556{
4557 assert(conshdlr != NULL);
4558
4559 conshdlr->consdelete = consdelete;
4560}
4561
4562/** sets method of constraint handler to transform constraint data into data belonging to the transformed problem */
4564 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4565 SCIP_DECL_CONSTRANS ((*constrans)) /**< transform constraint data into data belonging to the transformed problem */
4566 )
4567{
4568 assert(conshdlr != NULL);
4569
4570 conshdlr->constrans = constrans;
4571}
4572
4573/** sets method of constraint handler to initialize LP with relaxations of "initial" constraints */
4575 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4576 SCIP_DECL_CONSINITLP ((*consinitlp)) /**< initialize LP with relaxations of "initial" constraints */
4577 )
4578{
4579 assert(conshdlr != NULL);
4580
4581 conshdlr->consinitlp = consinitlp;
4582}
4583
4584/** sets propagation conflict resolving method of constraint handler */
4586 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4587 SCIP_DECL_CONSRESPROP ((*consresprop)) /**< propagation conflict resolving method */
4588 )
4589{
4590 assert(conshdlr != NULL);
4591
4592 conshdlr->consresprop = consresprop;
4593}
4594
4595/** sets activation notification method of constraint handler */
4597 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4598 SCIP_DECL_CONSACTIVE ((*consactive)) /**< activation notification method */
4599 )
4600{
4601 assert(conshdlr != NULL);
4602
4603 conshdlr->consactive = consactive;
4604}
4605
4606/** sets deactivation notification method of constraint handler */
4608 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4609 SCIP_DECL_CONSDEACTIVE((*consdeactive)) /**< deactivation notification method */
4610 )
4611{
4612 assert(conshdlr != NULL);
4613
4614 conshdlr->consdeactive = consdeactive;
4615}
4616
4617/** sets enabling notification method of constraint handler */
4619 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4620 SCIP_DECL_CONSENABLE ((*consenable)) /**< enabling notification method */
4621 )
4622{
4623 assert(conshdlr != NULL);
4624
4625 conshdlr->consenable = consenable;
4626}
4627
4628/** sets disabling notification method of constraint handler */
4630 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4631 SCIP_DECL_CONSDISABLE ((*consdisable)) /**< disabling notification method */
4632 )
4633{
4634 assert(conshdlr != NULL);
4635
4636 conshdlr->consdisable = consdisable;
4637}
4638
4639/** sets variable deletion method of constraint handler */
4641 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4642 SCIP_DECL_CONSDELVARS ((*consdelvars)) /**< variable deletion method */
4643 )
4644{
4645 assert(conshdlr != NULL);
4646
4647 conshdlr->consdelvars = consdelvars;
4648}
4649
4650/** sets constraint display method of constraint handler */
4652 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4653 SCIP_DECL_CONSPRINT ((*consprint)) /**< constraint display method */
4654 )
4655{
4656 assert(conshdlr != NULL);
4657
4658 conshdlr->consprint = consprint;
4659}
4660
4661/** sets constraint parsing method of constraint handler */
4663 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4664 SCIP_DECL_CONSPARSE ((*consparse)) /**< constraint parsing method */
4665 )
4666{
4667 assert(conshdlr != NULL);
4668
4669 conshdlr->consparse = consparse;
4670}
4671
4672/** sets constraint variable getter method of constraint handler */
4674 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4675 SCIP_DECL_CONSGETVARS ((*consgetvars)) /**< constraint variable getter method */
4676 )
4677{
4678 assert(conshdlr != NULL);
4679
4680 conshdlr->consgetvars = consgetvars;
4681}
4682
4683/** sets constraint variable number getter method of constraint handler */
4685 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4686 SCIP_DECL_CONSGETNVARS((*consgetnvars)) /**< constraint variable number getter method */
4687 )
4688{
4689 assert(conshdlr != NULL);
4690
4691 conshdlr->consgetnvars = consgetnvars;
4692}
4693
4694/** sets diving enforcement method of constraint handler */
4696 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4697 SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)) /**< constraint handler diving solution enforcement method */
4698 )
4699{
4700 assert(conshdlr != NULL);
4701
4702 conshdlr->consgetdivebdchgs = consgetdivebdchgs;
4703}
4704
4705/** sets permutation symmetry detection graph getter method of constraint handler */
4707 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4708 SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)) /**< constraint permutation symmetry detection graph
4709 * getter method */
4710 )
4711{
4712 assert(conshdlr != NULL);
4713
4714 conshdlr->consgetpermsymgraph = consgetpermsymgraph;
4715}
4716
4717/** sets signed permutation symmetry detection graph getter method of constraint handler */
4719 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4720 SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)) /**< constraint permutation symmetry detection
4721 * graph getter method */
4722 )
4723{
4724 assert(conshdlr != NULL);
4725
4726 conshdlr->consgetsignedpermsymgraph = consgetsignedpermsymgraph;
4727}
4728
4729/** gets array with constraints of constraint handler; the first SCIPconshdlrGetNActiveConss() entries are the active
4730 * constraints, the last SCIPconshdlrGetNConss() - SCIPconshdlrGetNActiveConss() constraints are deactivated
4731 *
4732 * @note A constraint is active if it is global and was not removed or it was added locally (in that case the local
4733 * flag is TRUE) and the current node belongs to the corresponding sub tree.
4734 */
4736 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4737 )
4738{
4739 assert(conshdlr != NULL);
4740
4741 return conshdlr->conss;
4742}
4743
4744/** gets array with enforced constraints of constraint handler; this is local information */
4746 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4747 )
4748{
4749 assert(conshdlr != NULL);
4750
4751 return conshdlr->enfoconss;
4752}
4753
4754/** gets array with checked constraints of constraint handler; this is local information */
4756 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4757 )
4758{
4759 assert(conshdlr != NULL);
4760
4761 return conshdlr->checkconss;
4762}
4763
4764/** gets array with delayed update constraints
4765 *
4766 * @attention Usually, there should be no need to access this array. Use this only if you are absolutely sure what you are doing.
4767 */
4769 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4770 )
4771{
4772 assert(conshdlr != NULL);
4773
4774 return conshdlr->updateconss;
4775}
4776
4777/** gets total number of existing transformed constraints of constraint handler */
4779 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4780 )
4781{
4782 assert(conshdlr != NULL);
4783
4784 return conshdlr->nconss;
4785}
4786
4787/** gets number of enforced constraints of constraint handler; this is local information */
4789 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4790 )
4791{
4792 assert(conshdlr != NULL);
4793
4794 return conshdlr->nenfoconss;
4795}
4796
4797/** gets number of checked constraints of constraint handler; this is local information */
4799 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4800 )
4801{
4802 assert(conshdlr != NULL);
4803
4804 return conshdlr->ncheckconss;
4805}
4806
4807/** gets number of active constraints of constraint handler
4808 *
4809 * @note A constraint is active if it is global and was not removed or it was added locally (in that case the local
4810 * flag is TRUE) and the current node belongs to the corresponding sub tree.
4811 */
4813 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4814 )
4815{
4816 assert(conshdlr != NULL);
4817
4818 return conshdlr->nactiveconss;
4819}
4820
4821/** gets number of enabled constraints of constraint handler */
4823 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4824 )
4825{
4826 assert(conshdlr != NULL);
4827
4828 return conshdlr->nenabledconss;
4829}
4830
4831/** gets number of constraints that have delayed updates */
4833 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4834 )
4835{
4836 assert(conshdlr != NULL);
4837
4838 return conshdlr->nupdateconss;
4839}
4840
4841/** enables or disables all clocks of \p conshdlr, depending on the value of the flag */
4843 SCIP_CONSHDLR* conshdlr, /**< the constraint handler for which all clocks should be enabled or disabled */
4844 SCIP_Bool enable /**< should the clocks of the constraint handler be enabled? */
4845 )
4846{
4847 assert(conshdlr != NULL);
4848
4849 SCIPclockEnableOrDisable(conshdlr->setuptime, enable);
4850 SCIPclockEnableOrDisable(conshdlr->checktime, enable);
4851 SCIPclockEnableOrDisable(conshdlr->enfolptime, enable);
4852 SCIPclockEnableOrDisable(conshdlr->enfopstime, enable);
4853 SCIPclockEnableOrDisable(conshdlr->enforelaxtime, enable);
4854 SCIPclockEnableOrDisable(conshdlr->presoltime, enable);
4855 SCIPclockEnableOrDisable(conshdlr->proptime, enable);
4856 SCIPclockEnableOrDisable(conshdlr->resproptime, enable);
4857 SCIPclockEnableOrDisable(conshdlr->sbproptime, enable);
4858 SCIPclockEnableOrDisable(conshdlr->sepatime, enable);
4859}
4860
4861/** gets time in seconds used for setting up this constraint handler for new stages */
4863 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4864 )
4865{
4866 assert(conshdlr != NULL);
4867
4868 return SCIPclockGetTime(conshdlr->setuptime);
4869}
4870
4871/** gets time in seconds used for presolving in this constraint handler */
4873 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4874 )
4875{
4876 assert(conshdlr != NULL);
4877
4878 return SCIPclockGetTime(conshdlr->presoltime);
4879}
4880
4881/** gets time in seconds used for separation in this constraint handler */
4883 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4884 )
4885{
4886 assert(conshdlr != NULL);
4887
4888 return SCIPclockGetTime(conshdlr->sepatime);
4889}
4890
4891/** gets time in seconds used for LP enforcement in this constraint handler */
4893 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4894 )
4895{
4896 assert(conshdlr != NULL);
4897
4898 return SCIPclockGetTime(conshdlr->enfolptime);
4899}
4900
4901/** gets time in seconds used for pseudo enforcement in this constraint handler */
4903 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4904 )
4905{
4906 assert(conshdlr != NULL);
4907
4908 return SCIPclockGetTime(conshdlr->enfopstime);
4909}
4910
4911/** gets time in seconds used for relaxation enforcement in this constraint handler */
4913 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4914 )
4915{
4916 assert(conshdlr != NULL);
4917
4918 return SCIPclockGetTime(conshdlr->enforelaxtime);
4919}
4920
4921/** gets time in seconds used for propagation in this constraint handler */
4923 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4924 )
4925{
4926 assert(conshdlr != NULL);
4927
4928 return SCIPclockGetTime(conshdlr->proptime);
4929}
4930
4931/** gets time in seconds used for propagation in this constraint handler during strong branching */
4933 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4934 )
4935{
4936 assert(conshdlr != NULL);
4937
4938 return SCIPclockGetTime(conshdlr->sbproptime);
4939}
4940
4941/** gets time in seconds used for feasibility checking in this constraint handler */
4943 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4944 )
4945{
4946 assert(conshdlr != NULL);
4947
4948 return SCIPclockGetTime(conshdlr->checktime);
4949}
4950
4951/** gets time in seconds used for resolving propagation in this constraint handler */
4953 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4954 )
4955{
4956 assert(conshdlr != NULL);
4957
4958 return SCIPclockGetTime(conshdlr->resproptime);
4959}
4960
4961/** gets number of calls to the constraint handler's separation method */
4963 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4964 )
4965{
4966 assert(conshdlr != NULL);
4967
4968 return conshdlr->nsepacalls;
4969}
4970
4971/** gets number of calls to the constraint handler's LP enforcing method */
4973 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4974 )
4975{
4976 assert(conshdlr != NULL);
4977
4978 return conshdlr->nenfolpcalls;
4979}
4980
4981/** gets number of calls to the constraint handler's pseudo enforcing method */
4983 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4984 )
4985{
4986 assert(conshdlr != NULL);
4987
4988 return conshdlr->nenfopscalls;
4989}
4990
4991/** gets number of calls to the constraint handler's relaxation enforcing method */
4993 SCIP_CONSHDLR* conshdlr /**< constraint handler */
4994 )
4995{
4996 assert(conshdlr != NULL);
4997
4998 return conshdlr->nenforelaxcalls;
4999}
5000
5001/** gets number of calls to the constraint handler's propagation method */
5003 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5004 )
5005{
5006 assert(conshdlr != NULL);
5007
5008 return conshdlr->npropcalls;
5009}
5010
5011/** gets number of calls to the constraint handler's checking method */
5013 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5014 )
5015{
5016 assert(conshdlr != NULL);
5017
5018 return conshdlr->ncheckcalls;
5019}
5020
5021/** gets number of calls to the constraint handler's resolve propagation method */
5023 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5024 )
5025{
5026 assert(conshdlr != NULL);
5027
5028 return conshdlr->nrespropcalls;
5029}
5030
5031/** gets total number of times, this constraint handler detected a cutoff */
5033 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5034 )
5035{
5036 assert(conshdlr != NULL);
5037
5038 return conshdlr->ncutoffs;
5039}
5040
5041/** gets total number of cuts found by this constraint handler */
5043 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5044 )
5045{
5046 assert(conshdlr != NULL);
5047
5048 return conshdlr->ncutsfound;
5049}
5050
5051/** gets total number of cuts found by this constraint handler applied to lp */
5053 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5054 )
5055{
5056 assert(conshdlr != NULL);
5057
5058 return conshdlr->ncutsapplied;
5059}
5060
5061/** increase count of applied cuts */
5063 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5064 )
5065{
5066 assert(conshdlr != NULL);
5067
5068 ++conshdlr->ncutsapplied;
5069}
5070
5071/** increase count of found cuts */
5073 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5074 )
5075{
5076 assert(conshdlr != NULL);
5077
5078 ++conshdlr->ncutsfound;
5079}
5080
5081/** gets total number of additional constraints added by this constraint handler */
5083 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5084 )
5085{
5086 assert(conshdlr != NULL);
5087
5088 return conshdlr->nconssfound;
5089}
5090
5091/** gets total number of domain reductions found by this constraint handler */
5093 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5094 )
5095{
5096 assert(conshdlr != NULL);
5097
5098 return conshdlr->ndomredsfound;
5099}
5100
5101/** gets number of children created by this constraint handler */
5103 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5104 )
5105{
5106 assert(conshdlr != NULL);
5107
5108 return conshdlr->nchildren;
5109}
5110
5111/** gets maximum number of active constraints of constraint handler existing at the same time */
5113 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5114 )
5115{
5116 assert(conshdlr != NULL);
5117
5118 return conshdlr->maxnactiveconss;
5119}
5120
5121/** gets initial number of active constraints of constraint handler */
5123 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5124 )
5125{
5126 assert(conshdlr != NULL);
5127
5128 return conshdlr->startnactiveconss;
5129}
5130
5131/** gets number of variables fixed in presolving method of constraint handler */
5133 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5134 )
5135{
5136 assert(conshdlr != NULL);
5137
5138 return conshdlr->nfixedvars;
5139}
5140
5141/** gets number of variables aggregated in presolving method of constraint handler */
5143 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5144 )
5145{
5146 assert(conshdlr != NULL);
5147
5148 return conshdlr->naggrvars;
5149}
5150
5151/** gets number of variable types changed in presolving method of constraint handler */
5153 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5154 )
5155{
5156 assert(conshdlr != NULL);
5157
5158 return conshdlr->nchgvartypes;
5159}
5160
5161/** gets number of bounds changed in presolving method of constraint handler */
5163 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5164 )
5165{
5166 assert(conshdlr != NULL);
5167
5168 return conshdlr->nchgbds;
5169}
5170
5171/** gets number of holes added to domains of variables in presolving method of constraint handler */
5173 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5174 )
5175{
5176 assert(conshdlr != NULL);
5177
5178 return conshdlr->naddholes;
5179}
5180
5181/** gets number of constraints deleted in presolving method of constraint handler */
5183 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5184 )
5185{
5186 assert(conshdlr != NULL);
5187
5188 return conshdlr->ndelconss;
5189}
5190
5191/** gets number of constraints added in presolving method of constraint handler */
5193 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5194 )
5195{
5196 assert(conshdlr != NULL);
5197
5198 return conshdlr->naddconss;
5199}
5200
5201/** gets number of constraints upgraded in presolving method of constraint handler */
5203 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5204 )
5205{
5206 assert(conshdlr != NULL);
5207
5208 return conshdlr->nupgdconss;
5209}
5210
5211/** gets number of coefficients changed in presolving method of constraint handler */
5213 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5214 )
5215{
5216 assert(conshdlr != NULL);
5217
5218 return conshdlr->nchgcoefs;
5219}
5220
5221/** gets number of constraint sides changed in presolving method of constraint handler */
5223 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5224 )
5225{
5226 assert(conshdlr != NULL);
5227
5228 return conshdlr->nchgsides;
5229}
5230
5231/** gets number of times the presolving method of the constraint handler was called and tried to find reductions */
5233 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5234 )
5235{
5236 assert(conshdlr != NULL);
5237
5238 return conshdlr->npresolcalls;
5239}
5240
5241/** gets separation priority of constraint handler */
5243 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5244 )
5245{
5246 assert(conshdlr != NULL);
5247
5248 return conshdlr->sepapriority;
5249}
5250
5251/** gets enforcing priority of constraint handler */
5253 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5254 )
5255{
5256 assert(conshdlr != NULL);
5257
5258 return conshdlr->enfopriority;
5259}
5260
5261/** gets checking priority of constraint handler */
5263 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5264 )
5265{
5266 assert(conshdlr != NULL);
5267
5268 return conshdlr->checkpriority;
5269}
5270
5271/** gets separation frequency of constraint handler */
5273 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5274 )
5275{
5276 assert(conshdlr != NULL);
5277
5278 return conshdlr->sepafreq;
5279}
5280
5281/** gets propagation frequency of constraint handler */
5283 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5284 )
5285{
5286 assert(conshdlr != NULL);
5287
5288 return conshdlr->propfreq;
5289}
5290
5291/** gets frequency of constraint handler for eager evaluations in separation, propagation and enforcement */
5293 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5294 )
5295{
5296 assert(conshdlr != NULL);
5297
5298 return conshdlr->eagerfreq;
5299}
5300
5301/** does the constraint handler need a constraint in order to be called? */
5303 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5304 )
5305{
5306 assert(conshdlr != NULL);
5307
5308 return conshdlr->needscons;
5309}
5310
5311/** sets the needscons flag of constraint handler, for example to disable without constraints */
5313 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5314 SCIP_Bool needscons /**< should be skipped, if no constraints are available? */
5315 )
5316{
5317 assert(conshdlr != NULL);
5318
5319 conshdlr->needscons = needscons;
5320}
5321
5322/** does the constraint handler perform presolving? */
5324 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5325 )
5326{
5327 assert(conshdlr != NULL);
5328
5329 return (conshdlr->conspresol != NULL);
5330}
5331
5332/** should separation method be delayed, if other separators found cuts? */
5334 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5335 )
5336{
5337 assert(conshdlr != NULL);
5338
5339 return conshdlr->delaysepa;
5340}
5341
5342/** should propagation method be delayed, if other propagators found reductions? */
5344 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5345 )
5346{
5347 assert(conshdlr != NULL);
5348
5349 return conshdlr->delayprop;
5350}
5351
5352/** was LP separation method delayed at the last call? */
5354 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5355 )
5356{
5357 assert(conshdlr != NULL);
5358
5359 return conshdlr->sepalpwasdelayed;
5360}
5361
5362/** was primal solution separation method delayed at the last call? */
5364 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5365 )
5366{
5367 assert(conshdlr != NULL);
5368
5369 return conshdlr->sepasolwasdelayed;
5370}
5371
5372/** was propagation method delayed at the last call? */
5374 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5375 )
5376{
5377 assert(conshdlr != NULL);
5378
5379 return conshdlr->propwasdelayed;
5380}
5381
5382/** is constraint handler initialized? */
5384 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5385 )
5386{
5387 assert(conshdlr != NULL);
5388
5389 return conshdlr->initialized;
5390}
5391
5392/** does the constraint handler have a copy function? */
5394 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5395 )
5396{
5397 assert(conshdlr != NULL);
5398
5399 return (conshdlr->conshdlrcopy != NULL);
5400}
5401
5402/** returns the timing mask of the propagation method of the constraint handler */
5404 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5405 )
5406{
5407 assert(conshdlr != NULL);
5408
5409 return conshdlr->proptiming;
5410}
5411
5412/** sets the timing mask of the propagation method of the constraint handler */
5414 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5415 SCIP_PROPTIMING proptiming /**< timing mask to be set */
5416 )
5417{
5418 assert(conshdlr != NULL);
5419
5420 conshdlr->proptiming = proptiming;
5421}
5422
5423
5424/** returns the timing mask of the presolving method of the constraint handler */
5426 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5427 )
5428{
5429 assert(conshdlr != NULL);
5430
5431 return conshdlr->presoltiming;
5432}
5433
5434/** sets the timing mask of the presolving method of the constraint handler */
5436 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
5437 SCIP_PRESOLTIMING presoltiming /** timing mask to be set */
5438 )
5439{
5440 assert(conshdlr != NULL);
5441
5442 conshdlr->presoltiming = presoltiming;
5443}
5444
5445/** returns whether conshdlr supports permutation symmetry detection */
5447 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5448 )
5449{
5450 assert(conshdlr != NULL);
5451
5452 return conshdlr->consgetpermsymgraph != NULL;
5453}
5454
5455/** returns whether conshdlr supports signed permutation symmetry detection */
5457 SCIP_CONSHDLR* conshdlr /**< constraint handler */
5458 )
5459{
5460 assert(conshdlr != NULL);
5461
5462 return conshdlr->consgetsignedpermsymgraph != NULL;
5463}
5464
5465/*
5466 * Constraint set change methods
5467 */
5468
5469/** creates empty constraint set change data */
5470static
5472 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data */
5473 BMS_BLKMEM* blkmem /**< block memory */
5474 )
5475{
5476 assert(conssetchg != NULL);
5477 assert(blkmem != NULL);
5478
5479 SCIP_ALLOC( BMSallocBlockMemory(blkmem, conssetchg) );
5480 (*conssetchg)->addedconss = NULL;
5481 (*conssetchg)->disabledconss = NULL;
5482 (*conssetchg)->addedconsssize = 0;
5483 (*conssetchg)->naddedconss = 0;
5484 (*conssetchg)->disabledconsssize = 0;
5485 (*conssetchg)->ndisabledconss = 0;
5486
5487 return SCIP_OKAY;
5488}
5489
5490/** releases all constraints of the constraint set change data */
5491static
5493 SCIP_CONSSETCHG* conssetchg, /**< constraint set change data */
5494 BMS_BLKMEM* blkmem, /**< block memory */
5495 SCIP_SET* set /**< global SCIP settings */
5496 )
5497{
5498 int i;
5499
5500 assert(conssetchg != NULL);
5501
5502 /* release constraints */
5503 for( i = 0; i < conssetchg->naddedconss; ++i )
5504 {
5505 if( conssetchg->addedconss[i] != NULL )
5506 {
5507 SCIP_CALL( SCIPconsRelease(&conssetchg->addedconss[i], blkmem, set) );
5508 }
5509 }
5510 for( i = 0; i < conssetchg->ndisabledconss; ++i )
5511 {
5512 if( conssetchg->disabledconss[i] != NULL )
5513 {
5514 SCIP_CALL( SCIPconsRelease(&conssetchg->disabledconss[i], blkmem, set) );
5515 }
5516 }
5517
5518 return SCIP_OKAY;
5519}
5520
5521/** frees constraint set change data and releases all included constraints */
5523 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change */
5524 BMS_BLKMEM* blkmem, /**< block memory */
5525 SCIP_SET* set /**< global SCIP settings */
5526 )
5527{
5528 assert(conssetchg != NULL);
5529 assert(blkmem != NULL);
5530
5531 if( *conssetchg != NULL )
5532 {
5533 /* release constraints */
5534 SCIP_CALL( conssetchgRelease(*conssetchg, blkmem, set) );
5535
5536 /* free memory */
5537 BMSfreeBlockMemoryArrayNull(blkmem, &(*conssetchg)->addedconss, (*conssetchg)->addedconsssize);
5538 BMSfreeBlockMemoryArrayNull(blkmem, &(*conssetchg)->disabledconss, (*conssetchg)->disabledconsssize);
5539 BMSfreeBlockMemory(blkmem, conssetchg);
5540 }
5541
5542 return SCIP_OKAY;
5543}
5544
5545/** ensures, that addedconss array can store at least num entries */
5546static
5548 SCIP_CONSSETCHG* conssetchg, /**< constraint set change data structure */
5549 BMS_BLKMEM* blkmem, /**< block memory */
5550 SCIP_SET* set, /**< global SCIP settings */
5551 int num /**< minimum number of entries to store */
5552 )
5553{
5554 assert(conssetchg != NULL);
5555
5556 if( num > conssetchg->addedconsssize )
5557 {
5558 int newsize;
5559
5560 newsize = SCIPsetCalcMemGrowSize(set, num);
5561 SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &conssetchg->addedconss, conssetchg->addedconsssize, newsize) );
5562 conssetchg->addedconsssize = newsize;
5563 }
5564 assert(num <= conssetchg->addedconsssize);
5565
5566 return SCIP_OKAY;
5567}
5568
5569/** ensures, that disabledconss array can store at least num entries */
5570static
5572 SCIP_CONSSETCHG* conssetchg, /**< constraint set change data structure */
5573 BMS_BLKMEM* blkmem, /**< block memory */
5574 SCIP_SET* set, /**< global SCIP settings */
5575 int num /**< minimum number of entries to store */
5576 )
5577{
5578 assert(conssetchg != NULL);
5579
5580 if( num > conssetchg->disabledconsssize )
5581 {
5582 int newsize;
5583
5584 newsize = SCIPsetCalcMemGrowSize(set, num);
5585 SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &conssetchg->disabledconss, conssetchg->disabledconsssize, newsize) );
5586 conssetchg->disabledconsssize = newsize;
5587 }
5588 assert(num <= conssetchg->disabledconsssize);
5589
5590 return SCIP_OKAY;
5591}
5592
5593/** adds constraint addition to constraint set changes, and captures constraint; activates constraint if the
5594 * constraint set change data is currently active
5595 */
5597 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data structure */
5598 BMS_BLKMEM* blkmem, /**< block memory */
5599 SCIP_SET* set, /**< global SCIP settings */
5600 SCIP_STAT* stat, /**< dynamic problem statistics */
5601 SCIP_CONS* cons, /**< added constraint */
5602 int depth, /**< depth of constraint set change's node */
5603 SCIP_Bool focusnode, /**< does the constraint set change belong to the focus node? */
5604 SCIP_Bool active /**< is the constraint set change currently active? */
5605 )
5606{
5607 assert(conssetchg != NULL);
5608 assert(cons != NULL);
5609
5610 /* if constraint set change doesn't exist, create it */
5611 if( *conssetchg == NULL )
5612 {
5613 SCIP_CALL( conssetchgCreate(conssetchg, blkmem) );
5614 }
5615
5616 /* add constraint to the addedconss array */
5617 SCIP_CALL( conssetchgEnsureAddedconssSize(*conssetchg, blkmem, set, (*conssetchg)->naddedconss+1) );
5618 (*conssetchg)->addedconss[(*conssetchg)->naddedconss] = cons;
5619 (*conssetchg)->naddedconss++;
5620
5621 /* undelete constraint, if it was globally deleted in the past */
5622 cons->deleted = FALSE;
5623
5624 /* capture constraint */
5625 SCIPconsCapture(cons);
5626
5627 /* activate constraint, if node is active */
5628 if( active && !SCIPconsIsActive(cons) )
5629 {
5630 SCIP_CALL( SCIPconsActivate(cons, set, stat, depth, focusnode) );
5631 assert(SCIPconsIsActive(cons));
5632
5633 /* remember, that this constraint set change data was responsible for the constraint's addition */
5634 cons->addconssetchg = *conssetchg;
5635 cons->addarraypos = (*conssetchg)->naddedconss-1;
5636 }
5637
5638 return SCIP_OKAY;
5639}
5640
5641/** adds constraint disabling to constraint set changes, and captures constraint */
5643 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data structure */
5644 BMS_BLKMEM* blkmem, /**< block memory */
5645 SCIP_SET* set, /**< global SCIP settings */
5646 SCIP_CONS* cons /**< disabled constraint */
5647 )
5648{
5649 assert(conssetchg != NULL);
5650 assert(cons != NULL);
5651
5652 /* if constraint set change doesn't exist, create it */
5653 if( *conssetchg == NULL )
5654 {
5655 SCIP_CALL( conssetchgCreate(conssetchg, blkmem) );
5656 }
5657
5658 /* add constraint to the disabledconss array */
5659 SCIP_CALL( conssetchgEnsureDisabledconssSize(*conssetchg, blkmem, set, (*conssetchg)->ndisabledconss+1) );
5660 (*conssetchg)->disabledconss[(*conssetchg)->ndisabledconss] = cons;
5661 (*conssetchg)->ndisabledconss++;
5662
5663 /* capture constraint */
5664 SCIPconsCapture(cons);
5665
5666 return SCIP_OKAY;
5667}
5668
5669/** deactivates, deletes, and releases constraint from the addedconss array of the constraint set change data */
5670static
5672 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to delete constraint from */
5673 BMS_BLKMEM* blkmem, /**< block memory */
5674 SCIP_SET* set, /**< global SCIP settings */
5675 int arraypos /**< position of constraint in disabledconss array */
5676 )
5677{
5678 SCIP_CONS* cons;
5679
5680 assert(conssetchg != NULL);
5681 assert(conssetchg->addedconss != NULL);
5682 assert(0 <= arraypos && arraypos < conssetchg->naddedconss);
5683
5684 cons = conssetchg->addedconss[arraypos];
5685 assert(cons != NULL);
5686
5687 SCIPsetDebugMsg(set, "delete added constraint <%s> at position %d from constraint set change data\n", cons->name, arraypos);
5688
5689 /* remove the link to the constraint set change data */
5690 if( cons->addconssetchg == conssetchg )
5691 {
5692 cons->addconssetchg = NULL;
5693 cons->addarraypos = -1;
5694 }
5695
5696 /* release constraint */
5697 SCIP_CALL( SCIPconsRelease(&conssetchg->addedconss[arraypos], blkmem, set) );
5698
5699 /* we want to keep the order of the constraint additions: move all subsequent constraints one slot to the front */
5700 for( ; arraypos < conssetchg->naddedconss-1; ++arraypos )
5701 {
5702 conssetchg->addedconss[arraypos] = conssetchg->addedconss[arraypos+1];
5703 assert(conssetchg->addedconss[arraypos] != NULL);
5704 if( conssetchg->addedconss[arraypos]->addconssetchg == conssetchg )
5705 {
5706 assert(conssetchg->addedconss[arraypos]->addarraypos == arraypos+1);
5707 conssetchg->addedconss[arraypos]->addarraypos = arraypos;
5708 }
5709 }
5710 conssetchg->naddedconss--;
5711
5712 return SCIP_OKAY;
5713}
5714
5715/** deletes and releases deactivated constraint from the disabledconss array of the constraint set change data */
5716static
5718 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to apply */
5719 BMS_BLKMEM* blkmem, /**< block memory */
5720 SCIP_SET* set, /**< global SCIP settings */
5721 int arraypos /**< position of constraint in disabledconss array */
5722 )
5723{
5724 assert(conssetchg != NULL);
5725 assert(0 <= arraypos && arraypos < conssetchg->ndisabledconss);
5726 assert(conssetchg->disabledconss[arraypos] != NULL);
5727
5728 SCIPsetDebugMsg(set, "delete disabled constraint <%s> at position %d from constraint set change data\n",
5729 conssetchg->disabledconss[arraypos]->name, arraypos);
5730
5731 /* release constraint */
5732 SCIP_CALL( SCIPconsRelease(&conssetchg->disabledconss[arraypos], blkmem, set) );
5733
5734 /* we want to keep the order of the constraint disablings: move all subsequent constraints one slot to the front */
5735 for( ; arraypos < conssetchg->ndisabledconss-1; ++arraypos )
5736 {
5737 conssetchg->disabledconss[arraypos] = conssetchg->disabledconss[arraypos+1];
5738 assert(conssetchg->disabledconss[arraypos] != NULL);
5739 }
5740 conssetchg->ndisabledconss--;
5741
5742 return SCIP_OKAY;
5743}
5744
5745/** gets added constraints data for a constraint set change */
5747 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to get data from */
5748 SCIP_CONS*** conss, /**< reference to constraints array added in the conssetchg, or NULL */
5749 int* nconss /**< reference to store the size of the constraints array, or NULL */
5750 )
5751{
5752 assert(conssetchg != NULL);
5753 if( conss != NULL )
5754 *conss = conssetchg->addedconss;
5755 if( nconss != NULL )
5756 *nconss = conssetchg->naddedconss;
5757}
5758
5759/** applies constraint set change */
5761 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to apply */
5762 BMS_BLKMEM* blkmem, /**< block memory */
5763 SCIP_SET* set, /**< global SCIP settings */
5764 SCIP_STAT* stat, /**< dynamic problem statistics */
5765 int depth, /**< depth of constraint set change's node */
5766 SCIP_Bool focusnode /**< does the constraint set change belong to the focus node? */
5767 )
5768{
5769 SCIP_CONS* cons;
5770 int i;
5771
5772 if( conssetchg == NULL )
5773 return SCIP_OKAY;
5774
5775 SCIPsetDebugMsg(set, "applying constraint set changes at %p: %d constraint additions, %d constraint disablings\n",
5776 (void*)conssetchg, conssetchg->naddedconss, conssetchg->ndisabledconss);
5777
5778 /* apply constraint additions */
5779 i = 0;
5780 while( i < conssetchg->naddedconss )
5781 {
5782 cons = conssetchg->addedconss[i];
5783 assert(cons != NULL);
5784 assert(!cons->update);
5785
5786 /* if constraint is already active, or if constraint is globally deleted, it can be removed from addedconss array */
5787 if( cons->active || cons->deleted )
5788 {
5789 /* delete constraint from addedcons array, the empty slot is now used by the next constraint,
5790 * and naddedconss was decreased, so do not increase i
5791 */
5792 SCIP_CALL( conssetchgDelAddedCons(conssetchg, blkmem, set, i) );
5793 }
5794 else
5795 {
5796 assert(cons->addconssetchg == NULL);
5797 assert(cons->addarraypos == -1);
5798
5799 /* activate constraint */
5800 SCIP_CALL( SCIPconsActivate(cons, set, stat, depth, focusnode) );
5801 assert(cons->active);
5802 assert(!cons->update);
5803
5804 /* remember, that this constraint set change data was responsible for the constraint's addition */
5805 cons->addconssetchg = conssetchg;
5806 cons->addarraypos = i;
5807
5808 ++i; /* handle the next constraint */
5809 }
5810 }
5811
5812 /* apply constraint disablings */
5813 i = 0;
5814 while( i < conssetchg->ndisabledconss )
5815 {
5816 cons = conssetchg->disabledconss[i];
5817 assert(cons != NULL);
5818 assert(!cons->update);
5819
5820 /* if the constraint is disabled, we can permanently remove it from the disabledconss array */
5821 if( !cons->enabled )
5822 {
5823 SCIPsetDebugMsg(set, "constraint <%s> of handler <%s> was deactivated -> remove it from disabledconss array\n",
5824 cons->name, cons->conshdlr->name);
5825
5826 /* release and remove constraint from the disabledconss array, the empty slot is now used by the next constraint
5827 * and ndisabledconss was decreased, so do not increase i
5828 */
5829 SCIP_CALL( conssetchgDelDisabledCons(conssetchg, blkmem, set, i) );
5830 }
5831 else
5832 {
5833 assert(cons->addarraypos >= 0);
5834 assert(!cons->deleted); /* deleted constraints must not be enabled! */
5835 SCIP_CALL( SCIPconsDisable(conssetchg->disabledconss[i], set, stat) );
5836 assert(!cons->update);
5837 assert(!cons->enabled);
5838
5839 ++i; /* handle the next constraint */
5840 }
5841 }
5842
5843 return SCIP_OKAY;
5844}
5845
5846/** undoes constraint set change */
5848 SCIP_CONSSETCHG* conssetchg, /**< constraint set change to undo */
5849 BMS_BLKMEM* blkmem, /**< block memory */
5850 SCIP_SET* set, /**< global SCIP settings */
5851 SCIP_STAT* stat /**< dynamic problem statistics */
5852 )
5853{
5854 SCIP_CONS* cons;
5855 int i;
5856
5857 if( conssetchg == NULL )
5858 return SCIP_OKAY;
5859
5860 SCIPsetDebugMsg(set, "undoing constraint set changes at %p: %d constraint additions, %d constraint disablings\n",
5861 (void*)conssetchg, conssetchg->naddedconss, conssetchg->ndisabledconss);
5862
5863 /* undo constraint disablings */
5864 for( i = conssetchg->ndisabledconss-1; i >= 0; --i )
5865 {
5866 cons = conssetchg->disabledconss[i];
5867 assert(cons != NULL);
5868 assert(!cons->update);
5869
5870 /* If the constraint is inactive, we can permanently remove it from the disabledconss array. It was deactivated
5871 * in the subtree of the current node but not reactivated on the switching way back to the current node, which
5872 * means, the deactivation was more global (i.e. valid on a higher level node) than the current node and the
5873 * disabling at the current node doesn't have any effect anymore.
5874 * If the constraint is already enabled, we need not to do anything. This may happen on a path A -> B,
5875 * if the constraint is disabled at node B, and while processing the subtree of B, it is also disabled at
5876 * the more global node A. Then on the switching path back to A, the constraint is enabled at node B (which is
5877 * actually wrong, since it now should be disabled in the whole subtree of A, but we cannot know this), and
5878 * again enabled at node A (where enabling is ignored). If afterwards, a subnode of B is processed, the
5879 * switching disables the constraint in node A, and the disabling is then removed from node B.
5880 */
5881 if( !cons->active )
5882 {
5883 SCIPsetDebugMsg(set, "constraint <%s> of handler <%s> was deactivated -> remove it from disabledconss array\n",
5884 cons->name, cons->conshdlr->name);
5885
5886 /* release and remove constraint from the disabledconss array */
5887 SCIP_CALL( conssetchgDelDisabledCons(conssetchg, blkmem, set, i) );
5888 }
5889 else if( !cons->enabled )
5890 {
5891 assert(cons->addarraypos >= 0);
5892 assert(!cons->deleted); /* deleted constraints must not be active! */
5893 SCIP_CALL( SCIPconsEnable(cons, set, stat) );
5894 assert(!cons->update);
5895 assert(!cons->active || cons->enabled);
5896 }
5897 }
5898
5899 /* undo constraint additions */
5900 for( i = conssetchg->naddedconss-1; i >= 0; --i )
5901 {
5902 cons = conssetchg->addedconss[i];
5903 assert(cons != NULL);
5904 assert(!cons->update);
5905
5906 /* If the constraint is already deactivated, we need not to do anything. This may happen on a path A -> B,
5907 * if the constraint is added at node B, and while processing the subtree of B, it is also added at
5908 * the more global node A. Then on the switching path back to A, the node is deactivated at node B (which is
5909 * actually wrong, since it now should be active in the whole subtree of A, but we cannot know this), and
5910 * again deactivated at node A (where deactivation is ignored). If afterwards, a subnode of B is processed, the
5911 * switching activates the constraint in node A, and the activation is then removed from node B.
5912 */
5913 if( cons->active )
5914 {
5915 assert(cons->addconssetchg == conssetchg);
5916 assert(cons->addarraypos == i);
5917
5918 /* deactivate constraint */
5919 SCIP_CALL( SCIPconsDeactivate(cons, set, stat) );
5920
5921 /* unlink the constraint and the constraint set change */
5922 cons->addconssetchg = NULL;
5923 cons->addarraypos = -1;
5924 }
5925 assert(!cons->active);
5926 assert(!cons->update);
5927 }
5928
5929 return SCIP_OKAY;
5930}
5931
5932/** applies constraint set change to the global problem and deletes the constraint set change data */
5934 SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data */
5935 BMS_BLKMEM* blkmem, /**< block memory */
5936 SCIP_SET* set, /**< global SCIP settings */
5937 SCIP_STAT* stat, /**< dynamic problem statistics */
5938 SCIP_PROB* prob, /**< problem data */
5939 SCIP_REOPT* reopt /**< reoptimization data */
5940 )
5941{
5942 SCIP_CONS* cons;
5943 int i;
5944
5945 assert(conssetchg != NULL);
5946
5947 /* nothing to do on empty constraint set change data */
5948 if( *conssetchg == NULL )
5949 return SCIP_OKAY;
5950
5951 SCIPsetDebugMsg(set, "moving constraint set changes at %p to global problem: %d constraint additions, %d constraint disablings\n",
5952 (void*)*conssetchg, (*conssetchg)->naddedconss, (*conssetchg)->ndisabledconss);
5953
5954 /* apply constraint additions to the global problem (loop backwards, because then conssetchgDelAddedCons() is
5955 * more efficient)
5956 */
5957 for( i = (*conssetchg)->naddedconss-1; i >= 0; --i )
5958 {
5959 cons = (*conssetchg)->addedconss[i];
5960 assert(cons != NULL);
5961 assert(!cons->update);
5962
5963 /* only move constraints that are not sticking at the current node */
5964 if( !SCIPconsIsStickingAtNode(cons) )
5965 {
5966 /* because we first have to delete the constraint, we have to capture it in order to not loose it */
5967 SCIPconsCapture(cons);
5968
5969 /* delete constraint addition from constraint set change data */
5970 SCIP_CALL( conssetchgDelAddedCons(*conssetchg, blkmem, set, i) );
5971
5972 /* don't move deleted constraints to the global problem */
5973 if( !cons->deleted )
5974 {
5975 SCIP_CALL( SCIPprobAddCons(prob, set, stat, cons) );
5976 }
5977
5978 /* release constraint */
5979 SCIP_CALL( SCIPconsRelease(&cons, blkmem, set) );
5980 }
5981 }
5982
5983 /* apply constraint disablings to the global problem (loop backwards, because then conssetchgDelDisabledCons() is
5984 * more efficient)
5985 */
5986 for( i = (*conssetchg)->ndisabledconss-1; i >= 0; --i )
5987 {
5988 cons = (*conssetchg)->disabledconss[i];
5989 assert(cons != NULL);
5990 assert(!cons->update);
5991
5992 /* only delete constraints that are not sticking at the current node */
5993 if( !SCIPconsIsStickingAtNode(cons) )
5994 {
5995 /* globally delete constraint */
5996 if( !cons->deleted )
5997 {
5998 SCIP_CALL( SCIPconsDelete(cons, blkmem, set, stat, prob, reopt) );
5999 }
6000
6001 /* release and remove constraint from the disabledconss array */
6002 SCIP_CALL( conssetchgDelDisabledCons(*conssetchg, blkmem, set, i) );
6003 }
6004 }
6005
6006 if( (*conssetchg)->naddedconss == 0 && (*conssetchg)->ndisabledconss == 0 )
6007 {
6008 /* free empty constraint set change data */
6009 SCIP_CALL( SCIPconssetchgFree(conssetchg, blkmem, set) );
6010 }
6011
6012 return SCIP_OKAY;
6013}
6014
6015
6016
6017
6018/*
6019 * Constraint methods
6020 */
6021
6022/** creates and captures a constraint, and inserts it into the conss array of its constraint handler
6023 *
6024 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution
6025 * may be declared feasible even if it violates this particular constraint.
6026 * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a
6027 * local constraint is redundant due to the variable's local bounds.
6028 */
6030 SCIP_CONS** cons, /**< pointer to constraint */
6031 BMS_BLKMEM* blkmem, /**< block memory */
6032 SCIP_SET* set, /**< global SCIP settings */
6033 const char* name, /**< name of constraint */
6034 SCIP_CONSHDLR* conshdlr, /**< constraint handler for this constraint */
6035 SCIP_CONSDATA* consdata, /**< data for this specific constraint */
6036 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
6037 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
6038 SCIP_Bool separate, /**< should the constraint be separated during LP processing?
6039 * Usually set to TRUE. */
6040 SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
6041 * TRUE for model constraints, FALSE for additional, redundant constraints. */
6042 SCIP_Bool check, /**< should the constraint be checked for feasibility?
6043 * TRUE for model constraints, FALSE for additional, redundant constraints. */
6044 SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
6045 * Usually set to TRUE. */
6046 SCIP_Bool local, /**< is constraint only valid locally?
6047 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
6048 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
6049 * Usually set to FALSE. In column generation applications, set to TRUE if pricing
6050 * adds coefficients to this constraint. */
6051 SCIP_Bool dynamic, /**< is constraint subject to aging?
6052 * Usually set to FALSE. Set to TRUE for own cuts which
6053 * are separated as constraints. */
6054 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
6055 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
6056 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
6057 * if it may be moved to a more global node?
6058 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
6059 SCIP_Bool original, /**< is constraint belonging to the original problem? */
6060 SCIP_Bool deleteconsdata /**< has the constraint data to be deleted if constraint is freed? */
6061 )
6062{
6063 int i;
6064
6065 assert(cons != NULL);
6066 assert(blkmem != NULL);
6067 assert(set != NULL);
6068 assert(name != NULL);
6069 assert(conshdlr != NULL);
6070 assert(!original || deleteconsdata);
6071
6072 /* create constraint data */
6073 SCIP_ALLOC( BMSallocBlockMemory(blkmem, cons) );
6074 SCIP_ALLOC( BMSduplicateBlockMemoryArray(blkmem, &(*cons)->name, name, strlen(name)+1) );
6075#ifndef NDEBUG
6076 (*cons)->scip = set->scip;
6077#endif
6078 (*cons)->conshdlr = conshdlr;
6079 (*cons)->consdata = consdata;
6080 (*cons)->transorigcons = NULL;
6081 (*cons)->addconssetchg = NULL;
6082 (*cons)->addarraypos = -1;
6083 (*cons)->consspos = -1;
6084 (*cons)->initconsspos = -1;
6085 (*cons)->sepaconsspos = -1;
6086 (*cons)->enfoconsspos = -1;
6087 (*cons)->checkconsspos = -1;
6088 (*cons)->propconsspos = -1;
6089 (*cons)->confconsspos = -1;
6090 (*cons)->activedepth = -2;
6091 (*cons)->validdepth = (local ? -1 : 0);
6092 (*cons)->age = 0.0;
6093 (*cons)->nuses = 0;
6094 (*cons)->nupgradelocks = 0;
6095 (*cons)->initial = initial;
6096 (*cons)->separate = separate;
6097 (*cons)->enforce = enforce;
6098 (*cons)->check = check;
6099 (*cons)->propagate = propagate;
6100 (*cons)->sepaenabled = separate;
6101 (*cons)->propenabled = propagate;
6102 (*cons)->local = local;
6103 (*cons)->modifiable = modifiable;
6104 (*cons)->dynamic = dynamic;
6105 (*cons)->removable = removable;
6106 (*cons)->stickingatnode = stickingatnode;
6107 (*cons)->original = original;
6108 (*cons)->deleteconsdata = deleteconsdata;
6109 (*cons)->active = FALSE;
6110 (*cons)->conflict = FALSE;
6111 (*cons)->enabled = FALSE;
6112 (*cons)->obsolete = FALSE;
6113 (*cons)->markpropagate = TRUE;
6114 (*cons)->deleted = FALSE;
6115 (*cons)->update = FALSE;
6116 (*cons)->updateinsert = FALSE;
6117 (*cons)->updateactivate = FALSE;
6118 (*cons)->updatedeactivate = FALSE;
6119 (*cons)->updateenable = FALSE;
6120 (*cons)->updatedisable = FALSE;
6121 (*cons)->updatesepaenable = FALSE;
6122 (*cons)->updatesepadisable = FALSE;
6123 (*cons)->updatepropenable = FALSE;
6124 (*cons)->updatepropdisable = FALSE;
6125 (*cons)->updateobsolete = FALSE;
6126 (*cons)->updatemarkpropagate = FALSE;
6127 (*cons)->updateunmarkpropagate = FALSE;
6128 (*cons)->updatefree = FALSE;
6129 (*cons)->updateactfocus = FALSE;
6130
6131 for( i = 0; i < NLOCKTYPES; i++ )
6132 {
6133 (*cons)->nlockspos[i] = 0;
6134 (*cons)->nlocksneg[i] = 0;
6135 }
6136
6137 /* capture constraint */
6138 SCIPconsCapture(*cons);
6139
6140 /* insert the constraint as inactive constraint into the transformed constraints array */
6141 if( !original )
6142 {
6143 /* check, if inserting constraint should be delayed */
6144 if( conshdlrAreUpdatesDelayed(conshdlr) )
6145 {
6146 SCIPsetDebugMsg(set, " -> delaying insertion of constraint <%s>\n", (*cons)->name);
6147 (*cons)->updateinsert = TRUE;
6148 SCIP_CALL( conshdlrAddUpdateCons((*cons)->conshdlr, set, *cons) );
6149 assert((*cons)->update);
6150 assert((*cons)->nuses == 2);
6151 }
6152 else
6153 {
6154 SCIP_CALL( conshdlrAddCons(conshdlr, set, *cons) );
6155 }
6156 }
6157
6158 checkConssArrays(conshdlr);
6159
6160 return SCIP_OKAY;
6161}
6162
6163/** copies source constraint of source SCIP into the target constraint for the target SCIP, using the variable map for
6164 * mapping the variables of the source SCIP to the variables of the target SCIP; if the copying process was successful
6165 * a constraint is created and captured;
6166 *
6167 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, an LP or pseudo solution
6168 * may be declared feasible even if it violates this particular constraint.
6169 * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a
6170 * local constraint is redundant due to the variable's local bounds.
6171 */
6173 SCIP_CONS** cons, /**< pointer to store the created target constraint */
6174 SCIP_SET* set, /**< global SCIP settings of the target SCIP */
6175 const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
6176 SCIP* sourcescip, /**< source SCIP data structure */
6177 SCIP_CONSHDLR* sourceconshdlr, /**< source constraint handler for this constraint */
6178 SCIP_CONS* sourcecons, /**< source constraint of the source SCIP */
6179 SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to corresponding
6180 * variables of the target SCIP */
6181 SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
6182 * target constraints, must not be NULL! */
6183 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? */
6184 SCIP_Bool separate, /**< should the constraint be separated during LP processing? */
6185 SCIP_Bool enforce, /**< should the constraint be enforced during node processing? */
6186 SCIP_Bool check, /**< should the constraint be checked for feasibility? */
6187 SCIP_Bool propagate, /**< should the constraint be propagated during node processing? */
6188 SCIP_Bool local, /**< is constraint only valid locally? */
6189 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? */
6190 SCIP_Bool dynamic, /**< is constraint subject to aging? */
6191 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
6192 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
6193 * if it may be moved to a more global node? */
6194 SCIP_Bool global, /**< create a global or a local copy? */
6195 SCIP_Bool* valid /**< pointer to store whether the copying was valid or not */
6196 )
6197{
6198 assert(cons != NULL);
6199 assert(set != NULL);
6200 assert(sourcescip != NULL);
6201 assert(sourceconshdlr != NULL);
6202 assert(sourcecons != NULL);
6203 assert(varmap != NULL);
6204 assert(consmap != NULL);
6205 assert(valid != NULL);
6206
6207 /* if constraint handler does not support copying, success will return false. Constraints handlers have to actively set this to true. */
6208 (*valid) = FALSE;
6209
6210 if( sourceconshdlr->conscopy != NULL )
6211 {
6212 SCIP_CALL( sourceconshdlr->conscopy(set->scip, cons, name, sourcescip, sourceconshdlr, sourcecons, varmap, consmap,
6213 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, global, valid) );
6214 }
6215
6216 return SCIP_OKAY;
6217}
6218
6219
6220/** parses constraint information (in cip format) out of a string; if the parsing process was successful a constraint is
6221 * created, captured, and inserted into the conss array of its constraint handler.
6222 *
6223 * @warning If a constraint is marked to be checked for feasibility but not to be enforced, an LP or pseudo solution
6224 * may be declared feasible even if it violates this particular constraint.
6225 * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a
6226 * local constraint is redundant due to the variable's local bounds.
6227 */
6229 SCIP_CONS** cons, /**< pointer to constraint */
6230 SCIP_SET* set, /**< global SCIP settings */
6231 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler of target SCIP */
6232 const char* str, /**< string to parse for constraint */
6233 SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
6234 * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
6235 SCIP_Bool separate, /**< should the constraint be separated during LP processing?
6236 * Usually set to TRUE. */
6237 SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
6238 * TRUE for model constraints, FALSE for additional, redundant constraints. */
6239 SCIP_Bool check, /**< should the constraint be checked for feasibility?
6240 * TRUE for model constraints, FALSE for additional, redundant constraints. */
6241 SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
6242 * Usually set to TRUE. */
6243 SCIP_Bool local, /**< is constraint only valid locally?
6244 * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
6245 SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
6246 * Usually set to FALSE. In column generation applications, set to TRUE if pricing
6247 * adds coefficients to this constraint. */
6248 SCIP_Bool dynamic, /**< is constraint subject to aging?
6249 * Usually set to FALSE. Set to TRUE for own cuts which
6250 * are separated as constraints. */
6251 SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
6252 * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
6253 SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
6254 * if it may be moved to a more global node?
6255 * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
6256 SCIP_Bool* success /**< pointer store if the paring process was successful */
6257 )
6258{
6259 SCIP_CONSHDLR* conshdlr;
6260 char conshdlrname[SCIP_MAXSTRLEN];
6261 char consname[SCIP_MAXSTRLEN];
6262 char* endptr;
6263
6264 assert(cons != NULL);
6265 assert(set != NULL);
6266
6267 (*success) = FALSE;
6268
6269 /* scan constraint handler name */
6270 assert(str != NULL);
6271 SCIPstrCopySection(str, '[', ']', conshdlrname, SCIP_MAXSTRLEN, &endptr);
6272 if( endptr == NULL || endptr == str )
6273 {
6274 SCIPmessagePrintWarning(messagehdlr, "Syntax error: Could not find constraint handler name.\n");
6275 return SCIP_OKAY;
6276 }
6277 assert(endptr != NULL);
6278
6279 /* allow parsing linear constraints exactly in exact solving mode */
6280 if( set->exact_enable )
6281 {
6282 /* linear to exactlinear */
6283 if( strcmp(conshdlrname, "linear") == 0 )
6284 strcpy(conshdlrname, "exactlinear");
6285 }
6286#ifdef SCIP_DISABLED_CODE
6287 /**@todo allow parsing exactlinear constraints approximately in real solving mode, but issue a warning message */
6288 else
6289 {
6290 /* exactlinear to linear */
6291 if( strcmp(conshdlrname, "exactlinear") == 0 )
6292 strcpy(conshdlrname, "linear");
6293 }
6294#endif
6295
6296 SCIPsetDebugMsg(set, "constraint handler name <%s>\n", conshdlrname);
6297
6298 /* scan constraint name */
6299 SCIPstrCopySection(endptr, '<', '>', consname, SCIP_MAXSTRLEN, &endptr);
6300 if( endptr == NULL || endptr == str )
6301 {
6302 SCIPmessagePrintWarning(messagehdlr, "Syntax error: Could not find constraint name.\n");
6303 return SCIP_OKAY;
6304 }
6305 assert(endptr != NULL);
6306 SCIPsetDebugMsg(set, "constraint name <%s>\n", consname);
6307
6308 str = endptr;
6309
6310 /* skip white space */
6311 SCIP_CALL( SCIPskipSpace((char**)&str) );
6312
6313 /* check for colon */
6314 if( *str != ':' )
6315 {
6316 SCIPmessagePrintWarning(messagehdlr, "Syntax error: Could not find colon ':' after constraint name.\n");
6317 return SCIP_OKAY;
6318 }
6319
6320 /* skip colon */
6321 ++str;
6322
6323 /* skip white space */
6324 SCIP_CALL( SCIPskipSpace((char**)&str) );
6325
6326 /* check if a constraint handler with parsed name exists */
6327 conshdlr = SCIPsetFindConshdlr(set, conshdlrname);
6328
6329 if( conshdlr == NULL )
6330 {
6331 SCIPmessagePrintWarning(messagehdlr, "constraint handler <%s> doesn't exist in SCIP data structure\n", conshdlrname);
6332 }
6333 else
6334 {
6335 assert( conshdlr != NULL );
6336 if ( conshdlr->consparse == NULL )
6337 {
6338 SCIPmessagePrintWarning(messagehdlr, "constraint handler <%s> does not support parsing constraints\n", conshdlrname);
6339 }
6340 else
6341 {
6342 SCIP_CALL( conshdlr->consparse(set->scip, conshdlr, cons, consname, str,
6343 initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, success) );
6344 }
6345 }
6346
6347 return SCIP_OKAY;
6348}
6349
6350/** change name of given constraint */
6352 SCIP_CONS* cons, /**< problem constraint */
6353 BMS_BLKMEM* blkmem, /**< block memory buffer */
6354 const char* name /**< new name of constraint */
6355 )
6356{
6357 assert(cons != NULL);
6358 assert(cons->name != NULL);
6359
6360 /* free old constraint name */
6361 BMSfreeBlockMemoryArray(blkmem, &cons->name, strlen(cons->name)+1);
6362
6363 /* copy new constraint name */
6364 SCIP_ALLOC( BMSduplicateBlockMemoryArray(blkmem, &cons->name, name, strlen(name)+1) );
6365
6366 return SCIP_OKAY;
6367}
6368
6369
6370/** frees a constraint and removes it from the conss array of its constraint handler */
6372 SCIP_CONS** cons, /**< constraint to free */
6373 BMS_BLKMEM* blkmem, /**< block memory buffer */
6374 SCIP_SET* set /**< global SCIP settings */
6375 )
6376{
6377 assert(cons != NULL);
6378 assert(*cons != NULL);
6379 assert((*cons)->conshdlr != NULL);
6380 assert((*cons)->nuses == 0);
6381 assert(!(*cons)->active);
6382 assert(!(*cons)->update);
6383 assert(!(*cons)->original || (*cons)->transorigcons == NULL);
6384 assert(blkmem != NULL);
6385 assert(set != NULL);
6386 assert((*cons)->scip == set->scip);
6387
6388 SCIPsetDebugMsg(set, "freeing constraint <%s> at conss pos %d of handler <%s>\n",
6389 (*cons)->name, (*cons)->consspos, (*cons)->conshdlr->name);
6390
6391 /* free constraint data */
6392 if( (*cons)->conshdlr->consdelete != NULL && (*cons)->consdata != NULL && (*cons)->deleteconsdata )
6393 {
6394 SCIP_CALL( (*cons)->conshdlr->consdelete(set->scip, (*cons)->conshdlr, *cons, &(*cons)->consdata) );
6395 }
6396 else if( !(*cons)->deleteconsdata )
6397 (*cons)->consdata = NULL;
6398 assert((*cons)->consdata == NULL);
6399
6400 /* unlink transformed and original constraint */
6401 if( (*cons)->transorigcons != NULL )
6402 {
6403 assert(!(*cons)->original);
6404 assert((*cons)->transorigcons->original);
6405 assert((*cons)->transorigcons->transorigcons == *cons);
6406
6407 (*cons)->transorigcons->transorigcons = NULL;
6408 }
6409
6410 /* remove constraint from the transformed constraints array */
6411 if( !(*cons)->original )
6412 {
6413 conshdlrDelCons((*cons)->conshdlr, *cons);
6414 checkConssArrays((*cons)->conshdlr);
6415 }
6416 assert((*cons)->consspos == -1);
6417 assert((*cons)->confconsspos == -1);
6418
6419 /* free constraint */
6420 BMSfreeBlockMemoryArray(blkmem, &(*cons)->name, strlen((*cons)->name)+1);
6421 BMSfreeBlockMemory(blkmem, cons);
6422
6423 return SCIP_OKAY;
6424}
6425
6426/** increases usage counter of constraint */
6428 SCIP_CONS* cons /**< constraint */
6429 )
6430{
6431 assert(cons != NULL);
6432 assert(cons->nuses >= 0);
6433
6434 SCIPdebugMessage("capture constraint <%s> with nuses=%d, cons pointer %p\n", cons->name, cons->nuses, (void*)cons);
6435 cons->nuses++;
6436}
6437
6438/** decreases usage counter of constraint, and frees memory if necessary */
6440 SCIP_CONS** cons, /**< pointer to constraint */
6441 BMS_BLKMEM* blkmem, /**< block memory */
6442 SCIP_SET* set /**< global SCIP settings */
6443 )
6444{
6445 assert(blkmem != NULL);
6446 assert(cons != NULL);
6447 assert(*cons != NULL);
6448 assert((*cons)->conshdlr != NULL);
6449 assert((*cons)->nuses >= 1);
6450 assert(set != NULL);
6451 assert((*cons)->scip == set->scip);
6452
6453 SCIPsetDebugMsg(set, "release constraint <%s> with nuses=%d, cons pointer %p\n", (*cons)->name, (*cons)->nuses, (void*)(*cons));
6454 (*cons)->nuses--;
6455 if( (*cons)->nuses == 0 )
6456 {
6457 assert(!(*cons)->active || (*cons)->updatedeactivate);
6458
6459 /* check, if freeing constraint should be delayed */
6460 if( conshdlrAreUpdatesDelayed((*cons)->conshdlr) )
6461 {
6462 SCIPsetDebugMsg(set, " -> delaying freeing constraint <%s>\n", (*cons)->name);
6463 (*cons)->updatefree = TRUE;
6464 SCIP_CALL( conshdlrAddUpdateCons((*cons)->conshdlr, set, *cons) );
6465 assert((*cons)->update);
6466 assert((*cons)->nuses == 1);
6467 }
6468 else
6469 {
6470 SCIP_CALL( SCIPconsFree(cons, blkmem, set) );
6471 }
6472 }
6473 *cons = NULL;
6474
6475 return SCIP_OKAY;
6476}
6477
6478/** outputs constraint information to file stream */
6480 SCIP_CONS* cons, /**< constraint to print */
6481 SCIP_SET* set, /**< global SCIP settings */
6482 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
6483 FILE* file /**< output file (or NULL for standard output) */
6484 )
6485{
6486 SCIP_CONSHDLR* conshdlr;
6487
6488 assert(cons != NULL);
6489 assert(set != NULL);
6490 assert(cons->scip == set->scip);
6491
6492 conshdlr = cons->conshdlr;
6493 assert(conshdlr != NULL);
6494
6495 SCIPmessageFPrintInfo(messagehdlr, file, " [%s] <%s>: ", conshdlr->name, cons->name);
6496
6497 if( conshdlr->consprint != NULL )
6498 {
6499 SCIP_CALL( conshdlr->consprint(set->scip, conshdlr, cons, file) );
6500 }
6501 else
6502 SCIPmessageFPrintInfo(messagehdlr, file, "constraint handler <%s> doesn't support printing constraint", conshdlr->name);
6503
6504 return SCIP_OKAY;
6505}
6506
6507/** method to collect the variables of a constraint
6508 *
6509 * If the number of variables is greater than the available slots in the variable array, nothing happens except that
6510 * the success point is set to FALSE. With the method SCIPconsGetNVars() it is possible to get the number of variables
6511 * a constraint has in its scope.
6512 *
6513 * @note The success pointer indicates if all variables were copied into the vars arrray.
6514 *
6515 * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is
6516 * set to FALSE.
6517 */
6519 SCIP_CONS* cons, /**< constraint to get variables for */
6520 SCIP_SET* set, /**< global SCIP settings */
6521 SCIP_VAR** vars, /**< array to store the involved variable of the constraint */
6522 int varssize, /**< available slots in vars array which is needed to check if the array is large enough */
6523 SCIP_Bool* success /**< pointer to store whether the variables are successfully copied */
6524 )
6525{
6526 SCIP_CONSHDLR* conshdlr;
6527
6528 assert(cons != NULL);
6529 assert(set != NULL);
6530 assert(cons->scip == set->scip);
6531
6532 conshdlr = cons->conshdlr;
6533 assert(conshdlr != NULL);
6534
6535 if( conshdlr->consgetvars != NULL )
6536 {
6537 SCIP_CALL( conshdlr->consgetvars(set->scip, conshdlr, cons, vars, varssize, success) );
6538 }
6539 else
6540 {
6541 (*success) = FALSE;
6542 }
6543
6544 return SCIP_OKAY;
6545}
6546
6547/** method to collect the number of variables of a constraint
6548 *
6549 * @note The success pointer indicates if the contraint handler was able to return the number of variables
6550 *
6551 * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is
6552 * set to FALSE
6553 */
6555 SCIP_CONS* cons, /**< constraint to get number of variables for */
6556 SCIP_SET* set, /**< global SCIP settings */
6557 int* nvars, /**< pointer to store the number of variables */
6558 SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the number of variables */
6559 )
6560{
6561 SCIP_CONSHDLR* conshdlr;
6562
6563 assert(cons != NULL);
6564 assert(set != NULL);
6565 assert(cons->scip == set->scip);
6566
6567 conshdlr = cons->conshdlr;
6568 assert(conshdlr != NULL);
6569
6570 if( conshdlr->consgetnvars != NULL )
6571 {
6572 SCIP_CALL( conshdlr->consgetnvars(set->scip, conshdlr, cons, nvars, success) );
6573 }
6574 else
6575 {
6576 (*nvars) = 0;
6577 (*success) = FALSE;
6578 }
6579
6580 return SCIP_OKAY;
6581}
6582
6583/** method to collect the permutation symmetry detection graph of a constraint
6584 *
6585 * @note The success pointer indicates whether the constraint handler was able to return the graph.
6586 *
6587 * @note If a constraint handler does not support this functionality, the success pointer is set to FALSE.
6588 */
6590 SCIP_CONS* cons, /**< constraint to get graph for */
6591 SCIP_SET* set, /**< global SCIP settings */
6592 SYM_GRAPH* graph, /**< symmetry detection graph */
6593 SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the graph */
6594 )
6595{
6596 SCIP_CONSHDLR* conshdlr;
6597
6598 assert(cons != NULL);
6599 assert(set != NULL);
6600 assert(cons->scip == set->scip);
6601 assert(success != NULL);
6602
6603 conshdlr = cons->conshdlr;
6604 assert(conshdlr != NULL);
6605
6606 if( conshdlr->consgetpermsymgraph != NULL )
6607 {
6608 SCIP_CALL( conshdlr->consgetpermsymgraph(set->scip, conshdlr, cons, graph, success) );
6609 }
6610 else
6611 *success = FALSE;
6612
6613 return SCIP_OKAY;
6614}
6615
6616/** method to collect the signed permutation symmetry detection graph of a constraint
6617 *
6618 * @note The success pointer indicates whether the constraint handler was able to return the graph.
6619 *
6620 * @note If a constraint handler does not support this functionality, the success pointer is set to FALSE.
6621 */
6623 SCIP_CONS* cons, /**< constraint to get graph for */
6624 SCIP_SET* set, /**< global SCIP settings */
6625 SYM_GRAPH* graph, /**< symmetry detection graph */
6626 SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the graph */
6627 )
6628{
6629 SCIP_CONSHDLR* conshdlr;
6630
6631 assert(cons != NULL);
6632 assert(set != NULL);
6633 assert(cons->scip == set->scip);
6634 assert(success != NULL);
6635
6636 conshdlr = cons->conshdlr;
6637 assert(conshdlr != NULL);
6638
6639 if( conshdlr->consgetsignedpermsymgraph != NULL )
6640 {
6641 SCIP_CALL( conshdlr->consgetsignedpermsymgraph(set->scip, conshdlr, cons, graph, success) );
6642 }
6643 else
6644 *success = FALSE;
6645
6646 return SCIP_OKAY;
6647}
6648
6649/** globally removes constraint from all subproblems; removes constraint from the constraint set change data of the
6650 * node, where it was created, or from the problem, if it was a problem constraint
6651 */
6653 SCIP_CONS* cons, /**< constraint to delete */
6654 BMS_BLKMEM* blkmem, /**< block memory */
6655 SCIP_SET* set, /**< global SCIP settings */
6656 SCIP_STAT* stat, /**< dynamic problem statistics */
6657 SCIP_PROB* prob, /**< problem data */
6658 SCIP_REOPT* reopt /**< reoptimization data */
6659 )
6660{
6661 assert(cons != NULL);
6662 assert(cons->conshdlr != NULL);
6663 assert(!cons->active || cons->updatedeactivate || cons->addarraypos >= 0);
6664 assert(set != NULL);
6665 assert(cons->scip == set->scip);
6666
6667 SCIPsetDebugMsg(set, "globally deleting constraint <%s> (delay updates: %d)\n",
6668 cons->name, cons->conshdlr->delayupdatecount);
6669
6670 /* mark constraint deleted */
6671 cons->deleted = TRUE;
6672
6673 /* deactivate constraint, if it is currently active */
6674 if( cons->active && !cons->updatedeactivate )
6675 {
6676 SCIP_CALL( SCIPconsDeactivate(cons, set, stat) );
6677 }
6678 else
6679 cons->updateactivate = FALSE;
6680
6681 if( set->reopt_enable && !SCIPreoptConsCanBeDeleted(reopt, cons) )
6682 return SCIP_OKAY;
6683
6684 assert(!cons->active || cons->updatedeactivate);
6685 assert(!cons->enabled || cons->updatedeactivate);
6686
6687 /* remove formerly active constraint from the conssetchg's addedconss / prob's conss array */
6688 if( cons->addarraypos >= 0 )
6689 {
6690 if( cons->addconssetchg == NULL )
6691 {
6692 /* remove problem constraint from the problem */
6693 SCIP_CALL( SCIPprobDelCons(prob, blkmem, set, stat, cons) );
6694 }
6695 else
6696 {
6697 assert(cons->addconssetchg->addedconss != NULL);
6698 assert(0 <= cons->addarraypos && cons->addarraypos < cons->addconssetchg->naddedconss);
6699 assert(cons->addconssetchg->addedconss[cons->addarraypos] == cons);
6700
6701 /* remove constraint from the constraint set change addedconss array */
6703 }
6704 }
6705
6706 return SCIP_OKAY;
6707}
6708
6709/** gets and captures transformed constraint of a given original constraint; if the constraint is not yet transformed,
6710 * a new transformed constraint for this constraint is created
6711 */
6713 SCIP_CONS* origcons, /**< original constraint */
6714 BMS_BLKMEM* blkmem, /**< block memory buffer */
6715 SCIP_SET* set, /**< global SCIP settings */
6716 SCIP_CONS** transcons /**< pointer to store the transformed constraint */
6717 )
6718{
6719 assert(origcons != NULL);
6720 assert(set != NULL);
6721 assert(origcons->scip == set->scip);
6722 assert(origcons->conshdlr != NULL);
6723 assert(origcons->original);
6724 assert(transcons != NULL);
6725
6726 /* check, if the constraint is already transformed */
6727 if( origcons->transorigcons != NULL )
6728 {
6729 *transcons = origcons->transorigcons;
6730 SCIPconsCapture(*transcons);
6731 }
6732 else
6733 {
6734 /* create transformed constraint */
6735 if( origcons->conshdlr->constrans != NULL )
6736 {
6737 /* use constraint handler's own method to transform constraint */
6738 SCIP_CALL( origcons->conshdlr->constrans(set->scip, origcons->conshdlr, origcons, transcons) );
6739 }
6740 else
6741 {
6742 /* create new constraint with a pointer copy of the constraint data */
6743 SCIP_CALL( SCIPconsCreate(transcons, blkmem, set, origcons->name, origcons->conshdlr, origcons->consdata, origcons->initial,
6744 origcons->separate, origcons->enforce, origcons->check, origcons->propagate,
6745 origcons->local, origcons->modifiable, origcons->dynamic, origcons->removable, origcons->stickingatnode,
6746 FALSE, FALSE) );
6747 }
6748
6749 /* link original and transformed constraint */
6750 origcons->transorigcons = *transcons;
6751 (*transcons)->transorigcons = origcons;
6752
6753 /* copy the number of upgradelocks */
6754 (*transcons)->nupgradelocks = origcons->nupgradelocks; /*lint !e732*/
6755 }
6756 assert(*transcons != NULL);
6757
6758 return SCIP_OKAY;
6759}
6760
6761/** sets the initial flag of the given constraint */
6763 SCIP_CONS* cons, /**< constraint */
6764 SCIP_SET* set, /**< global SCIP settings */
6765 SCIP_STAT* stat, /**< dynamic problem statistics */
6766 SCIP_Bool initial /**< new value */
6767 )
6768{
6769 assert(cons != NULL);
6770 assert(set != NULL);
6771 assert(cons->scip == set->scip);
6772
6773 if( cons->initial != initial )
6774 {
6775 cons->initial = initial;
6776 if( !cons->original )
6777 {
6778 if( cons->initial )
6779 {
6780 SCIP_CALL( conshdlrAddInitcons(SCIPconsGetHdlr(cons), set, stat, cons) );
6781 }
6782 else
6783 {
6784 if( cons->initconsspos >= 0 )
6785 {
6787 }
6788 }
6789 }
6790 }
6791
6792 return SCIP_OKAY;
6793}
6794
6795/** sets the separate flag of the given constraint */
6797 SCIP_CONS* cons, /**< constraint */
6798 SCIP_SET* set, /**< global SCIP settings */
6799 SCIP_Bool separate /**< new value */
6800 )
6801{
6802 assert(cons != NULL);
6803 assert(set != NULL);
6804 assert(cons->scip == set->scip);
6805
6806 if( cons->separate != separate )
6807 {
6809 {
6810 cons->separate = separate;
6811 }
6812 else if( cons->enabled && cons->sepaenabled )
6813 {
6814 if( separate )
6815 {
6816 cons->separate = separate;
6817 SCIP_CALL( conshdlrAddSepacons(cons->conshdlr, set, cons) );
6818 }
6819 else
6820 {
6821 conshdlrDelSepacons(cons->conshdlr, cons);
6822 cons->separate = separate;
6823 }
6824 }
6825 }
6826
6827 return SCIP_OKAY;
6828}
6829
6830/** sets the enforce flag of the given constraint */
6832 SCIP_CONS* cons, /**< constraint */
6833 SCIP_SET* set, /**< global SCIP settings */
6834 SCIP_Bool enforce /**< new value */
6835 )
6836{
6837 assert(cons != NULL);
6838 assert(set != NULL);
6839 assert(cons->scip == set->scip);
6840
6841 if( cons->enforce != enforce )
6842 {
6844 {
6845 cons->enforce = enforce;
6846 }
6847 else if( cons->enabled )
6848 {
6849 if( enforce )
6850 {
6851 cons->enforce = enforce;
6852 SCIP_CALL( conshdlrAddEnfocons(cons->conshdlr, set, cons) );
6853 }
6854 else
6855 {
6856 conshdlrDelEnfocons(cons->conshdlr, cons);
6857 cons->enforce = enforce;
6858 }
6859 }
6860 }
6861
6862 return SCIP_OKAY;
6863}
6864
6865/** sets the check flag of the given constraint */
6867 SCIP_CONS* cons, /**< constraint */
6868 SCIP_SET* set, /**< global SCIP settings */
6869 SCIP_Bool check /**< new value */
6870 )
6871{
6872 assert(cons != NULL);
6873 assert(set != NULL);
6874 assert(cons->scip == set->scip);
6875
6876 if( cons->check != check )
6877 {
6878 cons->check = check;
6879
6880 if( !cons->original )
6881 {
6882 /* if constraint is a problem constraint, update variable roundings locks */
6883 if( cons->addconssetchg == NULL && cons->addarraypos >= 0 )
6884 {
6885 if( cons->check )
6886 {
6888 }
6889 else
6890 {
6892 }
6893 }
6894
6895 /* if constraint is active, update the checkconss array of the constraint handler */
6896 if( cons->active )
6897 {
6898 if( cons->check )
6899 {
6900 SCIP_CALL( conshdlrAddCheckcons(cons->conshdlr, set, cons) );
6901 }
6902 else
6903 {
6904 conshdlrDelCheckcons(cons->conshdlr, cons);
6905 }
6906 }
6907 }
6908 }
6909
6910 return SCIP_OKAY;
6911}
6912
6913/** sets the propagate flag of the given constraint */
6915 SCIP_CONS* cons, /**< constraint */
6916 SCIP_SET* set, /**< global SCIP settings */
6917 SCIP_Bool propagate /**< new value */
6918 )
6919{
6920 assert(cons != NULL);
6921 assert(set != NULL);
6922 assert(cons->scip == set->scip);
6923
6924 if( cons->propagate != propagate )
6925 {
6927 {
6928 cons->propagate = propagate;
6929 }
6930 else if( cons->enabled && cons->propenabled )
6931 {
6932 if( propagate )
6933 {
6934 cons->propagate = propagate;
6935 SCIP_CALL( conshdlrAddPropcons(cons->conshdlr, set, cons) );
6936 }
6937 else
6938 {
6939 conshdlrDelPropcons(cons->conshdlr, cons);
6940 cons->propagate = propagate;
6941 }
6942 }
6943 }
6944
6945 return SCIP_OKAY;
6946}
6947
6948/** sets the local flag of the given constraint */
6950 SCIP_CONS* cons, /**< constraint */
6951 SCIP_Bool local /**< new value */
6952 )
6953{
6954 assert(cons != NULL);
6955
6956 cons->local = local;
6957 if( !local )
6958 cons->validdepth = 0;
6959}
6960
6961/** sets the modifiable flag of the given constraint */
6963 SCIP_CONS* cons, /**< constraint */
6964 SCIP_Bool modifiable /**< new value */
6965 )
6966{
6967 assert(cons != NULL);
6968
6969 cons->modifiable = modifiable;
6970}
6971
6972/** sets the dynamic flag of the given constraint */
6974 SCIP_CONS* cons, /**< constraint */
6975 SCIP_Bool dynamic /**< new value */
6976 )
6977{
6978 assert(cons != NULL);
6979
6980 cons->dynamic = dynamic;
6981}
6982
6983/** sets the removable flag of the given constraint */
6985 SCIP_CONS* cons, /**< constraint */
6986 SCIP_Bool removable /**< new value */
6987 )
6988{
6989 assert(cons != NULL);
6990
6991 cons->removable = removable;
6992}
6993
6994/** sets the stickingatnode flag of the given constraint */
6996 SCIP_CONS* cons, /**< constraint */
6997 SCIP_Bool stickingatnode /**< new value */
6998 )
6999{
7000 assert(cons != NULL);
7001
7002 cons->stickingatnode = stickingatnode;
7003}
7004
7005/** gives the constraint a new name; ATTENTION: to old pointer is over written that might
7006 * result in a memory leakage */
7008 SCIP_CONS* cons, /**< constraint */
7009 const char* name /**< new name of constraint */
7010 )
7011{
7012 assert( cons != NULL );
7013 assert( name != NULL );
7014
7015 cons->name = (char*)name;
7016}
7017
7018/** gets associated transformed constraint of an original constraint, or NULL if no associated transformed constraint
7019 * exists
7020 */
7022 SCIP_CONS* cons /**< constraint */
7023 )
7024{
7025 assert(cons->original);
7026
7027 return cons->transorigcons;
7028}
7029
7030/** activates constraint or marks constraint to be activated in next update */
7032 SCIP_CONS* cons, /**< constraint */
7033 SCIP_SET* set, /**< global SCIP settings */
7034 SCIP_STAT* stat, /**< dynamic problem statistics */
7035 int depth, /**< depth in the tree where the constraint activation takes place, or -1 for global problem */
7036 SCIP_Bool focusnode /**< does the constraint activation take place at the focus node? */
7037 )
7038{
7039 assert(cons != NULL);
7040 assert(!cons->original);
7041 assert(!cons->active);
7042 assert(!cons->updateactivate);
7043 assert(!cons->updatedeactivate);
7044 assert(!cons->updateenable);
7045 assert(!cons->updatedisable);
7046 assert(!cons->updateobsolete);
7047 assert(!cons->updatefree);
7048 assert(cons->activedepth == -2);
7049 assert(cons->conshdlr != NULL);
7050 assert(set != NULL);
7051 assert(cons->scip == set->scip);
7052
7054 {
7055 SCIPsetDebugMsg(set, "delayed activation of constraint <%s> in constraint handler <%s> (depth %d)\n",
7056 cons->name, cons->conshdlr->name, depth);
7057 cons->updateactivate = TRUE;
7058 cons->activedepth = depth;
7059 cons->updateactfocus = focusnode;
7061 assert(cons->update);
7062 }
7063 else
7064 {
7065 SCIP_CALL( conshdlrActivateCons(cons->conshdlr, set, stat, cons, depth, focusnode) );
7066 assert(cons->active);
7067 }
7068
7069 return SCIP_OKAY;
7070}
7071
7072/** deactivates constraint or marks constraint to be deactivated in next update */
7074 SCIP_CONS* cons, /**< constraint */
7075 SCIP_SET* set, /**< global SCIP settings */
7076 SCIP_STAT* stat /**< dynamic problem statistics */
7077 )
7078{
7079 assert(cons != NULL);
7080 assert(!cons->original);
7081 assert(cons->active);
7082 assert(!cons->updateactivate);
7083 assert(!cons->updatedeactivate);
7084 assert(cons->activedepth >= -1);
7085 assert(cons->conshdlr != NULL);
7086 assert(set != NULL);
7087 assert(cons->scip == set->scip);
7088
7090 {
7091 SCIPsetDebugMsg(set, "delayed deactivation of constraint <%s> in constraint handler <%s>\n",
7092 cons->name, cons->conshdlr->name);
7093 cons->updatedeactivate = TRUE;
7094 cons->activedepth = -2;
7096 assert(cons->update);
7097 }
7098 else
7099 {
7100 SCIP_CALL( conshdlrDeactivateCons(cons->conshdlr, set, stat, cons) );
7101 assert(!cons->active);
7102 }
7103
7104 return SCIP_OKAY;
7105}
7106
7107/** enables constraint's separation, enforcing, and propagation capabilities or marks them to be enabled in next update */
7109 SCIP_CONS* cons, /**< constraint */
7110 SCIP_SET* set, /**< global SCIP settings */
7111 SCIP_STAT* stat /**< dynamic problem statistics */
7112 )
7113{
7114 assert(cons != NULL);
7115 assert(!cons->original);
7116 assert(cons->conshdlr != NULL);
7117 assert(set != NULL);
7118 assert(cons->scip == set->scip);
7119
7120 if( !cons->active || cons->updatedeactivate || cons->updateenable || (cons->enabled && !cons->updatedisable) )
7121 return SCIP_OKAY;
7122
7123 assert(!cons->updateactivate);
7124
7126 {
7127 cons->updateenable = TRUE;
7129 assert(cons->update);
7130 }
7131 else
7132 {
7133 SCIP_CALL( conshdlrEnableCons(cons->conshdlr, set, stat, cons) );
7134 assert(cons->enabled);
7135 }
7136
7137 return SCIP_OKAY;
7138}
7139
7140/** disables constraint's separation, enforcing, and propagation capabilities or marks them to be disabled in next update */
7142 SCIP_CONS* cons, /**< constraint */
7143 SCIP_SET* set, /**< global SCIP settings */
7144 SCIP_STAT* stat /**< dynamic problem statistics */
7145 )
7146{
7147 assert(cons != NULL);
7148 assert(!cons->original);
7149 assert(cons->conshdlr != NULL);
7150 assert(set != NULL);
7151 assert(cons->scip == set->scip);
7152
7153 if( cons->updatedisable || (!cons->enabled && !cons->updateenable) )
7154 return SCIP_OKAY;
7155
7156 assert(cons->active);
7157 assert(!cons->updateactivate);
7158
7160 {
7161 cons->updatedisable = TRUE;
7163 assert(cons->update);
7164 }
7165 else
7166 {
7167 SCIP_CALL( conshdlrDisableCons(cons->conshdlr, set, stat, cons) );
7168 assert(!cons->enabled);
7169 }
7170
7171 return SCIP_OKAY;
7172}
7173
7174/** enables constraint's separation capabilities or marks them to be enabled in next update */
7176 SCIP_CONS* cons, /**< constraint */
7177 SCIP_SET* set /**< global SCIP settings */
7178 )
7179{
7180 assert(cons != NULL);
7181 assert(cons->conshdlr != NULL);
7182 assert(set != NULL);
7183 assert(cons->scip == set->scip);
7184
7185 if( cons->updatesepaenable || (cons->sepaenabled && !cons->updatesepadisable) )
7186 return SCIP_OKAY;
7187
7189 {
7190 cons->updatesepadisable = FALSE;
7191 cons->updatesepaenable = TRUE;
7193 assert(cons->update);
7194 }
7195 else
7196 {
7198 assert(cons->sepaenabled);
7199 }
7200
7201 return SCIP_OKAY;
7202}
7203
7204/** disables constraint's separation capabilities or marks them to be disabled in next update */
7206 SCIP_CONS* cons, /**< constraint */
7207 SCIP_SET* set /**< global SCIP settings */
7208 )
7209{
7210 assert(cons != NULL);
7211 assert(cons->conshdlr != NULL);
7212
7213 if( cons->updatesepadisable || (!cons->sepaenabled && !cons->updatesepaenable) )
7214 return SCIP_OKAY;
7215
7217 {
7218 cons->updatesepaenable = FALSE;
7219 cons->updatesepadisable = TRUE;
7221 assert(cons->update);
7222 }
7223 else
7224 {
7226 assert(!cons->sepaenabled);
7227 }
7228
7229 return SCIP_OKAY;
7230}
7231
7232/** enables constraint's propagation capabilities or marks them to be enabled in next update */
7234 SCIP_CONS* cons, /**< constraint */
7235 SCIP_SET* set /**< global SCIP settings */
7236 )
7237{
7238 assert(cons != NULL);
7239 assert(cons->conshdlr != NULL);
7240 assert(set != NULL);
7241 assert(cons->scip == set->scip);
7242
7243 if( cons->updatepropenable || (cons->propenabled && !cons->updatepropdisable) )
7244 return SCIP_OKAY;
7245
7247 {
7248 cons->updatepropdisable = FALSE;
7249 cons->updatepropenable = TRUE;
7251 assert(cons->update);
7252 }
7253 else
7254 {
7256 assert(cons->propenabled);
7257 }
7258
7259 return SCIP_OKAY;
7260}
7261
7262/** disables constraint's propagation capabilities or marks them to be disabled in next update */
7264 SCIP_CONS* cons, /**< constraint */
7265 SCIP_SET* set /**< global SCIP settings */
7266 )
7267{
7268 assert(cons != NULL);
7269 assert(cons->conshdlr != NULL);
7270 assert(set != NULL);
7271 assert(cons->scip == set->scip);
7272
7273 if( cons->updatepropdisable || (!cons->propenabled && !cons->updatepropenable) )
7274 return SCIP_OKAY;
7275
7277 {
7278 cons->updatepropenable = FALSE;
7279 cons->updatepropdisable = TRUE;
7281 assert(cons->update);
7282 }
7283 else
7284 {
7286 assert(!cons->propenabled);
7287 }
7288
7289 return SCIP_OKAY;
7290}
7291
7292/** marks the constraint to be a conflict */
7294 SCIP_CONS* cons /**< constraint */
7295 )
7296{
7297 assert(cons != NULL);
7298
7299 cons->conflict = TRUE;
7300
7301 return SCIP_OKAY;
7302}
7303
7304/** marks the constraint to be propagated (update might be delayed) */
7306 SCIP_CONS* cons, /**< constraint */
7307 SCIP_SET* set /**< global SCIP settings */
7308 )
7309{
7310 assert(cons != NULL);
7311 assert(cons->conshdlr != NULL);
7312 assert(set != NULL);
7313 assert(cons->scip == set->scip);
7314
7315 if( cons->updatemarkpropagate || (cons->markpropagate && !cons->updateunmarkpropagate) )
7316 return SCIP_OKAY;
7317
7319 {
7321 cons->updatemarkpropagate = TRUE;
7323 assert(cons->update);
7324 }
7325 else
7326 {
7328 assert(cons->markpropagate || !cons->enabled);
7329 }
7330
7331 return SCIP_OKAY;
7332}
7333
7334/** unmarks the constraint to be propagated (update might be delayed) */
7336 SCIP_CONS* cons, /**< constraint */
7337 SCIP_SET* set /**< global SCIP settings */
7338 )
7339{
7340 assert(cons != NULL);
7341 assert(cons->conshdlr != NULL);
7342 assert(set != NULL);
7343 assert(cons->scip == set->scip);
7344
7345 if( cons->updateunmarkpropagate || (!cons->markpropagate && !cons->updatemarkpropagate) )
7346 return SCIP_OKAY;
7347
7349 {
7350 cons->updatemarkpropagate = FALSE;
7353 assert(cons->update);
7354 }
7355 else
7356 {
7358 assert(!cons->markpropagate || !cons->enabled);
7359 }
7360
7361 return SCIP_OKAY;
7362}
7363
7364/** adds given value to age of constraint, but age can never become negative;
7365 * should be called
7366 * - in constraint separation, if no cut was found for this constraint,
7367 * - in constraint enforcing, if constraint was feasible, and
7368 * - in constraint propagation, if no domain reduction was deduced;
7369 * if it's age exceeds the constraint age limit, makes constraint obsolete or marks constraint to be made obsolete
7370 * in next update
7371 */
7373 SCIP_CONS* cons, /**< constraint */
7374 BMS_BLKMEM* blkmem, /**< block memory */
7375 SCIP_SET* set, /**< global SCIP settings */
7376 SCIP_STAT* stat, /**< dynamic problem statistics */
7377 SCIP_PROB* prob, /**< problem data */
7378 SCIP_Real deltaage, /**< value to add to the constraint's age */
7379 SCIP_REOPT* reopt /**< reoptimization data */
7380 )
7381{
7382 assert(cons != NULL);
7383 assert(cons->conshdlr != NULL);
7384 assert(!cons->updateactivate);
7385 assert(set != NULL);
7386 assert(cons->scip == set->scip);
7387
7388 /* no aging in presolving */
7389 if( set->stage == SCIP_STAGE_PRESOLVING )
7390 return SCIP_OKAY;
7391
7392 SCIPsetDebugMsg(set, "adding %g to age (%g) of constraint <%s> of handler <%s>\n",
7393 deltaage, cons->age, cons->name, cons->conshdlr->name);
7394
7395 cons->age += deltaage;
7396 cons->age = MAX(cons->age, 0.0);
7397
7398 if( !cons->original )
7399 {
7400 if( !cons->check && consExceedsAgelimit(cons, set) )
7401 {
7402 SCIP_CALL( SCIPconsDelete(cons, blkmem, set, stat, prob, reopt) );
7403 }
7404 else if( !cons->obsolete && consExceedsObsoleteage(cons, set) )
7405 {
7407 {
7408 cons->updateobsolete = TRUE;
7410 assert(cons->update);
7411 }
7412 else
7413 {
7415 assert(cons->obsolete);
7416 }
7417 }
7418 }
7419
7420 return SCIP_OKAY;
7421}
7422
7423/** increases age of constraint by 1.0;
7424 * should be called
7425 * - in constraint separation, if no cut was found for this constraint,
7426 * - in constraint enforcing, if constraint was feasible, and
7427 * - in constraint propagation, if no domain reduction was deduced;
7428 * if it's age exceeds the constraint age limit, makes constraint obsolete or marks constraint to be made obsolete
7429 * in next update
7430 */
7432 SCIP_CONS* cons, /**< constraint */
7433 BMS_BLKMEM* blkmem, /**< block memory */
7434 SCIP_SET* set, /**< global SCIP settings */
7435 SCIP_STAT* stat, /**< dynamic problem statistics */
7436 SCIP_PROB* prob, /**< problem data */
7437 SCIP_REOPT* reopt /**< reoptimization data */
7438 )
7439{
7440 SCIP_CALL( SCIPconsAddAge(cons, blkmem, set, stat, prob, 1.0, reopt) );
7441
7442 return SCIP_OKAY;
7443}
7444
7445/** resets age of constraint to zero;
7446 * should be called
7447 * - in constraint separation, if a cut was found for this constraint,
7448 * - in constraint enforcing, if the constraint was violated, and
7449 * - in constraint propagation, if a domain reduction was deduced;
7450 * if it was obsolete, makes constraint useful again or marks constraint to be made useful again in next update
7451 */
7453 SCIP_CONS* cons, /**< constraint */
7454 SCIP_SET* set /**< global SCIP settings */
7455 )
7456{
7457 assert(cons != NULL);
7458 assert(cons->conshdlr != NULL);
7459 assert(!cons->updateactivate);
7460 assert(set != NULL);
7461 assert(cons->scip == set->scip);
7462
7463 SCIPsetDebugMsg(set, "resetting age %g of constraint <%s> of handler <%s>\n", cons->age, cons->name, cons->conshdlr->name);
7464
7466 cons->age = 0.0;
7467
7468 if( cons->obsolete )
7469 {
7470 assert(!cons->original);
7472 {
7473 cons->updateobsolete = TRUE;
7475 assert(cons->update);
7476 }
7477 else
7478 {
7480 assert(!cons->obsolete);
7481 }
7482 }
7483
7484 return SCIP_OKAY;
7485}
7486
7487/** resolves the given conflicting bound, that was deduced by the given constraint, by putting all "reason" bounds
7488 * leading to the deduction into the conflict queue with calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(),
7489 * SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or SCIPaddConflictBinvar();
7490 *
7491 * @note it is sufficient to explain the relaxed bound change
7492 */
7494 SCIP_CONS* cons, /**< constraint that deduced the assignment */
7495 SCIP_SET* set, /**< global SCIP settings */
7496 SCIP_VAR* infervar, /**< variable whose bound was deduced by the constraint */
7497 int inferinfo, /**< user inference information attached to the bound change */
7498 SCIP_BOUNDTYPE inferboundtype, /**< bound that was deduced (lower or upper bound) */
7499 SCIP_BDCHGIDX* bdchgidx, /**< bound change index, representing the point of time where change took place */
7500 SCIP_Real relaxedbd, /**< the relaxed bound */
7501 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7502 )
7503{
7504 SCIP_CONSHDLR* conshdlr;
7505
7506 assert(set != NULL);
7507 assert(cons != NULL);
7508 assert((inferboundtype == SCIP_BOUNDTYPE_LOWER
7509 && SCIPgetVarLbAtIndex(set->scip, infervar, bdchgidx, TRUE) > SCIPvarGetLbGlobal(infervar))
7510 || (inferboundtype == SCIP_BOUNDTYPE_UPPER
7511 && SCIPgetVarUbAtIndex(set->scip, infervar, bdchgidx, TRUE) < SCIPvarGetUbGlobal(infervar)));
7512 assert(result != NULL);
7513 assert(cons->scip == set->scip);
7514
7515 *result = SCIP_DIDNOTRUN;
7516
7517 conshdlr = cons->conshdlr;
7518 assert(conshdlr != NULL);
7519
7520 if( conshdlr->consresprop != NULL )
7521 {
7522 /* start timing */
7523 SCIPclockStart(conshdlr->resproptime, set);
7524
7525 SCIP_CALL( conshdlr->consresprop(set->scip, conshdlr, cons, infervar, inferinfo, inferboundtype, bdchgidx,
7526 relaxedbd, result) );
7527
7528 /* stop timing */
7529 SCIPclockStop(conshdlr->resproptime, set);
7530
7531 /* update statistics */
7532 conshdlr->nrespropcalls++;
7533
7534 /* check result code */
7535 if( *result != SCIP_SUCCESS && *result != SCIP_DIDNOTFIND )
7536 {
7537 SCIPerrorMessage("propagation conflict resolving method of constraint handler <%s> returned invalid result <%d>\n",
7538 conshdlr->name, *result);
7539 return SCIP_INVALIDRESULT;
7540 }
7541 }
7542 else
7543 {
7544 SCIPerrorMessage("propagation conflict resolving method of constraint handler <%s> is not implemented\n",
7545 conshdlr->name);
7546 return SCIP_PLUGINNOTFOUND;
7547 }
7548
7549 return SCIP_OKAY;
7550}
7551
7552/** adds given values to lock status of the constraint and updates the locks of the given locktype of the involved variables */
7554 SCIP_CONS* cons, /**< constraint */
7555 SCIP_SET* set, /**< global SCIP settings */
7556 SCIP_LOCKTYPE locktype, /**< type of variable locks */
7557 int nlockspos, /**< increase in number of rounding locks for constraint */
7558 int nlocksneg /**< increase in number of rounding locks for constraint's negation */
7559 )
7560{
7561 int oldnlockspos;
7562 int oldnlocksneg;
7563 int updlockpos;
7564 int updlockneg;
7565
7566 assert(cons != NULL);
7567 assert(cons->conshdlr != NULL);
7568 assert(cons->conshdlr->conslock != NULL);
7569 assert((int)locktype >= 0 && (int)locktype < (int)NLOCKTYPES); /*lint !e685 !e568 !e587 !e650*/
7570 assert(cons->nlockspos[locktype] >= 0);
7571 assert(cons->nlocksneg[locktype] >= 0);
7572 assert(-2 <= nlockspos && nlockspos <= 2);
7573 assert(-2 <= nlocksneg && nlocksneg <= 2);
7574 assert(set != NULL);
7575 assert(cons->scip == set->scip);
7576
7577 /* update the rounding locks */
7578 oldnlockspos = cons->nlockspos[locktype];
7579 oldnlocksneg = cons->nlocksneg[locktype];
7580 cons->nlockspos[locktype] += nlockspos;
7581 cons->nlocksneg[locktype] += nlocksneg;
7582 assert(cons->nlockspos[locktype] >= 0);
7583 assert(cons->nlocksneg[locktype] >= 0);
7584
7585 /* check, if the constraint switched from unlocked to locked, or from locked to unlocked */
7586 updlockpos = (int)(cons->nlockspos[locktype] > 0) - (int)(oldnlockspos > 0);
7587 updlockneg = (int)(cons->nlocksneg[locktype] > 0) - (int)(oldnlocksneg > 0);
7588
7589 /* lock the variables, if the constraint switched from unlocked to locked or from locked to unlocked */
7590 if( updlockpos != 0 || updlockneg != 0 )
7591 {
7592 SCIP_CALL( cons->conshdlr->conslock(set->scip, cons->conshdlr, cons, locktype, updlockpos, updlockneg) );
7593 }
7594
7595 return SCIP_OKAY;
7596}
7597
7598/** checks single constraint for feasibility of the given solution */
7600 SCIP_CONS* cons, /**< constraint to check */
7601 SCIP_SET* set, /**< global SCIP settings */
7602 SCIP_SOL* sol, /**< primal CIP solution */
7603 SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
7604 SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
7605 SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
7606 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7607 )
7608{
7609 SCIP_CONSHDLR* conshdlr;
7610
7611 assert(cons != NULL);
7612 assert(set != NULL);
7613 assert(cons->scip == set->scip);
7614 assert(result != NULL);
7615
7616 conshdlr = cons->conshdlr;
7617 assert(conshdlr != NULL);
7618
7619 /* call external method */
7620 assert(conshdlr->conscheck != NULL);
7621
7622 SCIP_CALL( conshdlr->conscheck(set->scip, conshdlr, &cons, 1, sol, checkintegrality, checklprows, printreason,
7623 FALSE, result) );
7624 SCIPsetDebugMsg(set, " -> checking returned result <%d>\n", *result);
7625
7626 if( *result != SCIP_INFEASIBLE && *result != SCIP_FEASIBLE )
7627 {
7628 SCIPerrorMessage("feasibility check of constraint handler <%s> on constraint <%s> returned invalid result <%d>\n",
7629 conshdlr->name, cons->name, *result);
7630 return SCIP_INVALIDRESULT;
7631 }
7632
7633 return SCIP_OKAY;
7634}
7635
7636/** enforces single constraint for a given pseudo solution */
7638 SCIP_CONS* cons, /**< constraint to enforce */
7639 SCIP_SET* set, /**< global SCIP settings */
7640 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */
7641 SCIP_Bool objinfeasible, /**< is the solution infeasible anyway due to violating lower objective bound? */
7642 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7643 )
7644{
7645 SCIP_CONSHDLR* conshdlr;
7646
7647 assert(cons != NULL);
7648 assert(set != NULL);
7649 assert(cons->scip == set->scip);
7650 assert(result != NULL);
7651
7652 conshdlr = cons->conshdlr;
7653 assert(conshdlr != NULL);
7654
7655 /* call external method */
7656 assert(conshdlr->consenfops != NULL);
7657
7658 SCIP_CALL( conshdlr->consenfops(set->scip, conshdlr, &cons, 1, 1, solinfeasible, objinfeasible, result) );
7659 SCIPsetDebugMsg(set, " -> enfops returned result <%d>\n", *result);
7660
7661 if( *result != SCIP_CUTOFF
7662 && *result != SCIP_CONSADDED
7663 && *result != SCIP_REDUCEDDOM
7664 && *result != SCIP_BRANCHED
7665 && *result != SCIP_SOLVELP
7666 && *result != SCIP_INFEASIBLE
7667 && *result != SCIP_FEASIBLE
7668 && *result != SCIP_DIDNOTRUN )
7669 {
7670 SCIPerrorMessage("enforcing method of constraint handler <%s> for pseudo solutions returned invalid result <%d>\n",
7671 conshdlr->name, *result);
7672 return SCIP_INVALIDRESULT;
7673 }
7674
7675 /* do not update statistics */
7676
7677 return SCIP_OKAY;
7678}
7679
7680/** enforces single constraint for a given LP solution */
7682 SCIP_CONS* cons, /**< constraint to enforce */
7683 SCIP_SET* set, /**< global SCIP settings */
7684 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */
7685 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7686 )
7687{
7688 SCIP_CONSHDLR* conshdlr;
7689
7690 assert(cons != NULL);
7691 assert(set != NULL);
7692 assert(cons->scip == set->scip);
7693 assert(result != NULL);
7694
7695 conshdlr = cons->conshdlr;
7696 assert(conshdlr != NULL);
7697
7698 /* call external method */
7699 assert(conshdlr->consenfolp != NULL);
7700
7701 SCIP_CALL( conshdlr->consenfolp(set->scip, conshdlr, &cons, 1, 1, solinfeasible, result) );
7702 SCIPsetDebugMsg(set, " -> enfolp returned result <%d>\n", *result);
7703
7704 if( *result != SCIP_CUTOFF
7705 && *result != SCIP_CONSADDED
7706 && *result != SCIP_REDUCEDDOM
7707 && *result != SCIP_BRANCHED
7708 && *result != SCIP_SEPARATED
7709 && *result != SCIP_INFEASIBLE
7710 && *result != SCIP_FEASIBLE)
7711 {
7712 SCIPerrorMessage("enforcing method of constraint handler <%s> for LP returned invalid result <%d>\n",
7713 conshdlr->name, *result);
7714 return SCIP_INVALIDRESULT;
7715 }
7716
7717 /* do not update statistics */
7718
7719 return SCIP_OKAY;
7720}
7721
7722/** enforces single constraint for a given relaxation solution */
7724 SCIP_CONS* cons, /**< constraint to enforce */
7725 SCIP_SET* set, /**< global SCIP settings */
7726 SCIP_SOL* sol, /**< solution to be enforced */
7727 SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */
7728 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7729 )
7730{
7731 SCIP_CONSHDLR* conshdlr;
7732
7733 assert(cons != NULL);
7734 assert(set != NULL);
7735 assert(cons->scip == set->scip);
7736 assert(sol != NULL);
7737 assert(result != NULL);
7738
7739 conshdlr = cons->conshdlr;
7740 assert(conshdlr != NULL);
7741
7742 /* call external method */
7743 assert(conshdlr->consenfolp != NULL);
7744
7745 SCIP_CALL( conshdlr->consenforelax(set->scip, sol, conshdlr, &cons, 1, 1, solinfeasible, result) );
7746 SCIPdebugMessage(" -> enforelax returned result <%d>\n", *result);
7747
7748 if( *result != SCIP_CUTOFF
7749 && *result != SCIP_CONSADDED
7750 && *result != SCIP_REDUCEDDOM
7751 && *result != SCIP_BRANCHED
7752 && *result != SCIP_SEPARATED
7753 && *result != SCIP_INFEASIBLE
7754 && *result != SCIP_FEASIBLE)
7755 {
7756 SCIPerrorMessage("enforcing method of constraint handler <%s> for relaxation returned invalid result <%d>\n",
7757 conshdlr->name, *result);
7758 return SCIP_INVALIDRESULT;
7759 }
7760
7761 /* do not update statistics */
7762
7763 return SCIP_OKAY;
7764}
7765
7766/** calls LP initialization method for single constraint */
7768 SCIP_CONS* cons, /**< constraint to initialize */
7769 SCIP_SET* set, /**< global SCIP settings */
7770 SCIP_Bool* infeasible /**< pointer to store whether infeasibility was detected while building the LP */
7771 )
7772{
7773 SCIP_CONSHDLR* conshdlr;
7774
7775 assert(cons != NULL);
7776 assert(set != NULL);
7777 assert(infeasible != NULL);
7778 assert(cons->scip == set->scip);
7779
7780 conshdlr = cons->conshdlr;
7781 assert(conshdlr != NULL);
7782
7783 /* call external method */
7784 if( conshdlr->consinitlp != NULL )
7785 {
7786 SCIP_CALL( conshdlr->consinitlp(set->scip, conshdlr, &cons, 1, infeasible) );
7787 }
7788
7789 return SCIP_OKAY;
7790}
7791
7792/** calls separation method of single constraint for LP solution */
7794 SCIP_CONS* cons, /**< constraint to separate */
7795 SCIP_SET* set, /**< global SCIP settings */
7796 SCIP_RESULT* result /**< pointer to store the result of the separation call */
7797 )
7798{
7799 SCIP_CONSHDLR* conshdlr;
7800
7801 assert(cons != NULL);
7802 assert(set != NULL);
7803 assert(cons->scip == set->scip);
7804 assert(result != NULL);
7805
7806 conshdlr = cons->conshdlr;
7807 assert(conshdlr != NULL);
7808
7809 /* call external method */
7810 if( conshdlr->conssepalp != NULL )
7811 {
7812 SCIP_CALL( conshdlr->conssepalp(set->scip, conshdlr, &cons, 1, 1, result) );
7813 SCIPsetDebugMsg(set, " -> sepalp returned result <%d>\n", *result);
7814
7815 if( *result != SCIP_CUTOFF
7816 && *result != SCIP_CONSADDED
7817 && *result != SCIP_REDUCEDDOM
7818 && *result != SCIP_SEPARATED
7819 && *result != SCIP_NEWROUND
7820 && *result != SCIP_DIDNOTFIND
7821 && *result != SCIP_DIDNOTRUN
7822 && *result != SCIP_DELAYED )
7823 {
7824 SCIPerrorMessage("separation method of constraint handler <%s> returned invalid result <%d>\n", conshdlr->name,
7825 *result);
7826 return SCIP_INVALIDRESULT;
7827 }
7828 }
7829
7830 return SCIP_OKAY;
7831}
7832
7833/** calls separation method of single constraint for given primal solution */
7835 SCIP_CONS* cons, /**< constraint to separate */
7836 SCIP_SET* set, /**< global SCIP settings */
7837 SCIP_SOL* sol, /**< primal solution that should be separated */
7838 SCIP_RESULT* result /**< pointer to store the result of the separation call */
7839 )
7840{
7841 SCIP_CONSHDLR* conshdlr;
7842
7843 assert(cons != NULL);
7844 assert(set != NULL);
7845 assert(cons->scip == set->scip);
7846 assert(sol != NULL);
7847 assert(result != NULL);
7848
7849 conshdlr = cons->conshdlr;
7850 assert(conshdlr != NULL);
7851
7852 /* call external method */
7853 if( conshdlr->conssepasol != NULL )
7854 {
7855 SCIP_CALL( conshdlr->conssepasol(set->scip, conshdlr, &cons, 1, 1, sol, result) );
7856 SCIPsetDebugMsg(set, " -> sepasol returned result <%d>\n", *result);
7857
7858 if( *result != SCIP_CUTOFF
7859 && *result != SCIP_CONSADDED
7860 && *result != SCIP_REDUCEDDOM
7861 && *result != SCIP_SEPARATED
7862 && *result != SCIP_NEWROUND
7863 && *result != SCIP_DIDNOTFIND
7864 && *result != SCIP_DIDNOTRUN
7865 && *result != SCIP_DELAYED )
7866 {
7867 SCIPerrorMessage("separation method of constraint handler for arbitrary primal solution <%s> returned invalid result <%d>\n",
7868 conshdlr->name, *result);
7869 return SCIP_INVALIDRESULT;
7870 }
7871 }
7872
7873 return SCIP_OKAY;
7874}
7875
7876/** calls domain propagation method of single constraint */
7878 SCIP_CONS* cons, /**< constraint to propagate */
7879 SCIP_SET* set, /**< global SCIP settings */
7880 SCIP_PROPTIMING proptiming, /**< current point in the node solving loop */
7881 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7882 )
7883{
7884 SCIP_CONSHDLR* conshdlr;
7885
7886 assert(cons != NULL);
7887 assert(set != NULL);
7888 assert(cons->scip == set->scip);
7889 assert(result != NULL);
7890
7891 conshdlr = cons->conshdlr;
7892 assert(conshdlr != NULL);
7893
7894 /* call external method */
7895 if( conshdlr->consprop != NULL )
7896 {
7897 SCIP_CALL( conshdlr->consprop(set->scip, conshdlr, &cons, 1, 1, 1, proptiming, result) );
7898 SCIPsetDebugMsg(set, " -> prop returned result <%d>\n", *result);
7899
7900 if( *result != SCIP_CUTOFF
7901 && *result != SCIP_CONSADDED
7902 && *result != SCIP_REDUCEDDOM
7903 && *result != SCIP_DIDNOTFIND
7904 && *result != SCIP_DIDNOTRUN
7905 && *result != SCIP_DELAYED )
7906 {
7907 SCIPerrorMessage("propagation method of constraint handler <%s> returned invalid result <%d>\n",
7908 conshdlr->name, *result);
7909 return SCIP_INVALIDRESULT;
7910 }
7911 }
7912
7913 return SCIP_OKAY;
7914}
7915
7916/** resolves propagation conflict of single constraint */
7918 SCIP_CONS* cons, /**< constraint to resolve conflict for */
7919 SCIP_SET* set, /**< global SCIP settings */
7920 SCIP_VAR* infervar, /**< the conflict variable whose bound change has to be resolved */
7921 int inferinfo, /**< the user information passed to the corresponding SCIPinferVarLbCons() or SCIPinferVarUbCons() call */
7922 SCIP_BOUNDTYPE boundtype, /**< the type of the changed bound (lower or upper bound) */
7923 SCIP_BDCHGIDX* bdchgidx, /**< the index of the bound change, representing the point of time where the change took place */
7924 SCIP_Real relaxedbd, /**< the relaxed bound which is sufficient to be explained */
7925 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7926 )
7927{
7928 SCIP_CONSHDLR* conshdlr;
7929
7930 assert(cons != NULL);
7931 assert(set != NULL);
7932 assert(cons->scip == set->scip);
7933 assert(result != NULL);
7934 assert(infervar != NULL);
7935 assert(bdchgidx != NULL);
7936
7937 conshdlr = cons->conshdlr;
7938 assert(conshdlr != NULL);
7939
7940 /* call external method */
7941 if( conshdlr->consresprop != NULL )
7942 {
7943 SCIP_CALL( conshdlr->consresprop(set->scip, conshdlr, cons, infervar, inferinfo, boundtype, bdchgidx, relaxedbd, result) );
7944 SCIPsetDebugMsg(set, " -> resprop returned result <%d>\n", *result);
7945
7946 if( *result != SCIP_SUCCESS
7947 && *result != SCIP_DIDNOTFIND )
7948 {
7949 SCIPerrorMessage("propagation conflict resolving method of constraint handler <%s> returned invalid result <%d>\n",
7950 conshdlr->name, *result);
7951 return SCIP_INVALIDRESULT;
7952 }
7953 }
7954
7955 return SCIP_OKAY;
7956}
7957
7958/** presolves single constraint */
7960 SCIP_CONS* cons, /**< constraint to presolve */
7961 SCIP_SET* set, /**< global SCIP settings */
7962 int nrounds, /**< number of presolving rounds already done */
7963 SCIP_PRESOLTIMING timing, /**< current presolving timing */
7964 int nnewfixedvars, /**< number of variables fixed since the last call to the presolving method */
7965 int nnewaggrvars, /**< number of variables aggregated since the last call to the presolving method */
7966 int nnewchgvartypes, /**< number of variable type changes since the last call to the presolving method */
7967 int nnewchgbds, /**< number of variable bounds tightened since the last call to the presolving method */
7968 int nnewholes, /**< number of domain holes added since the last call to the presolving method */
7969 int nnewdelconss, /**< number of deleted constraints since the last call to the presolving method */
7970 int nnewaddconss, /**< number of added constraints since the last call to the presolving method */
7971 int nnewupgdconss, /**< number of upgraded constraints since the last call to the presolving method */
7972 int nnewchgcoefs, /**< number of changed coefficients since the last call to the presolving method */
7973 int nnewchgsides, /**< number of changed left or right hand sides since the last call to the presolving method */
7974 int* nfixedvars, /**< pointer to count total number of variables fixed of all presolvers */
7975 int* naggrvars, /**< pointer to count total number of variables aggregated of all presolvers */
7976 int* nchgvartypes, /**< pointer to count total number of variable type changes of all presolvers */
7977 int* nchgbds, /**< pointer to count total number of variable bounds tightened of all presolvers */
7978 int* naddholes, /**< pointer to count total number of domain holes added of all presolvers */
7979 int* ndelconss, /**< pointer to count total number of deleted constraints of all presolvers */
7980 int* naddconss, /**< pointer to count total number of added constraints of all presolvers */
7981 int* nupgdconss, /**< pointer to count total number of upgraded constraints of all presolvers */
7982 int* nchgcoefs, /**< pointer to count total number of changed coefficients of all presolvers */
7983 int* nchgsides, /**< pointer to count total number of changed left/right hand sides of all presolvers */
7984 SCIP_RESULT* result /**< pointer to store the result of the callback method */
7985 )
7986{
7987 SCIP_CONSHDLR* conshdlr;
7988
7989 assert(cons != NULL);
7990 assert(set != NULL);
7991 assert(cons->scip == set->scip);
7992 assert(nfixedvars != NULL);
7993 assert(naggrvars != NULL);
7994 assert(nchgvartypes != NULL);
7995 assert(nchgbds != NULL);
7996 assert(naddholes != NULL);
7997 assert(ndelconss != NULL);
7998 assert(naddconss != NULL);
7999 assert(nupgdconss != NULL);
8000 assert(nchgcoefs != NULL);
8001 assert(nchgsides != NULL);
8002 assert(result != NULL);
8003
8004 conshdlr = cons->conshdlr;
8005 assert(conshdlr != NULL);
8006
8007 /* call external method */
8008 if( conshdlr->conspresol != NULL )
8009 {
8010 SCIP_CALL( conshdlr->conspresol(set->scip, conshdlr, &cons, 1, nrounds, timing,
8011 nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewholes, nnewdelconss, nnewaddconss,
8012 nnewupgdconss, nnewchgcoefs, nnewchgsides, nfixedvars, naggrvars, nchgvartypes,
8013 nchgbds, naddholes, ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides, result) );
8014 SCIPsetDebugMsg(set, " -> presol returned result <%d>\n", *result);
8015
8016 if( *result != SCIP_UNBOUNDED
8017 && *result != SCIP_CUTOFF
8018 && *result != SCIP_SUCCESS
8019 && *result != SCIP_DIDNOTFIND
8020 && *result != SCIP_DIDNOTRUN
8021 && *result != SCIP_DELAYED )
8022 {
8023 SCIPerrorMessage("presolving method of constraint handler <%s> returned invalid result <%d>\n",
8024 conshdlr->name, *result);
8025 return SCIP_INVALIDRESULT;
8026 }
8027 }
8028
8029 return SCIP_OKAY;
8030}
8031
8032/** calls constraint activation notification method of single constraint */
8034 SCIP_CONS* cons, /**< constraint to notify */
8035 SCIP_SET* set /**< global SCIP settings */
8036 )
8037{
8038 SCIP_CONSHDLR* conshdlr;
8039
8040 assert(cons != NULL);
8041 assert(set != NULL);
8042 assert(cons->scip == set->scip);
8043
8044 conshdlr = cons->conshdlr;
8045 assert(conshdlr != NULL);
8046
8047 /* call external method */
8048 if( conshdlr->consactive != NULL )
8049 {
8050 SCIP_CALL( conshdlr->consactive(set->scip, conshdlr, cons) );
8051 }
8052
8053 return SCIP_OKAY;
8054}
8055
8056/** calls constraint deactivation notification method of single constraint */
8058 SCIP_CONS* cons, /**< constraint to notify */
8059 SCIP_SET* set /**< global SCIP settings */
8060 )
8061{
8062 SCIP_CONSHDLR* conshdlr;
8063
8064 assert(cons != NULL);
8065 assert(set != NULL);
8066 assert(cons->scip == set->scip);
8067
8068 conshdlr = cons->conshdlr;
8069 assert(conshdlr != NULL);
8070
8071 /* call external method */
8072 if( conshdlr->consdeactive != NULL )
8073 {
8074 SCIP_CALL( conshdlr->consdeactive(set->scip, conshdlr, cons) );
8075 }
8076
8077 return SCIP_OKAY;
8078}
8079
8080
8081
8082/*
8083 * Hash functions
8084 */
8085
8086/** gets the key (i.e. the name) of the given constraint */
8087SCIP_DECL_HASHGETKEY(SCIPhashGetKeyCons)
8088{ /*lint --e{715}*/
8089 SCIP_CONS* cons = (SCIP_CONS*)elem;
8090
8091 assert(cons != NULL);
8092 return cons->name;
8093}
8094
8095
8096/*
8097 * method for arrays of contraint handlers
8098 */
8099
8100/** ensures size of storage for propagable constraints with a minimum size of num */
8101static
8103 SCIP_SET* set, /**< global SCIP settings */
8104 SCIP_CONSHDLR* conshdlr, /**< constraint handler */
8105 int num /**< minimum number of entries to store */
8106 )
8107{
8108 assert(set != NULL);
8109 assert(conshdlr != NULL);
8110
8111 if( num > conshdlr->storedpropconsssize )
8112 {
8113 int newsize;
8114
8115 newsize = SCIPsetCalcMemGrowSize(set, num);
8116 SCIP_ALLOC( BMSreallocMemoryArray(&(conshdlr->storedpropconss), newsize) );
8117
8118 conshdlr->storedpropconsssize = newsize;
8119 }
8120 assert(num <= conshdlr->storedpropconsssize);
8121
8122 return SCIP_OKAY;
8123}
8124
8125/** stores all constraints marked for propagation away when probing is started */
8127 SCIP_SET* set, /**< global SCIP settings */
8128 SCIP_CONSHDLR** conshdlrs, /**< all constraint handlers */
8129 int nconshdlrs /**< number of contraint handlers */
8130 )
8131{
8132 SCIP_CONSHDLR* conshdlr;
8133 int c;
8134
8135 assert(set != NULL);
8136 assert(conshdlrs != NULL || nconshdlrs == 0);
8137
8138 for( c = nconshdlrs - 1; c >= 0; --c )
8139 {
8140 conshdlr = conshdlrs[c]; /*lint !e613*/
8141 assert(conshdlr != NULL);
8142 assert(conshdlr->storednmarkedpropconss == 0);
8143
8144 if( conshdlr->nmarkedpropconss > 0 )
8145 {
8146 int v;
8147
8148 SCIP_CALL( ensurePropagationStorage(set, conshdlr, conshdlr->nmarkedpropconss) );
8149 BMScopyMemoryArray(conshdlr->storedpropconss, conshdlr->propconss, conshdlr->nmarkedpropconss);
8150
8151 conshdlr->storednmarkedpropconss = conshdlr->nmarkedpropconss;
8152 conshdlr->storedpropdomchgcount = conshdlr->lastpropdomchgcount;
8153
8154 for( v = conshdlr->storednmarkedpropconss - 1; v >= 0; --v )
8155 {
8156 SCIPconsCapture(conshdlr->storedpropconss[v]);
8157 }
8158 /* assert(conshdlr->nmarkedpropconss == 0); this assert does not hold if updates are delayed */
8159 }
8160 }
8161
8162 return SCIP_OKAY;
8163}
8164
8165/** reset all constraints marked for propagation when probing was finished */
8167 SCIP_SET* set, /**< global SCIP settings */
8168 BMS_BLKMEM* blkmem, /**< block memory */
8169 SCIP_CONSHDLR** conshdlrs, /**< all constraint handlers */
8170 int nconshdlrs /**< number of contraint handlers */
8171 )
8172{
8173 SCIP_CONSHDLR* conshdlr;
8174 int c;
8175
8176 assert(set != NULL);
8177 assert(blkmem != NULL);
8178 assert(conshdlrs != NULL || nconshdlrs == 0);
8179
8180 for( c = nconshdlrs - 1; c >= 0; --c )
8181 {
8182 conshdlr = conshdlrs[c]; /*lint !e613*/
8183 assert(conshdlr != NULL);
8184
8185 if( conshdlr->storednmarkedpropconss > 0 )
8186 {
8187#ifndef NDEBUG
8188 int ndisabled = 0;
8189#endif
8190 int v;
8191
8192 for( v = conshdlr->nmarkedpropconss - 1; v >= 0; --v )
8193 {
8195 }
8196
8197 /* mark all previously marked constraint, which were marked before probing */
8198 for( v = 0; v < conshdlr->storednmarkedpropconss; ++v )
8199 {
8200 SCIP_CONS* cons = conshdlr->storedpropconss[v];
8201 assert(cons != NULL);
8202
8203 if( cons->enabled && cons->propagate && cons->propenabled )
8204 {
8206 }
8207#ifndef NDEBUG
8208 else
8209 ++ndisabled;
8210#endif
8211 SCIP_CALL( SCIPconsRelease(&cons, blkmem, set) );
8212 } /*lint !e438*/
8213
8214 assert(conshdlr->storednmarkedpropconss - ndisabled <= conshdlr->npropconss);
8215 assert(conshdlr->nmarkedpropconss + ndisabled >= conshdlr->storednmarkedpropconss || (conshdlrAreUpdatesDelayed(conshdlr) && conshdlr->nupdateconss + ndisabled >= conshdlr->storednmarkedpropconss));
8216
8217 conshdlr->lastpropdomchgcount = conshdlr->storedpropdomchgcount;
8218 conshdlr->storednmarkedpropconss = 0;
8219 }
8220 }
8221
8222 return SCIP_OKAY;
8223}
8224
8225/** create linear constraint statistics */
8227 SCIP* scip, /**< scip data structure */
8228 SCIP_LINCONSSTATS** linconsstats /**< pointer to linear constraint classification statistics */
8229 )
8230{
8231 assert(linconsstats != NULL);
8232
8233 SCIP_CALL( SCIPallocBlockMemory(scip, linconsstats) );
8234
8235 return SCIP_OKAY;
8236}
8237
8238/** free linear constraint statistics */
8240 SCIP* scip, /**< scip data structure */
8241 SCIP_LINCONSSTATS** linconsstats /**< pointer to linear constraint classification statistics */
8242 )
8243{
8244 assert(linconsstats != NULL);
8245 assert(*linconsstats != NULL);
8246
8247 SCIPfreeBlockMemory(scip, linconsstats);
8248}
8249
8250/** resets linear constraint statistics */
8252 SCIP_LINCONSSTATS* linconsstats /**< linear constraint classification statistics */
8253 )
8254{
8256 linconsstats->sum = 0;
8257}
8258
8259/** returns the number of occurrences of a specific type of linear constraint */
8261 SCIP_LINCONSSTATS* linconsstats, /**< linear constraint classification statistics */
8262 SCIP_LINCONSTYPE linconstype /**< linear constraint type */
8263 )
8264{
8265 assert(linconsstats != NULL);
8266 assert(0 <= (int)linconstype && (int)linconstype < SCIP_NLINCONSTYPES); /*lint !e587 !e685 !e568*/
8267 assert(linconsstats->counter != NULL);
8268
8269 return linconsstats->counter[(int)linconstype];
8270}
8271
8272/** returns the total number of classified constraints */
8274 SCIP_LINCONSSTATS* linconsstats /**< linear constraint classification statistics */
8275 )
8276{
8277 assert(linconsstats != NULL);
8278
8279 return linconsstats->sum;
8280}
8281
8282/** increases the number of occurrences of a specific type of linear constraint */
8284 SCIP_LINCONSSTATS* linconsstats, /**< linear constraint classification statistics */
8285 SCIP_LINCONSTYPE linconstype, /**< linear constraint type */
8286 int increment /**< positive increment */
8287 )
8288{
8289 assert(linconsstats != NULL);
8290 assert(increment >= 1);
8291 assert(0 <= (int)linconstype && (int)linconstype < SCIP_NLINCONSTYPES); /*lint !e587 !e685 !e568*/
8292 assert(linconsstats->counter != NULL);
8293
8294 linconsstats->counter[(int)linconstype] += increment;
8295 linconsstats->sum += increment;
8296}
8297
8298/** print linear constraint classification statistics */
8300 SCIP* scip, /**< scip data structure */
8301 FILE* file, /**< file handle or NULL to print to standard out */
8302 SCIP_LINCONSSTATS* linconsstats /**< linear constraint classification statistics */
8303 )
8304{
8305 assert(scip != NULL);
8306 assert(linconsstats != NULL);
8307
8308 /* print statistics */
8309 SCIPinfoMessage(scip, file, "\n");
8310 SCIPinfoMessage(scip, file, "%-19s : %10s\n", "Linear cons types", "count");
8311 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "total", SCIPlinConsStatsGetSum(linconsstats));
8312 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "empty", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_EMPTY));
8313 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "free", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_FREE));
8314 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "singleton", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_SINGLETON));
8315 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "aggregation", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_AGGREGATION));
8316 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "precedence", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_PRECEDENCE));
8317 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "varbound", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_VARBOUND));
8318 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "setpartition", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_SETPARTITION));
8319 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "setpacking", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_SETPACKING));
8320 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "setcovering", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_SETCOVERING));
8321 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "cardinality", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_CARDINALITY));
8322 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "invknapsack", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_INVKNAPSACK));
8323 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "eqknapsack", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_EQKNAPSACK));
8324 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "binpacking", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_BINPACKING));
8325 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "knapsack", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_KNAPSACK));
8326 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "intknapsack", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_INTKNAPSACK));
8327 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "mixedbinary", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_MIXEDBINARY));
8328 SCIPinfoMessage(scip, file, " %-17s : %10d\n", "general", SCIPlinConsStatsGetTypeCount(linconsstats, SCIP_LINCONSTYPE_GENERAL));
8329 SCIPinfoMessage(scip, file, "\n");
8330}
8331
8332/*
8333 * simple functions implemented as defines
8334 */
8335
8336/* In debug mode, the following methods are implemented as function calls to ensure
8337 * type validity.
8338 * In optimized mode, the methods are implemented as defines to improve performance.
8339 * However, we want to have them in the library anyways, so we have to undef the defines.
8340 */
8341
8342#undef SCIPconsGetName
8343#undef SCIPconsGetPos
8344#undef SCIPconsGetHdlr
8345#undef SCIPconsGetData
8346#undef SCIPconsGetNUses
8347#undef SCIPconsGetActiveDepth
8348#undef SCIPconsGetValidDepth
8349#undef SCIPconsIsActive
8350#undef SCIPconsIsEnabled
8351#undef SCIPconsIsSeparationEnabled
8352#undef SCIPconsIsPropagationEnabled
8353#undef SCIPconsIsDeleted
8354#undef SCIPconsIsObsolete
8355#undef SCIPconsIsConflict
8356#undef SCIPconsGetAge
8357#undef SCIPconsIsInitial
8358#undef SCIPconsIsSeparated
8359#undef SCIPconsIsEnforced
8360#undef SCIPconsIsChecked
8361#undef SCIPconsIsMarkedPropagate
8362#undef SCIPconsIsPropagated
8363#undef SCIPconsIsGlobal
8364#undef SCIPconsIsLocal
8365#undef SCIPconsIsModifiable
8366#undef SCIPconsIsDynamic
8367#undef SCIPconsIsRemovable
8368#undef SCIPconsIsStickingAtNode
8369#undef SCIPconsIsInProb
8370#undef SCIPconsIsOriginal
8371#undef SCIPconsIsTransformed
8372#undef SCIPconsIsLockedPos
8373#undef SCIPconsIsLockedNeg
8374#undef SCIPconsIsLocked
8375#undef SCIPconsGetNLocksPos
8376#undef SCIPconsGetNLocksNeg
8377#undef SCIPconsIsLockedTypePos
8378#undef SCIPconsIsLockedTypeNeg
8379#undef SCIPconsIsLockedType
8380#undef SCIPconsGetNLocksTypePos
8381#undef SCIPconsGetNLocksTypeNeg
8382#undef SCIPconsIsAdded
8383#undef SCIPconsGetNUpgradeLocks
8384
8385/** returns the name of the constraint
8386 *
8387 * @note to change the name of a constraint, use SCIPchgConsName() from scip.h
8388 */
8390 SCIP_CONS* cons /**< constraint */
8391 )
8392{
8393 assert(cons != NULL);
8394
8395 return cons->name;
8396}
8397
8398/** returns the position of constraint in the corresponding handler's conss array */
8400 SCIP_CONS* cons /**< constraint */
8401 )
8402{
8403 assert(cons != NULL);
8404
8405 return cons->consspos;
8406}
8407
8408/** returns the constraint handler of the constraint */
8410 SCIP_CONS* cons /**< constraint */
8411 )
8412{
8413 assert(cons != NULL);
8414
8415 return cons->conshdlr;
8416}
8417
8418/** returns the constraint data field of the constraint */
8420 SCIP_CONS* cons /**< constraint */
8421 )
8422{
8423 assert(cons != NULL);
8424
8425 return cons->consdata;
8426}
8427
8428/** gets number of times, the constraint is currently captured */
8430 SCIP_CONS* cons /**< constraint */
8431 )
8432{
8433 assert(cons != NULL);
8434
8435 return cons->nuses;
8436}
8437
8438/** for an active constraint, returns the depth in the tree at which the constraint was activated */
8440 SCIP_CONS* cons /**< constraint */
8441 )
8442{
8443 assert(cons != NULL);
8444 assert(SCIPconsIsActive(cons));
8445
8446 return cons->activedepth;
8447}
8448
8449/** returns TRUE iff constraint is active in the current node */
8451 SCIP_CONS* cons /**< constraint */
8452 )
8453{
8454 assert(cons != NULL);
8455
8456 return cons->updateactivate || (cons->active && !cons->updatedeactivate);
8457}
8458
8459/** returns TRUE iff constraint is active in the current node */
8461 SCIP_CONS* cons /**< constraint */
8462 )
8463{
8464 assert(cons != NULL);
8465
8466 return cons->updatedeactivate;
8467}
8468
8469/** returns the depth in the tree at which the constraint is valid; returns INT_MAX, if the constraint is local
8470 * and currently not active
8471 */
8473 SCIP_CONS* cons /**< constraint */
8474 )
8475{
8476 assert(cons != NULL);
8477 assert(cons->validdepth == 0 || cons->local);
8478
8479 return (!cons->local ? 0
8480 : !SCIPconsIsActive(cons) ? INT_MAX
8481 : cons->validdepth == -1 ? SCIPconsGetActiveDepth(cons)
8482 : cons->validdepth);
8483}
8484
8485/** returns TRUE iff constraint is enabled in the current node */
8487 SCIP_CONS* cons /**< constraint */
8488 )
8489{
8490 assert(cons != NULL);
8491
8492 return cons->updateenable || (cons->enabled && !cons->updatedisable);
8493}
8494
8495/** returns TRUE iff constraint's separation is enabled in the current node */
8497 SCIP_CONS* cons /**< constraint */
8498 )
8499{
8500 assert(cons != NULL);
8501
8502 return SCIPconsIsEnabled(cons)
8503 && (cons->updatesepaenable || (cons->sepaenabled && !cons->updatesepadisable));
8504}
8505
8506/** returns TRUE iff constraint's propagation is enabled in the current node */
8508 SCIP_CONS* cons /**< constraint */
8509 )
8510{
8511 assert(cons != NULL);
8512
8513 return SCIPconsIsEnabled(cons)
8514 && (cons->updatepropenable || (cons->propenabled && !cons->updatepropdisable));
8515}
8516
8517/** returns TRUE iff constraint is deleted or marked to be deleted */
8519 SCIP_CONS* cons /**< constraint */
8520 )
8521{
8522 assert(cons != NULL);
8523
8524 return cons->deleted;
8525}
8526
8527/** returns TRUE iff constraint is marked obsolete */
8529 SCIP_CONS* cons /**< constraint */
8530 )
8531{
8532 assert(cons != NULL);
8533
8534 return cons->updateobsolete || cons->obsolete;
8535}
8536
8537/** returns TRUE iff constraint is marked as a conflict */
8539 SCIP_CONS* cons /**< constraint */
8540 )
8541{
8542 assert(cons != NULL);
8543
8544 return cons->conflict;
8545}
8546
8547/** gets age of constraint */
8549 SCIP_CONS* cons /**< constraint */
8550 )
8551{
8552 assert(cons != NULL);
8553
8554 return cons->age;
8555}
8556
8557/** returns TRUE iff the LP relaxation of constraint should be in the initial LP */
8559 SCIP_CONS* cons /**< constraint */
8560 )
8561{
8562 assert(cons != NULL);
8563
8564 return cons->initial;
8565}
8566
8567/** returns TRUE iff constraint should be separated during LP processing */
8569 SCIP_CONS* cons /**< constraint */
8570 )
8571{
8572 assert(cons != NULL);
8573
8574 return cons->separate;
8575}
8576
8577/** returns TRUE iff constraint should be enforced during node processing */
8579 SCIP_CONS* cons /**< constraint */
8580 )
8581{
8582 assert(cons != NULL);
8583
8584 return cons->enforce;
8585}
8586
8587/** returns TRUE iff constraint should be checked for feasibility */
8589 SCIP_CONS* cons /**< constraint */
8590 )
8591{
8592 assert(cons != NULL);
8593
8594 return cons->check;
8595}
8596
8597/** returns whether the constraint is marked for propagation */
8599 SCIP_CONS* cons /**< constraint */
8600 )
8601{
8602 assert(cons != NULL);
8603
8604 return (cons->updatemarkpropagate || (cons->markpropagate && !cons->updateunmarkpropagate));
8605}
8606
8607/** returns TRUE iff constraint should be propagated during node processing */
8609 SCIP_CONS* cons /**< constraint */
8610 )
8611{
8612 assert(cons != NULL);
8613
8614 return cons->propagate;
8615}
8616
8617/** returns TRUE iff constraint is globally valid */
8619 SCIP_CONS* cons /**< constraint */
8620 )
8621{
8622 assert(cons != NULL);
8623
8624 return !cons->local;
8625}
8626
8627/** returns TRUE iff constraint is only locally valid or not added to any (sub)problem */
8629 SCIP_CONS* cons /**< constraint */
8630 )
8631{
8632 assert(cons != NULL);
8633
8634 return cons->local;
8635}
8636
8637/** returns TRUE iff constraint is modifiable (subject to column generation) */
8639 SCIP_CONS* cons /**< constraint */
8640 )
8641{
8642 assert(cons != NULL);
8643
8644 return cons->modifiable;
8645}
8646
8647/** returns TRUE iff constraint is subject to aging */
8649 SCIP_CONS* cons /**< constraint */
8650 )
8651{
8652 assert(cons != NULL);
8653
8654 return cons->dynamic;
8655}
8656
8657/** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */
8659 SCIP_CONS* cons /**< constraint */
8660 )
8661{
8662 assert(cons != NULL);
8663
8664 return cons->removable;
8665}
8666
8667/** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */
8669 SCIP_CONS* cons /**< constraint */
8670 )
8671{
8672 assert(cons != NULL);
8673
8674 return cons->stickingatnode;
8675}
8676
8677/** returns TRUE iff constraint belongs to the global problem */
8679 SCIP_CONS* cons /**< constraint */
8680 )
8681{
8682 assert(cons != NULL);
8683
8684 return (cons->addconssetchg == NULL && cons->addarraypos >= 0);
8685}
8686
8687/** returns TRUE iff constraint is belonging to original space */
8689 SCIP_CONS* cons /**< constraint */
8690 )
8691{
8692 assert(cons != NULL);
8693
8694 return cons->original;
8695}
8696
8697/** returns TRUE iff constraint is belonging to transformed space */
8699 SCIP_CONS* cons /**< constraint */
8700 )
8701{
8702 assert(cons != NULL);
8703
8704 return !cons->original;
8705}
8706
8707/** returns TRUE iff roundings for variables in constraint are locked */
8709 SCIP_CONS* cons /**< constraint */
8710 )
8711{
8712 assert(cons != NULL);
8713
8714 return (cons->nlockspos[SCIP_LOCKTYPE_MODEL] > 0);
8715}
8716
8717/** returns TRUE iff roundings for variables in constraint's negation are locked */
8719 SCIP_CONS* cons /**< constraint */
8720 )
8721{
8722 assert(cons != NULL);
8723
8724 return (cons->nlocksneg[SCIP_LOCKTYPE_MODEL] > 0);
8725}
8726
8727/** returns TRUE iff roundings for variables in constraint or in constraint's negation are locked */
8729 SCIP_CONS* cons /**< constraint */
8730 )
8731{
8732 assert(cons != NULL);
8733
8734 return (cons->nlockspos[SCIP_LOCKTYPE_MODEL] > 0 || cons->nlocksneg[SCIP_LOCKTYPE_MODEL] > 0);
8735}
8736
8737/** get number of times the roundings for variables in constraint are locked */
8739 SCIP_CONS* cons /**< constraint */
8740 )
8741{
8742 assert(cons != NULL);
8743
8744 return cons->nlockspos[SCIP_LOCKTYPE_MODEL];
8745}
8746
8747/** get number of times the roundings for variables in constraint's negation are locked */
8749 SCIP_CONS* cons /**< constraint */
8750 )
8751{
8752 assert(cons != NULL);
8753
8754 return cons->nlocksneg[SCIP_LOCKTYPE_MODEL];
8755}
8756
8757/** returns TRUE iff roundings of the given locktype for variables in constraint are locked */
8759 SCIP_CONS* cons, /**< constraint */
8760 SCIP_LOCKTYPE locktype /**< variable lock type */
8761 )
8762{
8763 assert(cons != NULL);
8764 assert((int)locktype >= 0 && (int)locktype < (int)NLOCKTYPES); /*lint !e685 !e568 !e587 !e650*/
8765
8766 return (cons->nlockspos[locktype] > 0);
8767}
8768
8769/** returns TRUE iff roundings of the given locktype for variables in constraint are locked */
8771 SCIP_CONS* cons, /**< constraint */
8772 SCIP_LOCKTYPE locktype /**< variable lock type */
8773 )
8774{
8775 assert(cons != NULL);
8776 assert((int)locktype >= 0 && (int)locktype < (int)NLOCKTYPES); /*lint !e685 !e568 !e587 !e650*/
8777
8778 return (cons->nlocksneg[locktype] > 0);
8779}
8780
8781/** returns TRUE iff roundings of given locktype for variables in constraint or in constraint's negation are locked */
8783 SCIP_CONS* cons, /**< constraint */
8784 SCIP_LOCKTYPE locktype /**< variable lock type */
8785 )
8786{
8787 assert(cons != NULL);
8788 assert((int)locktype >= 0 && (int)locktype < (int)NLOCKTYPES); /*lint !e685 !e568 !e587 !e650*/
8789
8790 return (cons->nlockspos[locktype] > 0 || cons->nlocksneg[locktype] > 0);
8791}
8792
8793/** get number of times the roundings of given locktype for variables in constraint are locked */
8795 SCIP_CONS* cons, /**< constraint */
8796 SCIP_LOCKTYPE locktype /**< variable lock type */
8797 )
8798{
8799 assert(cons != NULL);
8800 assert((int)locktype >= 0 && (int)locktype < (int)NLOCKTYPES); /*lint !e685 !e568 !e587 !e650*/
8801
8802 return cons->nlockspos[locktype];
8803}
8804
8805/** get number of times the roundings of given locktype for variables in constraint's negation are locked */
8807 SCIP_CONS* cons, /**< constraint */
8808 SCIP_LOCKTYPE locktype /**< variable lock type */
8809 )
8810{
8811 assert(cons != NULL);
8812 assert((int)locktype >= 0 && (int)locktype < (int)NLOCKTYPES); /*lint !e685 !e568 !e587 !e650*/
8813
8814 return cons->nlocksneg[locktype];
8815}
8816
8817/** returns if the constraint was already added to a SCIP instance */
8819 SCIP_CONS* cons /**< constraint */
8820 )
8821{
8822 assert(cons != NULL);
8823
8824 return (cons->addarraypos >= 0);
8825}
8826
8827/** adds locks to (dis-)allow upgrading of constraint */
8829 SCIP_CONS* cons, /**< constraint to add locks */
8830 int nlocks /**< number of locks to add */
8831 )
8832{
8833 assert(cons != NULL);
8834
8835 assert(cons->nupgradelocks >= -nlocks);
8836 cons->nupgradelocks += nlocks;
8837 assert(cons->nupgradelocks >= nlocks);
8838}
8839
8840/** gets number of locks against upgrading the constraint, 0 means this constraint can be upgraded */
8842 SCIP_CONS* cons /**< constraint */
8843 )
8844{
8845 assert(cons != NULL);
8846
8847 return (int) cons->nupgradelocks;
8848}
SCIP_DECL_CONSENFOPS(ConshdlrSubtour::scip_enfops)
SCIP_DECL_CONSSEPASOL(ConshdlrSubtour::scip_sepasol)
SCIP_DECL_CONSLOCK(ConshdlrSubtour::scip_lock)
SCIP_DECL_CONSDELETE(ConshdlrSubtour::scip_delete)
SCIP_DECL_CONSCOPY(ConshdlrSubtour::scip_copy)
SCIP_DECL_CONSSEPALP(ConshdlrSubtour::scip_sepalp)
SCIP_DECL_CONSTRANS(ConshdlrSubtour::scip_trans)
SCIP_DECL_CONSDELVARS(ConshdlrSubtour::scip_delvars)
SCIP_DECL_CONSPRINT(ConshdlrSubtour::scip_print)
SCIP_DECL_CONSCHECK(ConshdlrSubtour::scip_check)
SCIP_DECL_CONSPROP(ConshdlrSubtour::scip_prop)
SCIP_DECL_CONSENFOLP(ConshdlrSubtour::scip_enfolp)
static GRAPHNODE ** active
int SCIPbranchcandGetNPseudoCands(SCIP_BRANCHCAND *branchcand)
Definition: branch.c:875
internal methods for branching rules and branching candidate storage
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:360
void SCIPclockEnableOrDisable(SCIP_CLOCK *clck, SCIP_Bool enable)
Definition: clock.c:260
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:290
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:438
void SCIPclockReset(SCIP_CLOCK *clck)
Definition: clock.c:209
void SCIPclockFree(SCIP_CLOCK **clck)
Definition: clock.c:185
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
Definition: clock.c:170
internal methods for clocks and timing issues
SCIP_RETCODE SCIPconshdlrsStorePropagationStatus(SCIP_SET *set, SCIP_CONSHDLR **conshdlrs, int nconshdlrs)
Definition: cons.c:8126
static SCIP_RETCODE conshdlrAddInitcons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: cons.c:816
void SCIPconshdlrSetFree(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSFREE((*consfree)))
Definition: cons.c:4446
SCIP_RETCODE SCIPconsAddLocks(SCIP_CONS *cons, SCIP_SET *set, SCIP_LOCKTYPE locktype, int nlockspos, int nlocksneg)
Definition: cons.c:7553
SCIP_RETCODE SCIPconshdlrSeparateLP(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SEPASTORE *sepastore, int depth, SCIP_Bool execdelayed, SCIP_RESULT *result)
Definition: cons.c:2913
void SCIPconshdlrSetInitsol(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITSOL((*consinitsol)))
Definition: cons.c:4479
SCIP_RETCODE SCIPconsParse(SCIP_CONS **cons, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, const char *str, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool *success)
Definition: cons.c:6228
SCIP_RETCODE SCIPconssetchgUndo(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:5847
SCIP_RETCODE SCIPconsEnableSeparation(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7175
static SCIP_RETCODE conssetchgEnsureAddedconssSize(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: cons.c:5547
void SCIPconshdlrSetTrans(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSTRANS((*constrans)))
Definition: cons.c:4563
SCIP_RETCODE SCIPconshdlrSetPresol(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
Definition: cons.c:4523
void SCIPconshdlrIncNCutsFound(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5072
SCIP_RETCODE SCIPconshdlrInit(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:2412
static SCIP_RETCODE conssetchgDelAddedCons(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, int arraypos)
Definition: cons.c:5671
static SCIP_RETCODE conshdlrEnableCons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: cons.c:1404
SCIP_RETCODE SCIPconsEnable(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:7108
void SCIPconsCapture(SCIP_CONS *cons)
Definition: cons.c:6427
SCIP_RETCODE SCIPconsProp(SCIP_CONS *cons, SCIP_SET *set, SCIP_PROPTIMING proptiming, SCIP_RESULT *result)
Definition: cons.c:7877
static SCIP_RETCODE conssetchgCreate(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem)
Definition: cons.c:5471
SCIP_RETCODE SCIPconsPrint(SCIP_CONS *cons, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: cons.c:6479
SCIP_RETCODE SCIPconsCreate(SCIP_CONS **cons, BMS_BLKMEM *blkmem, SCIP_SET *set, const char *name, SCIP_CONSHDLR *conshdlr, SCIP_CONSDATA *consdata, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool original, SCIP_Bool deleteconsdata)
Definition: cons.c:6029
void SCIPconshdlrIncNAppliedCuts(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5062
static SCIP_RETCODE conshdlrEnsureCheckconssMem(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, int num)
Definition: cons.c:170
static void conshdlrDelPropcons(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:1225
static SCIP_Bool conshdlrAreUpdatesDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:323
void SCIPconsSetLocal(SCIP_CONS *cons, SCIP_Bool local)
Definition: cons.c:6949
SCIP_RETCODE SCIPconsMarkPropagate(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7305
void SCIPconshdlrSetInit(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINIT((*consinit)))
Definition: cons.c:4457
void SCIPconshdlrSetDelete(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELETE((*consdelete)))
Definition: cons.c:4552
SCIP_RETCODE SCIPconshdlrEnforceRelaxSol(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_SEPASTORE *sepastore, SCIP_SOL *relaxsol, SCIP_Bool solinfeasible, SCIP_RESULT *result)
Definition: cons.c:3209
static SCIP_RETCODE conshdlrDisableConsSeparation(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:1315
static SCIP_Real conshdlrGetAgeresetavg(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:332
static SCIP_RETCODE conssetchgEnsureDisabledconssSize(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: cons.c:5571
SCIP_RETCODE SCIPconsDeactivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:7073
void SCIPconshdlrSetParse(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPARSE((*consparse)))
Definition: cons.c:4662
static SCIP_RETCODE conshdlrEnsurePropconssMem(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, int num)
Definition: cons.c:194
SCIP_RETCODE SCIPconshdlrExitsol(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool restart)
Definition: cons.c:2759
void SCIPconshdlrSetGetPermsymGraph(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)))
Definition: cons.c:4706
SCIP_RETCODE SCIPconshdlrSeparateSol(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SEPASTORE *sepastore, SCIP_SOL *sol, int depth, SCIP_Bool execdelayed, SCIP_RESULT *result)
Definition: cons.c:3075
void SCIPconshdlrSetGetNVars(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETNVARS((*consgetnvars)))
Definition: cons.c:4684
SCIP_RETCODE SCIPconsDisable(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:7141
SCIP_RETCODE SCIPconsDeactive(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:8057
static SCIP_RETCODE conshdlrMarkConsObsolete(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:388
SCIP_RETCODE SCIPconshdlrLockVars(SCIP_CONSHDLR *conshdlr, SCIP_SET *set)
Definition: cons.c:4276
void SCIPconshdlrSetActive(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSACTIVE((*consactive)))
Definition: cons.c:4596
SCIP_RETCODE SCIPconshdlrEnforceLPSol(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_SEPASTORE *sepastore, SCIP_Bool solinfeasible, SCIP_RESULT *result)
Definition: cons.c:3406
SCIP_RETCODE SCIPconsGetPermsymGraph(SCIP_CONS *cons, SCIP_SET *set, SYM_GRAPH *graph, SCIP_Bool *success)
Definition: cons.c:6589
SCIP_RETCODE SCIPconsGetNVars(SCIP_CONS *cons, SCIP_SET *set, int *nvars, SCIP_Bool *success)
Definition: cons.c:6554
static SCIP_RETCODE conshdlrEnsureUpdateconssMem(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, int num)
Definition: cons.c:218
void SCIPconshdlrSetInitpre(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITPRE((*consinitpre)))
Definition: cons.c:4501
void SCIPconsSetStickingAtNode(SCIP_CONS *cons, SCIP_Bool stickingatnode)
Definition: cons.c:6995
SCIP_RETCODE SCIPconsSetSeparated(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool separate)
Definition: cons.c:6796
#define checkConssArrays(conshdlr)
Definition: cons.c:247
SCIP_RETCODE SCIPconsSepalp(SCIP_CONS *cons, SCIP_SET *set, SCIP_RESULT *result)
Definition: cons.c:7793
static SCIP_RETCODE conssetchgRelease(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:5492
static SCIP_RETCODE conshdlrProcessUpdates(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:1689
SCIP_RETCODE SCIPconsEnfops(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool solinfeasible, SCIP_Bool objinfeasible, SCIP_RESULT *result)
Definition: cons.c:7637
SCIP_RETCODE SCIPconsActive(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:8033
#define AGERESETAVG_AGELIMIT
Definition: cons.c:58
SCIP_RETCODE SCIPconsResetAge(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7452
static SCIP_RETCODE conshdlrEnsureInitconssMem(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, int num)
Definition: cons.c:98
static SCIP_RETCODE conshdlrAddCheckcons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:1086
static SCIP_RETCODE ensurePropagationStorage(SCIP_SET *set, SCIP_CONSHDLR *conshdlr, int num)
Definition: cons.c:8102
SCIP_RETCODE SCIPconsResprop(SCIP_CONS *cons, SCIP_SET *set, SCIP_VAR *infervar, int inferinfo, SCIP_BOUNDTYPE boundtype, SCIP_BDCHGIDX *bdchgidx, SCIP_Real relaxedbd, SCIP_RESULT *result)
Definition: cons.c:7917
void SCIPconsSetRemovable(SCIP_CONS *cons, SCIP_Bool removable)
Definition: cons.c:6984
SCIP_RETCODE SCIPconshdlrCreate(SCIP_CONSHDLR **conshdlr, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int sepapriority, int enfopriority, int checkpriority, int sepafreq, int propfreq, int eagerfreq, int maxprerounds, SCIP_Bool delaysepa, SCIP_Bool delayprop, SCIP_Bool needscons, SCIP_PROPTIMING proptiming, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSFREE((*consfree)), SCIP_DECL_CONSINIT((*consinit)), SCIP_DECL_CONSEXIT((*consexit)), SCIP_DECL_CONSINITPRE((*consinitpre)), SCIP_DECL_CONSEXITPRE((*consexitpre)), SCIP_DECL_CONSINITSOL((*consinitsol)), SCIP_DECL_CONSEXITSOL((*consexitsol)), SCIP_DECL_CONSDELETE((*consdelete)), SCIP_DECL_CONSTRANS((*constrans)), SCIP_DECL_CONSINITLP((*consinitlp)), SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFORELAX((*consenforelax)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSPROP((*consprop)), SCIP_DECL_CONSPRESOL((*conspresol)), SCIP_DECL_CONSRESPROP((*consresprop)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_DECL_CONSACTIVE((*consactive)), SCIP_DECL_CONSDEACTIVE((*consdeactive)), SCIP_DECL_CONSENABLE((*consenable)), SCIP_DECL_CONSDISABLE((*consdisable)), SCIP_DECL_CONSDELVARS((*consdelvars)), SCIP_DECL_CONSPRINT((*consprint)), SCIP_DECL_CONSCOPY((*conscopy)), SCIP_DECL_CONSPARSE((*consparse)), SCIP_DECL_CONSGETVARS((*consgetvars)), SCIP_DECL_CONSGETNVARS((*consgetnvars)), SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)), SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)), SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)), SCIP_CONSHDLRDATA *conshdlrdata)
Definition: cons.c:2287
void SCIPconshdlrEnableOrDisableClocks(SCIP_CONSHDLR *conshdlr, SCIP_Bool enable)
Definition: cons.c:4842
static SCIP_RETCODE conssetchgDelDisabledCons(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, int arraypos)
Definition: cons.c:5717
SCIP_RETCODE SCIPconsTransform(SCIP_CONS *origcons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_CONS **transcons)
Definition: cons.c:6712
static SCIP_Bool consExceedsAgelimit(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:356
static SCIP_RETCODE conshdlrAddSepacons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:887
SCIP_RETCODE SCIPconsCheck(SCIP_CONS *cons, SCIP_SET *set, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
Definition: cons.c:7599
#define AGERESETAVG_OBSOLETEAGE
Definition: cons.c:60
static void conshdlrDelEnfocons(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:1034
SCIP_RETCODE SCIPconssetchgAddAddedCons(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons, int depth, SCIP_Bool focusnode, SCIP_Bool active)
Definition: cons.c:5596
SCIP_RETCODE SCIPconshdlrInitLP(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_Bool initkeptconss, SCIP_Bool *cutoff)
Definition: cons.c:2801
static SCIP_RETCODE conshdlrDisableConsPropagation(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:1375
static SCIP_RETCODE conshdlrEnsureConssMem(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, int num)
Definition: cons.c:74
#define AGERESETAVG_MIN
Definition: cons.c:56
void SCIPconshdlrSetDisable(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDISABLE((*consdisable)))
Definition: cons.c:4629
static void conshdlrUnmarkConsPropagate(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:698
static void conshdlrMarkConsPropagate(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:623
SCIP_RETCODE SCIPconsAddAge(SCIP_CONS *cons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real deltaage, SCIP_REOPT *reopt)
Definition: cons.c:7372
void SCIPconshdlrSetGetSignedPermsymGraph(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)))
Definition: cons.c:4718
SCIP_RETCODE SCIPconsEnablePropagation(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7233
static void conshdlrDelCheckcons(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:1130
static void conshdlrDelayUpdates(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:1883
SCIP_DECL_HASHGETKEY(SCIPhashGetKeyCons)
Definition: cons.c:8087
static void conshdlrDelInitcons(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:852
static SCIP_RETCODE conshdlrForceUpdates(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:1899
SCIP_RETCODE SCIPconsEnfolp(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool solinfeasible, SCIP_RESULT *result)
Definition: cons.c:7681
static SCIP_RETCODE conshdlrAddCons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:770
SCIP_RETCODE SCIPconsSetInitial(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool initial)
Definition: cons.c:6762
SCIP_RETCODE SCIPconssetchgFree(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:5522
static SCIP_RETCODE conshdlrEnsureEnfoconssMem(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, int num)
Definition: cons.c:146
SCIP_RETCODE SCIPconsChgName(SCIP_CONS *cons, BMS_BLKMEM *blkmem, const char *name)
Definition: cons.c:6351
static SCIP_RETCODE conshdlrDisableCons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: cons.c:1466
SCIP_RETCODE SCIPconsIncAge(SCIP_CONS *cons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_REOPT *reopt)
Definition: cons.c:7431
void SCIPconshdlrSetExitsol(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITSOL((*consexitsol)))
Definition: cons.c:4490
static SCIP_Bool consExceedsObsoleteage(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:371
SCIP_RETCODE SCIPconshdlrInitpre(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:2578
void SCIPconsSetDynamic(SCIP_CONS *cons, SCIP_Bool dynamic)
Definition: cons.c:6973
SCIP_RETCODE SCIPconsSepasol(SCIP_CONS *cons, SCIP_SET *set, SCIP_SOL *sol, SCIP_RESULT *result)
Definition: cons.c:7834
SCIP_RETCODE SCIPconsFree(SCIP_CONS **cons, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:6371
static SCIP_RETCODE conshdlrMarkConsUseful(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:518
static SCIP_RETCODE conshdlrEnableConsPropagation(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:1344
SCIP_RETCODE SCIPconssetchgAddDisabledCons(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:5642
SCIP_RETCODE SCIPconsDelete(SCIP_CONS *cons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_REOPT *reopt)
Definition: cons.c:6652
SCIP_RETCODE SCIPconsPresol(SCIP_CONS *cons, SCIP_SET *set, int nrounds, SCIP_PRESOLTIMING timing, int nnewfixedvars, int nnewaggrvars, int nnewchgvartypes, int nnewchgbds, int nnewholes, int nnewdelconss, int nnewaddconss, int nnewupgdconss, int nnewchgcoefs, int nnewchgsides, int *nfixedvars, int *naggrvars, int *nchgvartypes, int *nchgbds, int *naddholes, int *ndelconss, int *naddconss, int *nupgdconss, int *nchgcoefs, int *nchgsides, SCIP_RESULT *result)
Definition: cons.c:7959
SCIP_RETCODE SCIPconsDisablePropagation(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7263
void SCIPconshdlrSetResprop(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSRESPROP((*consresprop)))
Definition: cons.c:4585
SCIP_RETCODE SCIPconsCopy(SCIP_CONS **cons, SCIP_SET *set, const char *name, SCIP *sourcescip, SCIP_CONSHDLR *sourceconshdlr, SCIP_CONS *sourcecons, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool global, SCIP_Bool *valid)
Definition: cons.c:6172
static void conshdlrDelCons(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:796
SCIP_RETCODE SCIPconsRelease(SCIP_CONS **cons, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:6439
void SCIPconshdlrSetInitlp(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITLP((*consinitlp)))
Definition: cons.c:4574
SCIP_RETCODE SCIPconsResolvePropagation(SCIP_CONS *cons, SCIP_SET *set, SCIP_VAR *infervar, int inferinfo, SCIP_BOUNDTYPE inferboundtype, SCIP_BDCHGIDX *bdchgidx, SCIP_Real relaxedbd, SCIP_RESULT *result)
Definition: cons.c:7493
SCIP_RETCODE SCIPconsSetPropagated(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool propagate)
Definition: cons.c:6914
SCIP_RETCODE SCIPconsDisableSeparation(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7205
void SCIPconshdlrSetGetDiveBdChgs(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)))
Definition: cons.c:4695
static SCIP_RETCODE conshdlrEnsureSepaconssMem(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, int num)
Definition: cons.c:122
SCIP_RETCODE SCIPconsGetSignedPermsymGraph(SCIP_CONS *cons, SCIP_SET *set, SYM_GRAPH *graph, SCIP_Bool *success)
Definition: cons.c:6622
#define AGERESETAVG_INIT
Definition: cons.c:55
SCIP_RETCODE SCIPconshdlrUnlockVars(SCIP_CONSHDLR *conshdlr, SCIP_SET *set)
Definition: cons.c:4296
SCIP_RETCODE SCIPconsSetChecked(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool check)
Definition: cons.c:6866
SCIP_RETCODE SCIPconsInitlp(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool *infeasible)
Definition: cons.c:7767
SCIP_RETCODE SCIPconsEnforelax(SCIP_CONS *cons, SCIP_SET *set, SCIP_SOL *sol, SCIP_Bool solinfeasible, SCIP_RESULT *result)
Definition: cons.c:7723
static SCIP_RETCODE conshdlrAddUpdateCons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:1925
static SCIP_RETCODE doConshdlrCreate(SCIP_CONSHDLR **conshdlr, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int sepapriority, int enfopriority, int checkpriority, int sepafreq, int propfreq, int eagerfreq, int maxprerounds, SCIP_Bool delaysepa, SCIP_Bool delayprop, SCIP_Bool needscons, SCIP_PROPTIMING proptiming, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSFREE((*consfree)), SCIP_DECL_CONSINIT((*consinit)), SCIP_DECL_CONSEXIT((*consexit)), SCIP_DECL_CONSINITPRE((*consinitpre)), SCIP_DECL_CONSEXITPRE((*consexitpre)), SCIP_DECL_CONSINITSOL((*consinitsol)), SCIP_DECL_CONSEXITSOL((*consexitsol)), SCIP_DECL_CONSDELETE((*consdelete)), SCIP_DECL_CONSTRANS((*constrans)), SCIP_DECL_CONSINITLP((*consinitlp)), SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFORELAX((*consenforelax)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSPROP((*consprop)), SCIP_DECL_CONSPRESOL((*conspresol)), SCIP_DECL_CONSRESPROP((*consresprop)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_DECL_CONSACTIVE((*consactive)), SCIP_DECL_CONSDEACTIVE((*consdeactive)), SCIP_DECL_CONSENABLE((*consenable)), SCIP_DECL_CONSDISABLE((*consdisable)), SCIP_DECL_CONSDELVARS((*consdelvars)), SCIP_DECL_CONSPRINT((*consprint)), SCIP_DECL_CONSCOPY((*conscopy)), SCIP_DECL_CONSPARSE((*consparse)), SCIP_DECL_CONSGETVARS((*consgetvars)), SCIP_DECL_CONSGETNVARS((*consgetnvars)), SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)), SCIP_DECL_CONSGETPERMSYMGRAPH((*consgetpermsymgraph)), SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH((*consgetsignedpermsymgraph)), SCIP_CONSHDLRDATA *conshdlrdata)
Definition: cons.c:2002
SCIP_RETCODE SCIPconshdlrsResetPropagationStatus(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_CONSHDLR **conshdlrs, int nconshdlrs)
Definition: cons.c:8166
void SCIPconshdlrSetExit(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXIT((*consexit)))
Definition: cons.c:4468
SCIP_RETCODE SCIPconshdlrCopyInclude(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_Bool *valid)
Definition: cons.c:1980
SCIP_RETCODE SCIPconsMarkConflict(SCIP_CONS *cons)
Definition: cons.c:7293
SCIP_RETCODE SCIPconsActivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Bool focusnode)
Definition: cons.c:7031
static SCIP_RETCODE conshdlrAddEnfocons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:977
static SCIP_RETCODE conshdlrEnableConsSeparation(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:1284
void SCIPconshdlrSetCopy(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), SCIP_DECL_CONSCOPY((*conscopy)))
Definition: cons.c:4431
void SCIPconshdlrSetDelvars(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELVARS((*consdelvars)))
Definition: cons.c:4640
static void conshdlrDelSepacons(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:931
void SCIPconshdlrSetEnable(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENABLE((*consenable)))
Definition: cons.c:4618
SCIP_CONS * SCIPconsGetTransformed(SCIP_CONS *cons)
Definition: cons.c:7021
#define AGERESETAVG_DECAY
Definition: cons.c:57
void SCIPconshdlrSetPrint(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRINT((*consprint)))
Definition: cons.c:4651
SCIP_RETCODE SCIPconshdlrPropagate(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Bool fullpropagation, SCIP_Bool execdelayed, SCIP_Bool instrongbranching, SCIP_PROPTIMING proptiming, SCIP_RESULT *result)
Definition: cons.c:3905
SCIP_RETCODE SCIPconsUnmarkPropagate(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7335
SCIP_RETCODE SCIPconshdlrGetDiveBoundChanges(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_DIVESET *diveset, SCIP_SOL *sol, SCIP_Bool *success, SCIP_Bool *infeasible)
Definition: cons.c:3589
static void conshdlrUpdateAgeresetavg(SCIP_CONSHDLR *conshdlr, SCIP_Real age)
Definition: cons.c:343
void SCIPconshdlrSetDeactive(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDEACTIVE((*consdeactive)))
Definition: cons.c:4607
static SCIP_RETCODE conshdlrAddPropcons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:1169
SCIP_RETCODE SCIPconshdlrPresolve(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PRESOLTIMING timing, int nrounds, int *nfixedvars, int *naggrvars, int *nchgvartypes, int *nchgbds, int *naddholes, int *ndelconss, int *naddconss, int *nupgdconss, int *nchgcoefs, int *nchgsides, SCIP_RESULT *result)
Definition: cons.c:4081
SCIP_RETCODE SCIPconsGetVars(SCIP_CONS *cons, SCIP_SET *set, SCIP_VAR **vars, int varssize, SCIP_Bool *success)
Definition: cons.c:6518
void SCIPconsSetNamePointer(SCIP_CONS *cons, const char *name)
Definition: cons.c:7007
SCIP_RETCODE SCIPconshdlrEnforcePseudoSol(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_BRANCHCAND *branchcand, SCIP_Bool solinfeasible, SCIP_Bool objinfeasible, SCIP_Bool forced, SCIP_RESULT *result)
Definition: cons.c:3624
SCIP_RETCODE SCIPconssetchgApply(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Bool focusnode)
Definition: cons.c:5760
SCIP_RETCODE SCIPconshdlrDelVars(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:4240
SCIP_RETCODE SCIPconsSetEnforced(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool enforce)
Definition: cons.c:6831
void SCIPconsSetModifiable(SCIP_CONS *cons, SCIP_Bool modifiable)
Definition: cons.c:6962
void SCIPconshdlrSetGetVars(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETVARS((*consgetvars)))
Definition: cons.c:4673
static SCIP_RETCODE conshdlrDeactivateCons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: cons.c:1607
void SCIPconshdlrSetExitpre(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITPRE((*consexitpre)))
Definition: cons.c:4512
SCIP_RETCODE SCIPconshdlrExitpre(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:2669
SCIP_RETCODE SCIPconshdlrInitsol(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:2714
SCIP_RETCODE SCIPconssetchgMakeGlobal(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_REOPT *reopt)
Definition: cons.c:5933
SCIP_RETCODE SCIPconshdlrCheck(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_Bool completely, SCIP_RESULT *result)
Definition: cons.c:3838
SCIP_RETCODE SCIPconshdlrExit(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:2530
static SCIP_RETCODE conshdlrActivateCons(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons, int depth, SCIP_Bool focusnode)
Definition: cons.c:1532
SCIP_RETCODE SCIPconshdlrFree(SCIP_CONSHDLR **conshdlr, SCIP_SET *set)
Definition: cons.c:2367
internal methods for constraints and constraint handlers
common defines and data types used in all packages of SCIP
#define NULL
Definition: def.h:248
#define SCIP_MAXSTRLEN
Definition: def.h:269
#define SCIP_Longint
Definition: def.h:141
#define SCIP_MAXTREEDEPTH
Definition: def.h:297
#define SCIP_Bool
Definition: def.h:91
#define MIN(x, y)
Definition: def.h:224
#define SCIP_ALLOC(x)
Definition: def.h:366
#define SCIP_Real
Definition: def.h:156
#define TRUE
Definition: def.h:93
#define FALSE
Definition: def.h:94
#define MAX(x, y)
Definition: def.h:220
#define SCIP_CALL(x)
Definition: def.h:355
#define SCIP_CALL_FINALLY(x, y)
Definition: def.h:397
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:208
int SCIPconshdlrGetNCheckConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4798
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
Definition: cons.c:4346
int SCIPconshdlrGetMaxNActiveConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5112
SCIP_Real SCIPconshdlrGetCheckTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4942
SCIP_PROPTIMING SCIPconshdlrGetPropTiming(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5403
SCIP_Bool SCIPconshdlrWasSolSeparationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5363
SCIP_Longint SCIPconshdlrGetNCheckCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5012
SCIP_CONS ** SCIPconshdlrGetCheckConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4755
int SCIPconshdlrGetNChgSides(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5222
SCIP_Real SCIPconshdlrGetPresolTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4872
int SCIPconshdlrGetEagerFreq(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5292
SCIP_Bool SCIPconshdlrDoesPresolve(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5323
void SCIPconshdlrSetProp(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPROP((*consprop)), int propfreq, SCIP_Bool delayprop, SCIP_PROPTIMING timingmask)
Definition: cons.c:4401
int SCIPconshdlrGetNFixedVars(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5132
SCIP_PRESOLTIMING SCIPconshdlrGetPresolTiming(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5425
SCIP_Real SCIPconshdlrGetEnfoLPTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4892
int SCIPconshdlrGetNPresolCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5232
SCIP_Longint SCIPconshdlrGetNDomredsFound(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5092
int SCIPconshdlrGetSepaPriority(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5242
SCIP_Longint SCIPconshdlrGetNCutsApplied(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5052
int SCIPconshdlrGetNChgCoefs(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5212
void SCIPconshdlrSetPresolTiming(SCIP_CONSHDLR *conshdlr, SCIP_PRESOLTIMING presoltiming)
Definition: cons.c:5435
void SCIPconshdlrMarkExact(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4370
int SCIPconshdlrGetNUpdateConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4832
SCIP_CONS ** SCIPconshdlrGetEnfoConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4745
void SCIPconshdlrSetSepa(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), int sepafreq, int sepapriority, SCIP_Bool delaysepa)
Definition: cons.c:4380
SCIP_Real SCIPconshdlrGetStrongBranchPropTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4932
void SCIPconshdlrSetEnforelax(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSENFORELAX((*consenforelax)))
Definition: cons.c:4420
SCIP_Longint SCIPconshdlrGetNCutsFound(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5042
SCIP_Bool SCIPconshdlrSupportsSignedPermsymDetection(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5456
SCIP_Bool SCIPconshdlrIsPropagationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5343
SCIP_Real SCIPconshdlrGetPropTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4922
void SCIPconssetchgGetAddedConsData(SCIP_CONSSETCHG *conssetchg, SCIP_CONS ***conss, int *nconss)
Definition: cons.c:5746
SCIP_Real SCIPconshdlrGetEnfoPSTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4902
int SCIPconshdlrGetPropFreq(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5282
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4778
SCIP_Longint SCIPconshdlrGetNCutoffs(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5032
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4316
int SCIPconshdlrGetNEnabledConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4822
SCIP_CONS ** SCIPconshdlrGetUpdateConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4768
SCIP_Bool SCIPconshdlrIsSeparationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5333
SCIP_Longint SCIPconshdlrGetNSepaCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4962
int SCIPconshdlrGetNDelConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5182
SCIP_DECL_SORTPTRCOMP(SCIPconshdlrCompSepa)
Definition: cons.c:1956
SCIP_Bool SCIPconshdlrWasLPSeparationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5353
SCIP_Longint SCIPconshdlrGetNChildren(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5102
SCIP_Real SCIPconshdlrGetEnfoRelaxTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4912
void SCIPconshdlrSetPropTiming(SCIP_CONSHDLR *conshdlr, SCIP_PROPTIMING proptiming)
Definition: cons.c:5413
SCIP_Bool SCIPconshdlrNeedsCons(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5302
int SCIPconshdlrGetNAggrVars(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5142
SCIP_Longint SCIPconshdlrGetNEnfoPSCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4982
int SCIPconshdlrGetNAddHoles(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5172
int SCIPconshdlrGetNEnfoConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4788
void SCIPconshdlrSetNeedsCons(SCIP_CONSHDLR *conshdlr, SCIP_Bool needscons)
Definition: cons.c:5312
SCIP_Bool SCIPconshdlrIsInitialized(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5383
int SCIPconshdlrGetNUpgdConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5202
int SCIPconshdlrGetStartNActiveConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5122
SCIP_Bool SCIPconshdlrIsExact(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4357
SCIP_Bool SCIPconshdlrWasPropagationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5373
int SCIPconshdlrGetNAddConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5192
SCIP_Bool SCIPconshdlrSupportsPermsymDetection(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5446
int SCIPconshdlrGetNChgBds(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5162
const char * SCIPconshdlrGetDesc(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4326
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4336
SCIP_Longint SCIPconshdlrGetNConssFound(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5082
int SCIPconshdlrGetNActiveConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4812
int SCIPconshdlrGetCheckPriority(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5262
int SCIPconshdlrGetSepaFreq(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5272
SCIP_Longint SCIPconshdlrGetNPropCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5002
SCIP_Longint SCIPconshdlrGetNEnfoLPCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4972
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4735
int SCIPconshdlrGetEnfoPriority(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5252
SCIP_Real SCIPconshdlrGetSetupTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4862
SCIP_Longint SCIPconshdlrGetNRespropCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5022
SCIP_Real SCIPconshdlrGetSepaTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4882
SCIP_Bool SCIPconshdlrIsClonable(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5393
int SCIPconshdlrGetNChgVarTypes(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:5152
SCIP_Real SCIPconshdlrGetRespropTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4952
SCIP_Longint SCIPconshdlrGetNEnfoRelaxCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4992
SCIP_Bool SCIPconsIsLockedNeg(SCIP_CONS *cons)
Definition: cons.c:8718
SCIP_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
Definition: cons.c:8419
void SCIPconsAddUpgradeLocks(SCIP_CONS *cons, int nlocks)
Definition: cons.c:8828
int SCIPconsGetPos(SCIP_CONS *cons)
Definition: cons.c:8399
SCIP_Bool SCIPconsIsConflict(SCIP_CONS *cons)
Definition: cons.c:8538
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
Definition: cons.c:8648
SCIP_Real SCIPconsGetAge(SCIP_CONS *cons)
Definition: cons.c:8548
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
Definition: cons.c:8409
int SCIPconsGetActiveDepth(SCIP_CONS *cons)
Definition: cons.c:8439
SCIP_Bool SCIPconsIsLockedPos(SCIP_CONS *cons)
Definition: cons.c:8708
SCIP_Bool SCIPconsIsPropagationEnabled(SCIP_CONS *cons)
Definition: cons.c:8507
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
Definition: cons.c:8558
int SCIPconsGetNUpgradeLocks(SCIP_CONS *cons)
Definition: cons.c:8841
SCIP_Bool SCIPconsIsMarkedPropagate(SCIP_CONS *cons)
Definition: cons.c:8598
int SCIPconsGetNLocksTypeNeg(SCIP_CONS *cons, SCIP_LOCKTYPE locktype)
Definition: cons.c:8806
int SCIPconsGetValidDepth(SCIP_CONS *cons)
Definition: cons.c:8472
SCIP_Bool SCIPconsIsOriginal(SCIP_CONS *cons)
Definition: cons.c:8688
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:8588
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
Definition: cons.c:8518
SCIP_Bool SCIPconsIsUpdatedeactivate(SCIP_CONS *cons)
Definition: cons.c:8460
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
Definition: cons.c:8698
int SCIPconsGetNLocksPos(SCIP_CONS *cons)
Definition: cons.c:8738
SCIP_Bool SCIPconsIsLockedType(SCIP_CONS *cons, SCIP_LOCKTYPE locktype)
Definition: cons.c:8782
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
Definition: cons.c:8578
SCIP_Bool SCIPconsIsInProb(SCIP_CONS *cons)
Definition: cons.c:8678
SCIP_Bool SCIPconsIsGlobal(SCIP_CONS *cons)
Definition: cons.c:8618
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:8450
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
Definition: cons.c:8608
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
Definition: cons.c:8628
int SCIPconsGetNLocksNeg(SCIP_CONS *cons)
Definition: cons.c:8748
int SCIPconsGetNUses(SCIP_CONS *cons)
Definition: cons.c:8429
SCIP_Bool SCIPconsIsLockedTypePos(SCIP_CONS *cons, SCIP_LOCKTYPE locktype)
Definition: cons.c:8758
SCIP_Bool SCIPconsIsEnabled(SCIP_CONS *cons)
Definition: cons.c:8486
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:8389
SCIP_Bool SCIPconsIsLocked(SCIP_CONS *cons)
Definition: cons.c:8728
SCIP_Bool SCIPconsIsSeparationEnabled(SCIP_CONS *cons)
Definition: cons.c:8496
SCIP_Bool SCIPconsIsLockedTypeNeg(SCIP_CONS *cons, SCIP_LOCKTYPE locktype)
Definition: cons.c:8770
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
Definition: cons.c:8638
SCIP_Bool SCIPconsIsAdded(SCIP_CONS *cons)
Definition: cons.c:8818
SCIP_Bool SCIPconsIsObsolete(SCIP_CONS *cons)
Definition: cons.c:8528
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
Definition: cons.c:8668
int SCIPconsGetNLocksTypePos(SCIP_CONS *cons, SCIP_LOCKTYPE locktype)
Definition: cons.c:8794
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
Definition: cons.c:8568
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
Definition: cons.c:8658
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:108
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:89
int SCIPlinConsStatsGetSum(SCIP_LINCONSSTATS *linconsstats)
Definition: cons.c:8273
void SCIPlinConsStatsIncTypeCount(SCIP_LINCONSSTATS *linconsstats, SCIP_LINCONSTYPE linconstype, int increment)
Definition: cons.c:8283
int SCIPlinConsStatsGetTypeCount(SCIP_LINCONSSTATS *linconsstats, SCIP_LINCONSTYPE linconstype)
Definition: cons.c:8260
void SCIPlinConsStatsFree(SCIP *scip, SCIP_LINCONSSTATS **linconsstats)
Definition: cons.c:8239
void SCIPlinConsStatsReset(SCIP_LINCONSSTATS *linconsstats)
Definition: cons.c:8251
void SCIPprintLinConsStats(SCIP *scip, FILE *file, SCIP_LINCONSSTATS *linconsstats)
Definition: cons.c:8299
SCIP_RETCODE SCIPlinConsStatsCreate(SCIP *scip, SCIP_LINCONSSTATS **linconsstats)
Definition: cons.c:8226
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:24142
SCIP_Real SCIPgetVarUbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
Definition: scip_var.c:2872
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:24120
SCIP_Real SCIPgetVarLbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
Definition: scip_var.c:2736
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10827
void SCIPstrCopySection(const char *str, char startchar, char endchar, char *token, int size, char **endptr)
Definition: misc.c:10985
SCIP_RETCODE SCIPskipSpace(char **s)
Definition: misc.c:10816
static const char * paramname[]
Definition: lpi_msk.c:5172
#define BMSduplicateBlockMemoryArray(mem, ptr, source, num)
Definition: memory.h:462
#define BMSfreeMemory(ptr)
Definition: memory.h:145
#define BMSfreeBlockMemory(mem, ptr)
Definition: memory.h:465
#define BMSallocBlockMemory(mem, ptr)
Definition: memory.h:451
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:127
#define BMSfreeBlockMemoryArrayNull(mem, ptr, num)
Definition: memory.h:468
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:143
#define BMSclearMemory(ptr)
Definition: memory.h:129
#define BMScopyMemoryArray(ptr, source, num)
Definition: memory.h:134
#define BMSfreeBlockMemoryArray(mem, ptr, num)
Definition: memory.h:467
#define BMSreallocBlockMemoryArray(mem, ptr, oldnum, newnum)
Definition: memory.h:458
#define BMSclearMemoryArray(ptr, num)
Definition: memory.h:130
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:148
#define BMSallocMemory(ptr)
Definition: memory.h:118
void SCIPmessagePrintError(const char *formatstr,...)
Definition: message.c:791
void SCIPmessageFPrintInfo(SCIP_MESSAGEHDLR *messagehdlr, FILE *file, const char *formatstr,...)
Definition: message.c:618
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:427
SCIP_RETCODE SCIPprobDelCons(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: prob.c:1578
SCIP_RETCODE SCIPprobAddCons(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: prob.c:1507
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:64
#define SCIPdebugMessage
Definition: pub_message.h:96
public data structures and miscellaneous methods
SCIP_Bool SCIPreoptConsCanBeDeleted(SCIP_REOPT *reopt, SCIP_CONS *cons)
Definition: reopt.c:8284
data structures and methods for collecting reoptimization information
SCIP callable library.
static SCIP_RETCODE separate(SCIP *scip, SCIP_SEPA *sepa, SCIP_SOL *sol, SCIP_RESULT *result)
Main separation function.
Definition: sepa_flower.c:1221
int SCIPsepastoreGetNCuts(SCIP_SEPASTORE *sepastore)
Definition: sepastore.c:1183
internal methods for storing separated cuts
SCIP_RETCODE SCIPsetAddIntParam(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: set.c:3229
SCIP_RETCODE SCIPsetAddBoolParam(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: set.c:3207
SCIP_CONSHDLR * SCIPsetFindConshdlr(SCIP_SET *set, const char *name)
Definition: set.c:4244
SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
Definition: set.c:3197
int SCIPsetCalcMemGrowSize(SCIP_SET *set, int num)
Definition: set.c:6080
internal methods for global SCIP settings
#define SCIPsetDebugMsg
Definition: set.h:1811
internal methods for problem statistics
SCIP_CONS ** addedconss
Definition: struct_cons.h:118
SCIP_CONS ** disabledconss
Definition: struct_cons.h:119
unsigned int initial
Definition: struct_cons.h:71
int nlocksneg[NLOCKTYPES]
Definition: struct_cons.h:65
unsigned int updatefree
Definition: struct_cons.h:106
unsigned int updatesepaenable
Definition: struct_cons.h:101
int validdepth
Definition: struct_cons.h:67
SCIP_CONSDATA * consdata
Definition: struct_cons.h:51
unsigned int enabled
Definition: struct_cons.h:91
int enfoconsspos
Definition: struct_cons.h:60
SCIP_Real age
Definition: struct_cons.h:48
unsigned int dynamic
Definition: struct_cons.h:80
int addarraypos
Definition: struct_cons.h:56
int nupgradelocks
Definition: struct_cons.h:69
unsigned int propagate
Definition: struct_cons.h:75
unsigned int updateobsolete
Definition: struct_cons.h:105
unsigned int updatesepadisable
Definition: struct_cons.h:102
SCIP_CONSSETCHG * addconssetchg
Definition: struct_cons.h:54
char * name
Definition: struct_cons.h:49
unsigned int updateenable
Definition: struct_cons.h:99
unsigned int updateactfocus
Definition: struct_cons.h:107
int sepaconsspos
Definition: struct_cons.h:59
unsigned int updateunmarkpropagate
Definition: struct_cons.h:109
unsigned int deleted
Definition: struct_cons.h:94
unsigned int updateactivate
Definition: struct_cons.h:97
unsigned int local
Definition: struct_cons.h:78
SCIP_CONS * transorigcons
Definition: struct_cons.h:52
int propconsspos
Definition: struct_cons.h:62
SCIP * scip
Definition: struct_cons.h:111
unsigned int updatedisable
Definition: struct_cons.h:100
unsigned int updatedeactivate
Definition: struct_cons.h:98
int activedepth
Definition: struct_cons.h:66
unsigned int active
Definition: struct_cons.h:85
unsigned int removable
Definition: struct_cons.h:81
unsigned int updatepropenable
Definition: struct_cons.h:103
unsigned int enforce
Definition: struct_cons.h:73
SCIP_CONSHDLR * conshdlr
Definition: struct_cons.h:50
unsigned int modifiable
Definition: struct_cons.h:79
int checkconsspos
Definition: struct_cons.h:61
unsigned int conflict
Definition: struct_cons.h:90
unsigned int original
Definition: struct_cons.h:83
unsigned int separate
Definition: struct_cons.h:72
unsigned int sepaenabled
Definition: struct_cons.h:76
int consspos
Definition: struct_cons.h:57
unsigned int obsolete
Definition: struct_cons.h:92
unsigned int update
Definition: struct_cons.h:95
int initconsspos
Definition: struct_cons.h:58
unsigned int stickingatnode
Definition: struct_cons.h:82
unsigned int propenabled
Definition: struct_cons.h:77
unsigned int check
Definition: struct_cons.h:74
int nlockspos[NLOCKTYPES]
Definition: struct_cons.h:64
unsigned int markpropagate
Definition: struct_cons.h:93
unsigned int updatemarkpropagate
Definition: struct_cons.h:108
unsigned int updatepropdisable
Definition: struct_cons.h:104
unsigned int updateinsert
Definition: struct_cons.h:96
SCIP_Longint nsepacalls
Definition: struct_cons.h:129
SCIP_CONS ** conss
Definition: struct_cons.h:191
int nusefulcheckconss
Definition: struct_cons.h:243
SCIP_CONS ** checkconss
Definition: struct_cons.h:198
int nusefulenfoconss
Definition: struct_cons.h:240
SCIP_CLOCK * presoltime
Definition: struct_cons.h:205
SCIP_RESULT lastenfolpresult
Definition: struct_cons.h:150
SCIP_Longint ndomredsfound
Definition: struct_cons.h:140
SCIP_PRESOLTIMING presoltiming
Definition: struct_cons.h:289
SCIP_CLOCK * enfopstime
Definition: struct_cons.h:208
SCIP_Longint lastenfolpdomchgcount
Definition: struct_cons.h:144
SCIP_CLOCK * enforelaxtime
Definition: struct_cons.h:209
int nusefulsepaconss
Definition: struct_cons.h:237
SCIP_Bool delayprop
Definition: struct_cons.h:279
int storednmarkedpropconss
Definition: struct_cons.h:249
SCIP_CLOCK * enfolptime
Definition: struct_cons.h:207
SCIP_Longint nenfolpcalls
Definition: struct_cons.h:130
SCIP_Longint ncutoffs
Definition: struct_cons.h:136
int storedpropconsssize
Definition: struct_cons.h:248
SCIP_CLOCK * proptime
Definition: struct_cons.h:210
SCIP_Longint ncheckcalls
Definition: struct_cons.h:134
SCIP_CLOCK * checktime
Definition: struct_cons.h:212
SCIP_RESULT lastenfopsresult
Definition: struct_cons.h:151
SCIP_Bool initialized
Definition: struct_cons.h:285
SCIP_Bool duringsepa
Definition: struct_cons.h:286
SCIP_CLOCK * sbproptime
Definition: struct_cons.h:211
int nusefulpropconss
Definition: struct_cons.h:247
SCIP_Longint nenforelaxcalls
Definition: struct_cons.h:132
SCIP_Longint lastsepalpcount
Definition: struct_cons.h:214
SCIP_Longint lastenfolplpcount
Definition: struct_cons.h:215
int lastnusefulpropconss
Definition: struct_cons.h:253
SCIP_Bool sepasolwasdelayed
Definition: struct_cons.h:282
SCIP_Bool propwasdelayed
Definition: struct_cons.h:283
SCIP_Bool sepalpwasdelayed
Definition: struct_cons.h:281
SCIP_Longint ncutsapplied
Definition: struct_cons.h:138
SCIP_CLOCK * resproptime
Definition: struct_cons.h:213
SCIP_RESULT lastenforelaxresult
Definition: struct_cons.h:152
int lastnusefulenfoconss
Definition: struct_cons.h:255
int nmarkedpropconss
Definition: struct_cons.h:246
int startnactiveconss
Definition: struct_cons.h:229
SCIP_Longint nchildren
Definition: struct_cons.h:141
SCIP_Longint nenfopscalls
Definition: struct_cons.h:131
SCIP_Longint lastenforelaxrelaxcount
Definition: struct_cons.h:216
SCIP_Bool needscons
Definition: struct_cons.h:280
int delayupdatecount
Definition: struct_cons.h:277
SCIP_Real ageresetavg
Definition: struct_cons.h:153
SCIP_Longint storedpropdomchgcount
Definition: struct_cons.h:143
SCIP_CONS ** sepaconss
Definition: struct_cons.h:196
SCIP_Longint lastenfolpnode
Definition: struct_cons.h:147
SCIP_PROPTIMING proptiming
Definition: struct_cons.h:288
SCIP_Bool delaysepa
Definition: struct_cons.h:278
SCIP_CONS ** enfoconss
Definition: struct_cons.h:197
SCIP_Longint lastenforelaxnode
Definition: struct_cons.h:149
SCIP_CONS ** initconss
Definition: struct_cons.h:195
SCIP_CONS ** storedpropconss
Definition: struct_cons.h:200
SCIP_Bool duringprop
Definition: struct_cons.h:287
SCIP_Longint lastpropdomchgcount
Definition: struct_cons.h:142
SCIP_Longint ncutsfound
Definition: struct_cons.h:137
SCIP_Longint lastenfopsnode
Definition: struct_cons.h:148
SCIP_Longint lastenforelaxdomchgcount
Definition: struct_cons.h:146
SCIP_Longint nrespropcalls
Definition: struct_cons.h:135
SCIP_Longint npropcalls
Definition: struct_cons.h:133
SCIP_CONSHDLRDATA * conshdlrdata
Definition: struct_cons.h:190
SCIP_CLOCK * sepatime
Definition: struct_cons.h:206
SCIP_CONS ** propconss
Definition: struct_cons.h:199
SCIP_CONS ** updateconss
Definition: struct_cons.h:203
int lastnusefulsepaconss
Definition: struct_cons.h:254
SCIP_Bool exact
Definition: struct_cons.h:284
int lastnchgvartypes
Definition: struct_cons.h:258
SCIP_CLOCK * setuptime
Definition: struct_cons.h:204
SCIP_Longint nconssfound
Definition: struct_cons.h:139
SCIP_Longint lastenfopsdomchgcount
Definition: struct_cons.h:145
int counter[SCIP_NLINCONSTYPES]
Definition: struct_cons.h:295
SCIP_Longint nnodes
Definition: struct_stat.h:84
SCIP_Longint domchgcount
Definition: struct_stat.h:116
SCIP_Longint lpcount
Definition: struct_stat.h:205
SCIP_Longint nprobholechgs
Definition: struct_stat.h:120
SCIP_Longint ninitconssadded
Definition: struct_stat.h:125
SCIP_Longint relaxcount
Definition: struct_stat.h:206
SCIP_Longint nboundchgs
Definition: struct_stat.h:117
SCIP_Longint nholechgs
Definition: struct_stat.h:118
int nenabledconss
Definition: struct_stat.h:276
int nactiveconss
Definition: struct_stat.h:275
SCIP_Longint nprobboundchgs
Definition: struct_stat.h:119
int nchildren
Definition: struct_tree.h:226
datastructures for constraints and constraint handlers
Definition: heur_padm.c:135
SCIP_Bool SCIPtreeProbing(SCIP_TREE *tree)
Definition: tree.c:9361
int SCIPtreeGetCurrentDepth(SCIP_TREE *tree)
Definition: tree.c:9479
internal methods for branch and bound tree
@ SCIP_CLOCKTYPE_DEFAULT
Definition: type_clock.h:43
#define SCIP_DECL_CONSGETSIGNEDPERMSYMGRAPH(x)
Definition: type_cons.h:955
#define SCIP_DECL_CONSGETPERMSYMGRAPH(x)
Definition: type_cons.h:937
#define SCIP_DECL_CONSINITPRE(x)
Definition: type_cons.h:156
#define SCIP_DECL_CONSEXIT(x)
Definition: type_cons.h:136
#define SCIP_DECL_CONSGETVARS(x)
Definition: type_cons.h:866
#define SCIP_DECL_CONSINITSOL(x)
Definition: type_cons.h:201
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
Definition: type_cons.h:64
#define SCIP_DECL_CONSDISABLE(x)
Definition: type_cons.h:735
#define SCIP_DECL_CONSENFORELAX(x)
Definition: type_cons.h:388
#define SCIP_DECL_CONSGETDIVEBDCHGS(x)
Definition: type_cons.h:919
#define SCIP_DECL_CONSGETNVARS(x)
Definition: type_cons.h:884
#define SCIP_DECL_CONSRESPROP(x)
Definition: type_cons.h:611
@ SCIP_LINCONSTYPE_BINPACKING
Definition: type_cons.h:85
@ SCIP_LINCONSTYPE_VARBOUND
Definition: type_cons.h:78
@ SCIP_LINCONSTYPE_EMPTY
Definition: type_cons.h:73
@ SCIP_LINCONSTYPE_INVKNAPSACK
Definition: type_cons.h:83
@ SCIP_LINCONSTYPE_PRECEDENCE
Definition: type_cons.h:77
@ SCIP_LINCONSTYPE_AGGREGATION
Definition: type_cons.h:76
@ SCIP_LINCONSTYPE_MIXEDBINARY
Definition: type_cons.h:88
@ SCIP_LINCONSTYPE_SINGLETON
Definition: type_cons.h:75
@ SCIP_LINCONSTYPE_SETCOVERING
Definition: type_cons.h:81
@ SCIP_LINCONSTYPE_EQKNAPSACK
Definition: type_cons.h:84
@ SCIP_LINCONSTYPE_FREE
Definition: type_cons.h:74
@ SCIP_LINCONSTYPE_KNAPSACK
Definition: type_cons.h:86
@ SCIP_LINCONSTYPE_SETPARTITION
Definition: type_cons.h:79
@ SCIP_LINCONSTYPE_INTKNAPSACK
Definition: type_cons.h:87
@ SCIP_LINCONSTYPE_SETPACKING
Definition: type_cons.h:80
@ SCIP_LINCONSTYPE_GENERAL
Definition: type_cons.h:89
@ SCIP_LINCONSTYPE_CARDINALITY
Definition: type_cons.h:82
#define SCIP_DECL_CONSACTIVE(x)
Definition: type_cons.h:690
#define SCIP_DECL_CONSPARSE(x)
Definition: type_cons.h:844
#define SCIP_DECL_CONSDEACTIVE(x)
Definition: type_cons.h:705
#define SCIP_DECL_CONSPRESOL(x)
Definition: type_cons.h:560
#define SCIP_DECL_CONSENABLE(x)
Definition: type_cons.h:720
#define SCIP_DECL_CONSINITLP(x)
Definition: type_cons.h:259
#define SCIP_DECL_CONSEXITPRE(x)
Definition: type_cons.h:180
#define SCIP_DECL_CONSINIT(x)
Definition: type_cons.h:126
struct SCIP_ConsData SCIP_CONSDATA
Definition: type_cons.h:65
#define SCIP_DECL_CONSHDLRCOPY(x)
Definition: type_cons.h:108
#define SCIP_DECL_CONSEXITSOL(x)
Definition: type_cons.h:216
#define SCIP_NLINCONSTYPES
Definition: type_cons.h:93
#define SCIP_DECL_CONSFREE(x)
Definition: type_cons.h:116
enum SCIP_LinConstype SCIP_LINCONSTYPE
Definition: type_cons.h:91
@ SCIP_BOUNDTYPE_UPPER
Definition: type_lp.h:58
@ SCIP_BOUNDTYPE_LOWER
Definition: type_lp.h:57
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:60
@ SCIP_DIDNOTRUN
Definition: type_result.h:42
@ SCIP_CUTOFF
Definition: type_result.h:48
@ SCIP_FEASIBLE
Definition: type_result.h:45
@ SCIP_DELAYED
Definition: type_result.h:43
@ SCIP_REDUCEDDOM
Definition: type_result.h:51
@ SCIP_DIDNOTFIND
Definition: type_result.h:44
@ SCIP_CONSADDED
Definition: type_result.h:52
@ SCIP_UNBOUNDED
Definition: type_result.h:47
@ SCIP_BRANCHED
Definition: type_result.h:54
@ SCIP_SEPARATED
Definition: type_result.h:49
@ SCIP_SOLVELP
Definition: type_result.h:55
@ SCIP_NEWROUND
Definition: type_result.h:50
@ SCIP_SUCCESS
Definition: type_result.h:58
@ SCIP_DELAYNODE
Definition: type_result.h:59
@ SCIP_INFEASIBLE
Definition: type_result.h:46
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:61
@ SCIP_INVALIDRESULT
Definition: type_retcode.h:53
@ SCIP_PLUGINNOTFOUND
Definition: type_retcode.h:54
@ SCIP_PARAMETERWRONGVAL
Definition: type_retcode.h:57
@ SCIP_OKAY
Definition: type_retcode.h:42
@ SCIP_INVALIDCALL
Definition: type_retcode.h:51
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
@ SCIP_STAGE_PROBLEM
Definition: type_set.h:45
@ SCIP_STAGE_PRESOLVING
Definition: type_set.h:49
#define SCIP_PRESOLTIMING_MAX
Definition: type_timing.h:59
#define SCIP_PRESOLTIMING_FINAL
Definition: type_timing.h:55
unsigned int SCIP_PROPTIMING
Definition: type_timing.h:75
#define SCIP_PRESOLTIMING_MEDIUM
Definition: type_timing.h:53
unsigned int SCIP_PRESOLTIMING
Definition: type_timing.h:61
#define SCIP_PROPTIMING_AFTERLPLOOP
Definition: type_timing.h:68
#define SCIP_PRESOLTIMING_FAST
Definition: type_timing.h:52
#define SCIP_PRESOLTIMING_EXHAUSTIVE
Definition: type_timing.h:54
#define SCIP_PROPTIMING_BEFORELP
Definition: type_timing.h:66
#define SCIP_PROPTIMING_ALWAYS
Definition: type_timing.h:73
#define SCIP_PROPTIMING_DURINGLPLOOP
Definition: type_timing.h:67
#define NLOCKTYPES
Definition: type_var.h:138
enum SCIP_LockType SCIP_LOCKTYPE
Definition: type_var.h:144
@ SCIP_LOCKTYPE_MODEL
Definition: type_var.h:141
internal methods for problem variables