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