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-2016 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_NONE || 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, /**< Do constraints represented by rows in the current LP have 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  /* perform the cached constraint updates */
3510  SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3511 
3512  /* evaluate result */
3513  if( *result != SCIP_INFEASIBLE && *result != SCIP_FEASIBLE )
3514  {
3515  SCIPerrorMessage("feasibility check of constraint handler <%s> returned invalid result <%d>\n", conshdlr->name, *result);
3516  return SCIP_INVALIDRESULT;
3517  }
3518  }
3519 
3520  return SCIP_OKAY;
3521 }
3522 
3523 /** calls propagation method of constraint handler */
3525  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3526  BMS_BLKMEM* blkmem, /**< block memory */
3527  SCIP_SET* set, /**< global SCIP settings */
3528  SCIP_STAT* stat, /**< dynamic problem statistics */
3529  int depth, /**< depth of current node */
3530  SCIP_Bool fullpropagation, /**< should all constraints be propagated (or only new ones)? */
3531  SCIP_Bool execdelayed, /**< execute propagation method even if it is marked to be delayed */
3532  SCIP_Bool instrongbranching, /**< are we currently doing strong branching? */
3533  SCIP_PROPTIMING proptiming, /**< current point in the node solving process */
3534  SCIP_RESULT* result /**< pointer to store the result of the callback method */
3535  )
3536 {
3537  assert(conshdlr != NULL);
3538  assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3539  assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3540  assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3541  assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3542  assert(stat != NULL);
3543  assert(conshdlr->lastpropdomchgcount != stat->domchgcount
3544  || (0 <= conshdlr->lastnusefulpropconss && conshdlr->lastnusefulpropconss <= conshdlr->nusefulpropconss));
3545  assert(set != NULL);
3546  assert(depth >= 0);
3547  assert(result != NULL);
3548 
3549  *result = SCIP_DIDNOTRUN;
3550 
3551  if( conshdlr->consprop != NULL
3552  && (!conshdlr->needscons || conshdlr->npropconss > 0)
3553  && ((depth == 0 && conshdlr->propfreq == 0)
3554  || (conshdlr->propfreq > 0 && depth % conshdlr->propfreq == 0)
3555  || conshdlr->propwasdelayed) )
3556  {
3557  /* check, if propagation method should be delayed */
3558  if( !conshdlr->delayprop || execdelayed )
3559  {
3560  int nconss;
3561  int nusefulconss;
3562  int nmarkedpropconss;
3563  int firstcons;
3564 
3565  nmarkedpropconss = conshdlr->nmarkedpropconss;
3566 
3567  /* check, if the current domains were already propagated */
3568  if( !fullpropagation && conshdlr->lastpropdomchgcount == stat->domchgcount )
3569  {
3570  /* all constraints that were not yet propagated on the new domains must be useful constraints, which means,
3571  * that the new constraints are the last constraints of the useful ones
3572  */
3573  nconss = conshdlr->nusefulpropconss - conshdlr->lastnusefulpropconss;
3574  nusefulconss = nconss;
3575  firstcons = conshdlr->lastnusefulpropconss;
3576  }
3577  else
3578  {
3579  /* on new domains, we want to propagate all constraints */
3580  nconss = conshdlr->npropconss;
3581  nusefulconss = conshdlr->nusefulpropconss;
3582  firstcons = 0;
3583  }
3584  assert(firstcons >= 0);
3585  assert(firstcons + nconss <= conshdlr->npropconss);
3586  assert(nusefulconss <= nconss);
3587 
3588  /* constraint handlers without constraints should only be called once */
3589  if( nconss > 0 || fullpropagation
3590  || (!conshdlr->needscons && conshdlr->lastpropdomchgcount != stat->domchgcount) )
3591  {
3592  SCIP_CONS** conss;
3593  SCIP_Longint oldndomchgs;
3594  SCIP_Longint oldnprobdomchgs;
3595  SCIP_Longint lastpropdomchgcount;
3596  int lastnusefulpropconss;
3597 
3598  SCIPdebugMessage("propagating constraints %d to %d of %d constraints of handler <%s> (%s pseudo solution, %d useful)\n",
3599  firstcons, firstcons + nconss - 1, conshdlr->npropconss, conshdlr->name,
3600  !fullpropagation && conshdlr->lastpropdomchgcount == stat->domchgcount ? "old" : "new", nusefulconss);
3601 
3602  /* remember the number of processed constraints on the current domains */
3603  lastpropdomchgcount = stat->domchgcount;
3604  lastnusefulpropconss = conshdlr->nusefulpropconss;
3605 
3606  /* get the array of the constraints to be processed */
3607  conss = &(conshdlr->propconss[firstcons]);
3608 
3609  oldndomchgs = stat->nboundchgs + stat->nholechgs;
3610  oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
3611 
3612  /* check, if we want to use eager evaluation */
3613  if( (conshdlr->eagerfreq == 0 && conshdlr->npropcalls == 0)
3614  || (conshdlr->eagerfreq > 0 && conshdlr->npropcalls % conshdlr->eagerfreq == 0) )
3615  nusefulconss = nconss;
3616 
3617  /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3618  * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3619  * external method; to avoid this, these changes will be buffered and processed after the method call
3620  */
3621  conshdlrDelayUpdates(conshdlr);
3622  conshdlr->duringprop = TRUE;
3623 
3624  /* start timing */
3625  if( instrongbranching )
3626  SCIPclockStart(conshdlr->sbproptime, set);
3627  else
3628  SCIPclockStart(conshdlr->proptime, set);
3629 
3630  /* call external method */
3631  SCIP_CALL( conshdlr->consprop(set->scip, conshdlr, conss, nconss, nusefulconss, nmarkedpropconss, proptiming, result) );
3632  SCIPdebugMessage(" -> propagation returned result <%d>\n", *result);
3633 
3634  /* stop timing */
3635  if( instrongbranching )
3636  SCIPclockStop(conshdlr->sbproptime, set);
3637  else
3638  SCIPclockStop(conshdlr->proptime, set);
3639 
3640  /* perform the cached constraint updates */
3641  conshdlr->duringprop = FALSE;
3642  SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3643 
3644  /* update statistics */
3645  if( *result != SCIP_DIDNOTRUN && *result != SCIP_DELAYED )
3646  {
3647  conshdlr->lastpropdomchgcount = lastpropdomchgcount;
3648  conshdlr->lastnusefulpropconss = MIN(conshdlr->nusefulpropconss, lastnusefulpropconss);
3649  conshdlr->npropcalls++;
3650  }
3651  else
3652  {
3653  assert(lastpropdomchgcount == stat->domchgcount);
3654  assert(lastnusefulpropconss == conshdlr->nusefulpropconss);
3655  }
3656  if( *result == SCIP_CUTOFF )
3657  conshdlr->ncutoffs++;
3658 
3659  /* update domain reductions; therefore remove the domain
3660  * reduction counts which were generated in probing mode */
3661  conshdlr->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
3662  conshdlr->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
3663 
3664  /* check result code of callback method */
3665  if( *result != SCIP_CUTOFF
3666  && *result != SCIP_REDUCEDDOM
3667  && *result != SCIP_DIDNOTFIND
3668  && *result != SCIP_DIDNOTRUN
3669  && *result != SCIP_DELAYED )
3670  {
3671  SCIPerrorMessage("propagation method of constraint handler <%s> returned invalid result <%d>\n",
3672  conshdlr->name, *result);
3673  return SCIP_INVALIDRESULT;
3674  }
3675  }
3676  }
3677  else
3678  {
3679  SCIPdebugMessage("propagation method of constraint handler <%s> was delayed\n", conshdlr->name);
3680  *result = SCIP_DELAYED;
3681  }
3682 
3683  /* remember whether propagation method was delayed */
3684  conshdlr->propwasdelayed = (*result == SCIP_DELAYED);
3685  }
3686 
3687  return SCIP_OKAY;
3688 }
3689 
3690 /** calls presolving method of constraint handler */
3692  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3693  BMS_BLKMEM* blkmem, /**< block memory */
3694  SCIP_SET* set, /**< global SCIP settings */
3695  SCIP_STAT* stat, /**< dynamic problem statistics */
3696  SCIP_PRESOLTIMING timing, /**< current presolving timing */
3697  int nrounds, /**< number of presolving rounds already done */
3698  int* nfixedvars, /**< pointer to total number of variables fixed of all presolvers */
3699  int* naggrvars, /**< pointer to total number of variables aggregated of all presolvers */
3700  int* nchgvartypes, /**< pointer to total number of variable type changes of all presolvers */
3701  int* nchgbds, /**< pointer to total number of variable bounds tightened of all presolvers */
3702  int* naddholes, /**< pointer to total number of domain holes added of all presolvers */
3703  int* ndelconss, /**< pointer to total number of deleted constraints of all presolvers */
3704  int* naddconss, /**< pointer to total number of added constraints of all presolvers */
3705  int* nupgdconss, /**< pointer to total number of upgraded constraints of all presolvers */
3706  int* nchgcoefs, /**< pointer to total number of changed coefficients of all presolvers */
3707  int* nchgsides, /**< pointer to total number of changed left/right hand sides of all presolvers */
3708  SCIP_RESULT* result /**< pointer to store the result of the callback method */
3709  )
3710 {
3711  assert(conshdlr != NULL);
3712  assert(conshdlr->nusefulsepaconss <= conshdlr->nsepaconss);
3713  assert(conshdlr->nusefulenfoconss <= conshdlr->nenfoconss);
3714  assert(conshdlr->nusefulcheckconss <= conshdlr->ncheckconss);
3715  assert(conshdlr->nusefulpropconss <= conshdlr->npropconss);
3716  assert(set != NULL);
3717  assert(nfixedvars != NULL);
3718  assert(naggrvars != NULL);
3719  assert(nchgvartypes != NULL);
3720  assert(nchgbds != NULL);
3721  assert(naddholes != NULL);
3722  assert(ndelconss != NULL);
3723  assert(naddconss != NULL);
3724  assert(nupgdconss != NULL);
3725  assert(nchgcoefs != NULL);
3726  assert(nchgsides != NULL);
3727  assert(result != NULL);
3728 
3729  *result = SCIP_DIDNOTRUN;
3730 
3731  if( conshdlr->conspresol != NULL
3732  && (!conshdlr->needscons || conshdlr->nactiveconss > 0)
3733  && (conshdlr->maxprerounds == -1 || nrounds < conshdlr->maxprerounds ) )
3734  {
3735  SCIPdebugMessage("presolving %d constraints of handler <%s>\n", conshdlr->nactiveconss, conshdlr->name);
3736 
3737  /* check, if presolving method should be executed for the current timing */
3738  if( timing & conshdlr->presoltiming )
3739  {
3740  int nnewfixedvars;
3741  int nnewaggrvars;
3742  int nnewchgvartypes;
3743  int nnewchgbds;
3744  int nnewholes;
3745  int nnewdelconss;
3746  int nnewaddconss;
3747  int nnewupgdconss;
3748  int nnewchgcoefs;
3749  int nnewchgsides;
3750 
3751  /* calculate the number of changes since last call */
3752  nnewfixedvars = *nfixedvars - conshdlr->lastnfixedvars;
3753  nnewaggrvars = *naggrvars - conshdlr->lastnaggrvars;
3754  nnewchgvartypes = *nchgvartypes - conshdlr->lastnchgvartypes;
3755  nnewchgbds = *nchgbds - conshdlr->lastnchgbds;
3756  nnewholes = *naddholes - conshdlr->lastnaddholes;
3757  nnewdelconss = *ndelconss - conshdlr->lastndelconss;
3758  nnewaddconss = *naddconss - conshdlr->lastnaddconss;
3759  nnewupgdconss = *nupgdconss - conshdlr->lastnupgdconss;
3760  nnewchgcoefs = *nchgcoefs - conshdlr->lastnchgcoefs;
3761  nnewchgsides = *nchgsides - conshdlr->lastnchgsides;
3762 
3763  /* remember the old number of changes */
3764  conshdlr->lastnfixedvars = *nfixedvars;
3765  conshdlr->lastnaggrvars = *naggrvars;
3766  conshdlr->lastnchgvartypes = *nchgvartypes;
3767  conshdlr->lastnchgbds = *nchgbds;
3768  conshdlr->lastnaddholes = *naddholes;
3769  conshdlr->lastndelconss = *ndelconss;
3770  conshdlr->lastnaddconss = *naddconss;
3771  conshdlr->lastnupgdconss = *nupgdconss;
3772  conshdlr->lastnchgcoefs = *nchgcoefs;
3773  conshdlr->lastnchgsides = *nchgsides;
3774 
3775  /* because during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3776  * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3777  * external method; to avoid this, these changes will be buffered and processed after the method call
3778  */
3779  conshdlrDelayUpdates(conshdlr);
3780 
3781  /* start timing */
3782  SCIPclockStart(conshdlr->presoltime, set);
3783 
3784  /* call external method */
3785  SCIP_CALL( conshdlr->conspresol(set->scip, conshdlr, conshdlr->conss, conshdlr->nactiveconss, nrounds, timing,
3786  nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewholes,
3787  nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides,
3788  nfixedvars, naggrvars, nchgvartypes, nchgbds, naddholes,
3789  ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides, result) );
3790 
3791  /* stop timing */
3792  SCIPclockStop(conshdlr->presoltime, set);
3793 
3794  /* perform the cached constraint updates */
3795  SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3796 
3797  /* count the new changes */
3798  conshdlr->nfixedvars += *nfixedvars - conshdlr->lastnfixedvars;
3799  conshdlr->naggrvars += *naggrvars - conshdlr->lastnaggrvars;
3800  conshdlr->nchgvartypes += *nchgvartypes - conshdlr->lastnchgvartypes;
3801  conshdlr->nchgbds += *nchgbds - conshdlr->lastnchgbds;
3802  conshdlr->naddholes += *naddholes - conshdlr->lastnaddholes;
3803  conshdlr->ndelconss += *ndelconss - conshdlr->lastndelconss;
3804  conshdlr->naddconss += *naddconss - conshdlr->lastnaddconss;
3805  conshdlr->nupgdconss += *nupgdconss - conshdlr->lastnupgdconss;
3806  conshdlr->nchgcoefs += *nchgcoefs - conshdlr->lastnchgcoefs;
3807  conshdlr->nchgsides += *nchgsides - conshdlr->lastnchgsides;
3808 
3809  /* check result code of callback method */
3810  if( *result != SCIP_CUTOFF
3811  && *result != SCIP_UNBOUNDED
3812  && *result != SCIP_SUCCESS
3813  && *result != SCIP_DIDNOTFIND
3814  && *result != SCIP_DIDNOTRUN
3815  && *result != SCIP_DELAYED )
3816  {
3817  SCIPerrorMessage("presolving method of constraint handler <%s> returned invalid result <%d>\n",
3818  conshdlr->name, *result);
3819  return SCIP_INVALIDRESULT;
3820  }
3821 
3822  /* increase the number of calls, if the presolving method tried to find reductions */
3823  if( *result != SCIP_DIDNOTRUN )
3824  ++(conshdlr->npresolcalls);
3825  }
3826 
3827  SCIPdebugMessage("after presolving %d constraints left of handler <%s>\n", conshdlr->nactiveconss, conshdlr->name);
3828  }
3829 
3830  return SCIP_OKAY;
3831 }
3832 
3833 /** calls variable deletion method of constraint handler */
3835  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3836  BMS_BLKMEM* blkmem, /**< block memory */
3837  SCIP_SET* set, /**< global SCIP settings */
3838  SCIP_STAT* stat /**< dynamic problem statistics */
3839  )
3840 {
3841  assert(conshdlr != NULL);
3842  assert(set != NULL);
3843 
3844  if( conshdlr->consdelvars != NULL )
3845  {
3846  SCIPdebugMessage("deleting variables in constraints of handler <%s>\n", conshdlr->name);
3847 
3848  /* during constraint processing, constraints of this handler may be deleted, activated, deactivated,
3849  * enabled, disabled, marked obsolete or useful, which would change the conss array given to the
3850  * external method; to avoid this, these changes will be buffered and processed after the method call
3851  */
3852  conshdlrDelayUpdates(conshdlr);
3853 
3854  /* call external method */
3855  SCIP_CALL( conshdlr->consdelvars(set->scip, conshdlr, conshdlr->conss, conshdlr->nconss) );
3856 
3857  /* perform the cached constraint updates */
3858  SCIP_CALL( conshdlrForceUpdates(conshdlr, blkmem, set, stat) );
3859  }
3860 
3861  return SCIP_OKAY;
3862 }
3863 
3864 /** locks rounding of variables involved in the given constraint constraint handler that doesn't need constraints */
3866  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3867  SCIP_SET* set /**< global SCIP settings */
3868  )
3869 {
3870  assert(conshdlr != NULL);
3871  assert(conshdlr->conslock != NULL);
3872  assert(!conshdlr->needscons);
3873 
3874  SCIP_CALL( conshdlr->conslock(set->scip, conshdlr, NULL, +1, 0) );
3875 
3876  return SCIP_OKAY;
3877 }
3878 
3879 /** unlocks rounding of variables involved in the given constraint constraint handler that doesn't need constraints */
3881  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3882  SCIP_SET* set /**< global SCIP settings */
3883  )
3884 {
3885  assert(conshdlr != NULL);
3886  assert(conshdlr->conslock != NULL);
3887  assert(!conshdlr->needscons);
3888 
3889  SCIP_CALL( conshdlr->conslock(set->scip, conshdlr, NULL, -1, 0) );
3890 
3891  return SCIP_OKAY;
3892 }
3893 
3894 /** gets name of constraint handler */
3895 const char* SCIPconshdlrGetName(
3896  SCIP_CONSHDLR* conshdlr /**< constraint handler */
3897  )
3898 {
3899  assert(conshdlr != NULL);
3900 
3901  return conshdlr->name;
3902 }
3903 
3904 /** gets description of constraint handler */
3905 const char* SCIPconshdlrGetDesc(
3906  SCIP_CONSHDLR* conshdlr /**< constraint handler */
3907  )
3908 {
3909  assert(conshdlr != NULL);
3910 
3911  return conshdlr->desc;
3912 }
3913 
3914 /** gets user data of constraint handler */
3916  SCIP_CONSHDLR* conshdlr /**< constraint handler */
3917  )
3918 {
3919  assert(conshdlr != NULL);
3920 
3921  return conshdlr->conshdlrdata;
3922 }
3923 
3924 /** sets user data of constraint handler; user has to free old data in advance! */
3925 void SCIPconshdlrSetData(
3926  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3927  SCIP_CONSHDLRDATA* conshdlrdata /**< new constraint handler user data */
3928  )
3929 {
3930  assert(conshdlr != NULL);
3931 
3932  conshdlr->conshdlrdata = conshdlrdata;
3933 }
3934 
3935 /** sets all separation related callbacks of the constraint handler */
3936 void SCIPconshdlrSetSepa(
3937  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3938  SCIP_DECL_CONSSEPALP ((*conssepalp)), /**< separate cutting planes for LP solution */
3939  SCIP_DECL_CONSSEPASOL ((*conssepasol)), /**< separate cutting planes for arbitrary primal solution */
3940  int sepafreq, /**< frequency for separating cuts; zero means to separate only in the root node */
3941  int sepapriority, /**< priority of the constraint handler for separation */
3942  SCIP_Bool delaysepa /**< should separation method be delayed, if other separators found cuts? */
3943  )
3944 {
3945  assert(conshdlr != NULL);
3946 
3947  assert(conssepalp != NULL || conssepasol != NULL || sepafreq == -1);
3948 
3949  conshdlr->conssepalp = conssepalp;
3950  conshdlr->conssepasol = conssepasol;
3951  conshdlr->sepafreq = sepafreq;
3952  conshdlr->sepapriority = sepapriority;
3953  conshdlr->delaysepa = delaysepa;
3954 }
3955 
3956 /** sets both the propagation callback and the propagation frequency of the constraint handler */
3957 void SCIPconshdlrSetProp(
3958  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3959  SCIP_DECL_CONSPROP ((*consprop)), /**< propagate variable domains */
3960  int propfreq, /**< frequency for propagating domains; zero means only preprocessing propagation */
3961  SCIP_Bool delayprop, /**< should propagation method be delayed, if other propagators found reductions? */
3962  SCIP_PROPTIMING timingmask /**< positions in the node solving loop where propagators should be executed */
3963  )
3964 {
3965  assert(conshdlr != NULL);
3966 
3967  assert(consprop != NULL || propfreq == -1);
3968 
3969  conshdlr->consprop = consprop;
3970  conshdlr->propfreq = propfreq;
3971  conshdlr->delayprop = delayprop;
3972  conshdlr->proptiming = timingmask;
3973 }
3974 
3975 /** sets copy method of both the constraint handler and each associated constraint */
3976 void SCIPconshdlrSetCopy(
3977  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3978  SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)), /**< copy method of constraint handler or NULL if you don't want to copy your plugin into sub-SCIPs */
3979  SCIP_DECL_CONSCOPY ((*conscopy)) /**< constraint copying method */
3980  )
3981 {
3982  assert(conshdlr != NULL);
3983 
3984  assert(!conshdlr->needscons || (conshdlrcopy == NULL) == (conscopy == NULL));
3985 
3986  conshdlr->conshdlrcopy = conshdlrcopy;
3987  conshdlr->conscopy = conscopy;
3988 }
3989 
3990 /** sets destructor method of constraint handler */
3991 void SCIPconshdlrSetFree(
3992  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
3993  SCIP_DECL_CONSFREE ((*consfree)) /**< destructor of constraint handler */
3994  )
3995 {
3996  assert(conshdlr != NULL);
3997 
3998  conshdlr->consfree = consfree;
3999 }
4000 
4001 /** sets initialization method of constraint handler */
4002 void SCIPconshdlrSetInit(
4003  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4004  SCIP_DECL_CONSINIT ((*consinit)) /**< initialize constraint handler */
4005  )
4006 {
4007  assert(conshdlr != NULL);
4008 
4009  conshdlr->consinit = consinit;
4010 }
4011 
4012 /** sets deinitialization method of constraint handler */
4013 void SCIPconshdlrSetExit(
4014  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4015  SCIP_DECL_CONSEXIT ((*consexit)) /**< deinitialize constraint handler */
4016  )
4017 {
4018  assert(conshdlr != NULL);
4019 
4020  conshdlr->consexit = consexit;
4021 }
4022 
4023 /** sets solving process initialization method of constraint handler */
4025  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4026  SCIP_DECL_CONSINITSOL((*consinitsol)) /**< solving process initialization method of constraint handler */
4027  )
4028 {
4029  assert(conshdlr != NULL);
4030 
4031  conshdlr->consinitsol = consinitsol;
4032 }
4033 
4034 /** sets solving process deinitialization method of constraint handler */
4036  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4037  SCIP_DECL_CONSEXITSOL ((*consexitsol)) /**< solving process deinitialization method of constraint handler */
4038  )
4039 {
4040  assert(conshdlr != NULL);
4041 
4042  conshdlr->consexitsol = consexitsol;
4043 }
4044 
4045 /** sets preprocessing initialization method of constraint handler */
4047  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4048  SCIP_DECL_CONSINITPRE((*consinitpre)) /**< preprocessing initialization method of constraint handler */
4049  )
4050 {
4051  assert(conshdlr != NULL);
4052 
4053  conshdlr->consinitpre = consinitpre;
4054 }
4055 
4056 /** sets preprocessing deinitialization method of constraint handler */
4058  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4059  SCIP_DECL_CONSEXITPRE((*consexitpre)) /**< preprocessing deinitialization method of constraint handler */
4060  )
4061 {
4062  assert(conshdlr != NULL);
4063 
4064  conshdlr->consexitpre = consexitpre;
4065 }
4066 
4067 /** sets presolving method of constraint handler */
4069  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4070  SCIP_DECL_CONSPRESOL ((*conspresol)), /**< presolving method of constraint handler */
4071  int maxprerounds, /**< maximal number of presolving rounds the constraint handler participates in (-1: no limit) */
4072  SCIP_PRESOLTIMING presoltiming /**< timing mask of the constraint handler's presolving method */
4073  )
4074 {
4075  assert(conshdlr != NULL);
4076 
4077  conshdlr->conspresol = conspresol;
4078  conshdlr->maxprerounds = maxprerounds;
4079 
4080  /* the interface change from delay flags to timings cannot be recognized at compile time: Exit with an appropriate
4081  * error message
4082  */
4083  if( presoltiming < SCIP_PRESOLTIMING_FAST || presoltiming > SCIP_PRESOLTIMING_ALWAYS )
4084  {
4085  SCIPmessagePrintError("ERROR: 'PRESOLDELAY'-flag no longer available since SCIP 3.2, use an appropriate "
4086  "'SCIP_PRESOLTIMING' for <%s> constraint handler instead.\n", conshdlr->name);
4087 
4088  return SCIP_PARAMETERWRONGVAL;
4089  }
4090 
4091  conshdlr->presoltiming = presoltiming;
4092 
4093  return SCIP_OKAY;
4094 }
4095 
4096 /** sets method of constraint handler to free specific constraint data */
4098  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4099  SCIP_DECL_CONSDELETE ((*consdelete)) /**< free specific constraint data */
4100  )
4101 {
4102  assert(conshdlr != NULL);
4103 
4104  conshdlr->consdelete = consdelete;
4105 }
4106 
4107 /** sets method of constraint handler to transform constraint data into data belonging to the transformed problem */
4109  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4110  SCIP_DECL_CONSTRANS ((*constrans)) /**< transform constraint data into data belonging to the transformed problem */
4111  )
4112 {
4113  assert(conshdlr != NULL);
4114 
4115  conshdlr->constrans = constrans;
4116 }
4117 
4118 /** sets method of constraint handler to initialize LP with relaxations of "initial" constraints */
4120  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4121  SCIP_DECL_CONSINITLP ((*consinitlp)) /**< initialize LP with relaxations of "initial" constraints */
4122  )
4123 {
4124  assert(conshdlr != NULL);
4125 
4126  conshdlr->consinitlp = consinitlp;
4127 }
4128 
4129 /** sets propagation conflict resolving method of constraint handler */
4131  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4132  SCIP_DECL_CONSRESPROP ((*consresprop)) /**< propagation conflict resolving method */
4133  )
4134 {
4135  assert(conshdlr != NULL);
4136 
4137  conshdlr->consresprop = consresprop;
4138 }
4139 
4140 /** sets activation notification method of constraint handler */
4142  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4143  SCIP_DECL_CONSACTIVE ((*consactive)) /**< activation notification method */
4144  )
4145 {
4146  assert(conshdlr != NULL);
4147 
4148  conshdlr->consactive = consactive;
4149 }
4150 
4151 /** sets deactivation notification method of constraint handler */
4153  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4154  SCIP_DECL_CONSDEACTIVE((*consdeactive)) /**< deactivation notification method */
4155  )
4156 {
4157  assert(conshdlr != NULL);
4158 
4159  conshdlr->consdeactive = consdeactive;
4160 }
4161 
4162 /** sets enabling notification method of constraint handler */
4164  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4165  SCIP_DECL_CONSENABLE ((*consenable)) /**< enabling notification method */
4166  )
4167 {
4168  assert(conshdlr != NULL);
4169 
4170  conshdlr->consenable = consenable;
4171 }
4172 
4173 /** sets disabling notification method of constraint handler */
4175  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4176  SCIP_DECL_CONSDISABLE ((*consdisable)) /**< disabling notification method */
4177  )
4178 {
4179  assert(conshdlr != NULL);
4180 
4181  conshdlr->consdisable = consdisable;
4182 }
4183 
4184 /** sets variable deletion method of constraint handler */
4186  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4187  SCIP_DECL_CONSDELVARS ((*consdelvars)) /**< variable deletion method */
4188  )
4189 {
4190  assert(conshdlr != NULL);
4191 
4192  conshdlr->consdelvars = consdelvars;
4193 }
4194 
4195 /** sets constraint display method of constraint handler */
4197  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4198  SCIP_DECL_CONSPRINT ((*consprint)) /**< constraint display method */
4199  )
4200 {
4201  assert(conshdlr != NULL);
4202 
4203  conshdlr->consprint = consprint;
4204 }
4205 
4206 /** sets constraint parsing method of constraint handler */
4208  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4209  SCIP_DECL_CONSPARSE ((*consparse)) /**< constraint parsing method */
4210  )
4211 {
4212  assert(conshdlr != NULL);
4213 
4214  conshdlr->consparse = consparse;
4215 }
4216 
4217 /** sets constraint variable getter method of constraint handler */
4219  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4220  SCIP_DECL_CONSGETVARS ((*consgetvars)) /**< constraint variable getter method */
4221  )
4222 {
4223  assert(conshdlr != NULL);
4224 
4225  conshdlr->consgetvars = consgetvars;
4226 }
4227 
4228 /** sets constraint variable number getter method of constraint handler */
4230  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4231  SCIP_DECL_CONSGETNVARS((*consgetnvars)) /**< constraint variable number getter method */
4232  )
4233 {
4234  assert(conshdlr != NULL);
4235 
4236  conshdlr->consgetnvars = consgetnvars;
4237 }
4238 
4239 /** sets diving enforcement method of constraint handler */
4241  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4242  SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)) /**< constraint handler diving solution enforcement method */
4243  )
4244 {
4245  assert(conshdlr != NULL);
4246 
4247  conshdlr->consgetdivebdchgs = consgetdivebdchgs;
4248 }
4249 
4250 /** gets array with constraints of constraint handler; the first SCIPconshdlrGetNActiveConss() entries are the active
4251  * constraints, the last SCIPconshdlrGetNConss() - SCIPconshdlrGetNActiveConss() constraints are deactivated
4252  *
4253  * @note A constraint is active if it is global and was not removed or it was added locally (in that case the local
4254  * flag is TRUE) and the current node belongs to the corresponding sub tree.
4255  */
4257  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4258  )
4259 {
4260  assert(conshdlr != NULL);
4261 
4262  return conshdlr->conss;
4263 }
4264 
4265 /** gets array with enforced constraints of constraint handler; this is local information */
4267  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4268  )
4269 {
4270  assert(conshdlr != NULL);
4271 
4272  return conshdlr->enfoconss;
4273 }
4274 
4275 /** gets array with checked constraints of constraint handler; this is local information */
4277  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4278  )
4279 {
4280  assert(conshdlr != NULL);
4281 
4282  return conshdlr->checkconss;
4283 }
4284 
4285 /** gets total number of existing transformed constraints of constraint handler */
4287  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4288  )
4289 {
4290  assert(conshdlr != NULL);
4291 
4292  return conshdlr->nconss;
4293 }
4294 
4295 /** gets number of enforced constraints of constraint handler; this is local information */
4297  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4298  )
4299 {
4300  assert(conshdlr != NULL);
4301 
4302  return conshdlr->nenfoconss;
4303 }
4304 
4305 /** gets number of checked constraints of constraint handler; this is local information */
4307  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4308  )
4309 {
4310  assert(conshdlr != NULL);
4311 
4312  return conshdlr->ncheckconss;
4313 }
4314 
4315 /** gets number of active constraints of constraint handler
4316  *
4317  * @note A constraint is active if it is global and was not removed or it was added locally (in that case the local
4318  * flag is TRUE) and the current node belongs to the corresponding sub tree.
4319  */
4321  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4322  )
4323 {
4324  assert(conshdlr != NULL);
4325 
4326  return conshdlr->nactiveconss;
4327 }
4328 
4329 /** gets number of enabled constraints of constraint handler */
4331  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4332  )
4333 {
4334  assert(conshdlr != NULL);
4335 
4336  return conshdlr->nenabledconss;
4337 }
4338 
4339 /** enables or disables all clocks of \p conshdlr, depending on the value of the flag */
4341  SCIP_CONSHDLR* conshdlr, /**< the constraint handler for which all clocks should be enabled or disabled */
4342  SCIP_Bool enable /**< should the clocks of the constraint handler be enabled? */
4343  )
4344 {
4345  assert(conshdlr != NULL);
4346 
4347  SCIPclockEnableOrDisable(conshdlr->setuptime, enable);
4348  SCIPclockEnableOrDisable(conshdlr->checktime, enable);
4349  SCIPclockEnableOrDisable(conshdlr->enfolptime, enable);
4350  SCIPclockEnableOrDisable(conshdlr->enfopstime, enable);
4351  SCIPclockEnableOrDisable(conshdlr->presoltime, enable);
4352  SCIPclockEnableOrDisable(conshdlr->proptime, enable);
4353  SCIPclockEnableOrDisable(conshdlr->resproptime, enable);
4354  SCIPclockEnableOrDisable(conshdlr->sbproptime, enable);
4355  SCIPclockEnableOrDisable(conshdlr->sepatime, enable);
4356 }
4357 
4358 /** gets time in seconds used for setting up this constraint handler for new stages */
4360  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4361  )
4362 {
4363  assert(conshdlr != NULL);
4364 
4365  return SCIPclockGetTime(conshdlr->setuptime);
4366 }
4367 
4368 /** gets time in seconds used for presolving in this constraint handler */
4370  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4371  )
4372 {
4373  assert(conshdlr != NULL);
4374 
4375  return SCIPclockGetTime(conshdlr->presoltime);
4376 }
4377 
4378 /** gets time in seconds used for separation in this constraint handler */
4380  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4381  )
4382 {
4383  assert(conshdlr != NULL);
4384 
4385  return SCIPclockGetTime(conshdlr->sepatime);
4386 }
4387 
4388 /** gets time in seconds used for LP enforcement in this constraint handler */
4390  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4391  )
4392 {
4393  assert(conshdlr != NULL);
4394 
4395  return SCIPclockGetTime(conshdlr->enfolptime);
4396 }
4397 
4398 /** gets time in seconds used for pseudo enforcement in this constraint handler */
4400  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4401  )
4402 {
4403  assert(conshdlr != NULL);
4404 
4405  return SCIPclockGetTime(conshdlr->enfopstime);
4406 }
4407 
4408 /** gets time in seconds used for propagation in this constraint handler */
4410  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4411  )
4412 {
4413  assert(conshdlr != NULL);
4414 
4415  return SCIPclockGetTime(conshdlr->proptime);
4416 }
4417 
4418 /** gets time in seconds used for propagation in this constraint handler during strong branching */
4420  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4421  )
4422 {
4423  assert(conshdlr != NULL);
4424 
4425  return SCIPclockGetTime(conshdlr->sbproptime);
4426 }
4427 
4428 /** gets time in seconds used for feasibility checking in this constraint handler */
4430  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4431  )
4432 {
4433  assert(conshdlr != NULL);
4434 
4435  return SCIPclockGetTime(conshdlr->checktime);
4436 }
4437 
4438 /** gets time in seconds used for resolving propagation in this constraint handler */
4440  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4441  )
4442 {
4443  assert(conshdlr != NULL);
4444 
4445  return SCIPclockGetTime(conshdlr->resproptime);
4446 }
4447 
4448 /** gets number of calls to the constraint handler's separation method */
4450  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4451  )
4452 {
4453  assert(conshdlr != NULL);
4454 
4455  return conshdlr->nsepacalls;
4456 }
4457 
4458 /** gets number of calls to the constraint handler's LP enforcing method */
4460  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4461  )
4462 {
4463  assert(conshdlr != NULL);
4464 
4465  return conshdlr->nenfolpcalls;
4466 }
4467 
4468 /** gets number of calls to the constraint handler's pseudo enforcing method */
4470  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4471  )
4472 {
4473  assert(conshdlr != NULL);
4474 
4475  return conshdlr->nenfopscalls;
4476 }
4477 
4478 /** gets number of calls to the constraint handler's propagation method */
4480  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4481  )
4482 {
4483  assert(conshdlr != NULL);
4484 
4485  return conshdlr->npropcalls;
4486 }
4487 
4488 /** gets number of calls to the constraint handler's checking method */
4490  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4491  )
4492 {
4493  assert(conshdlr != NULL);
4494 
4495  return conshdlr->ncheckcalls;
4496 }
4497 
4498 /** gets number of calls to the constraint handler's resolve propagation method */
4500  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4501  )
4502 {
4503  assert(conshdlr != NULL);
4504 
4505  return conshdlr->nrespropcalls;
4506 }
4507 
4508 /** gets total number of times, this constraint handler detected a cutoff */
4510  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4511  )
4512 {
4513  assert(conshdlr != NULL);
4514 
4515  return conshdlr->ncutoffs;
4516 }
4517 
4518 /** gets total number of cuts found by this constraint handler */
4520  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4521  )
4522 {
4523  assert(conshdlr != NULL);
4524 
4525  return conshdlr->ncutsfound;
4526 }
4527 
4528 /** gets total number of cuts found by this constraint handler applied to lp */
4530  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4531  )
4532 {
4533  assert(conshdlr != NULL);
4534 
4535  return conshdlr->ncutsapplied;
4536 }
4537 
4538 /** increase count of applied cuts */
4540  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4541  )
4542 {
4543  assert(conshdlr != NULL);
4544 
4545  ++conshdlr->ncutsapplied;
4546 }
4547 
4548 /** increase count of found cuts */
4550  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4551  )
4552 {
4553  assert(conshdlr != NULL);
4554 
4555  ++conshdlr->ncutsfound;
4556 }
4557 
4558 /** gets total number of additional constraints added by this constraint handler */
4560  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4561  )
4562 {
4563  assert(conshdlr != NULL);
4564 
4565  return conshdlr->nconssfound;
4566 }
4567 
4568 /** gets total number of domain reductions found by this constraint handler */
4570  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4571  )
4572 {
4573  assert(conshdlr != NULL);
4574 
4575  return conshdlr->ndomredsfound;
4576 }
4577 
4578 /** gets number of children created by this constraint handler */
4580  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4581  )
4582 {
4583  assert(conshdlr != NULL);
4584 
4585  return conshdlr->nchildren;
4586 }
4587 
4588 /** gets maximum number of active constraints of constraint handler existing at the same time */
4590  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4591  )
4592 {
4593  assert(conshdlr != NULL);
4594 
4595  return conshdlr->maxnactiveconss;
4596 }
4597 
4598 /** gets initial number of active constraints of constraint handler */
4600  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4601  )
4602 {
4603  assert(conshdlr != NULL);
4604 
4605  return conshdlr->startnactiveconss;
4606 }
4607 
4608 /** gets number of variables fixed in presolving method of constraint handler */
4610  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4611  )
4612 {
4613  assert(conshdlr != NULL);
4614 
4615  return conshdlr->nfixedvars;
4616 }
4617 
4618 /** gets number of variables aggregated in presolving method of constraint handler */
4620  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4621  )
4622 {
4623  assert(conshdlr != NULL);
4624 
4625  return conshdlr->naggrvars;
4626 }
4627 
4628 /** gets number of variable types changed in presolving method of constraint handler */
4630  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4631  )
4632 {
4633  assert(conshdlr != NULL);
4634 
4635  return conshdlr->nchgvartypes;
4636 }
4637 
4638 /** gets number of bounds changed in presolving method of constraint handler */
4640  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4641  )
4642 {
4643  assert(conshdlr != NULL);
4644 
4645  return conshdlr->nchgbds;
4646 }
4647 
4648 /** gets number of holes added to domains of variables in presolving method of constraint handler */
4650  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4651  )
4652 {
4653  assert(conshdlr != NULL);
4654 
4655  return conshdlr->naddholes;
4656 }
4657 
4658 /** gets number of constraints deleted in presolving method of constraint handler */
4660  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4661  )
4662 {
4663  assert(conshdlr != NULL);
4664 
4665  return conshdlr->ndelconss;
4666 }
4667 
4668 /** gets number of constraints added in presolving method of constraint handler */
4670  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4671  )
4672 {
4673  assert(conshdlr != NULL);
4674 
4675  return conshdlr->naddconss;
4676 }
4677 
4678 /** gets number of constraints upgraded in presolving method of constraint handler */
4680  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4681  )
4682 {
4683  assert(conshdlr != NULL);
4684 
4685  return conshdlr->nupgdconss;
4686 }
4687 
4688 /** gets number of coefficients changed in presolving method of constraint handler */
4690  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4691  )
4692 {
4693  assert(conshdlr != NULL);
4694 
4695  return conshdlr->nchgcoefs;
4696 }
4697 
4698 /** gets number of constraint sides changed in presolving method of constraint handler */
4700  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4701  )
4702 {
4703  assert(conshdlr != NULL);
4704 
4705  return conshdlr->nchgsides;
4706 }
4707 
4708 /** gets number of times the presolving method of the constraint handler was called and tried to find reductions */
4710  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4711  )
4712 {
4713  assert(conshdlr != NULL);
4714 
4715  return conshdlr->npresolcalls;
4716 }
4717 
4718 /** gets separation priority of constraint handler */
4720  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4721  )
4722 {
4723  assert(conshdlr != NULL);
4724 
4725  return conshdlr->sepapriority;
4726 }
4727 
4728 /** gets enforcing priority of constraint handler */
4730  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4731  )
4732 {
4733  assert(conshdlr != NULL);
4734 
4735  return conshdlr->enfopriority;
4736 }
4737 
4738 /** gets checking priority of constraint handler */
4740  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4741  )
4742 {
4743  assert(conshdlr != NULL);
4744 
4745  return conshdlr->checkpriority;
4746 }
4747 
4748 /** gets separation frequency of constraint handler */
4750  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4751  )
4752 {
4753  assert(conshdlr != NULL);
4754 
4755  return conshdlr->sepafreq;
4756 }
4757 
4758 /** gets propagation frequency of constraint handler */
4760  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4761  )
4762 {
4763  assert(conshdlr != NULL);
4764 
4765  return conshdlr->propfreq;
4766 }
4767 
4768 /** gets frequency of constraint handler for eager evaluations in separation, propagation and enforcement */
4770  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4771  )
4772 {
4773  assert(conshdlr != NULL);
4774 
4775  return conshdlr->eagerfreq;
4776 }
4777 
4778 /** needs constraint handler a constraint to be called? */
4780  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4781  )
4782 {
4783  assert(conshdlr != NULL);
4784 
4785  return conshdlr->needscons;
4786 }
4787 
4788 /** does the constraint handler perform presolving? */
4790  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4791  )
4792 {
4793  assert(conshdlr != NULL);
4794 
4795  return (conshdlr->conspresol != NULL);
4796 }
4797 
4798 /** should separation method be delayed, if other separators found cuts? */
4800  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4801  )
4802 {
4803  assert(conshdlr != NULL);
4804 
4805  return conshdlr->delaysepa;
4806 }
4807 
4808 /** should propagation method be delayed, if other propagators found reductions? */
4810  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4811  )
4812 {
4813  assert(conshdlr != NULL);
4814 
4815  return conshdlr->delayprop;
4816 }
4817 
4818 /** was LP separation method delayed at the last call? */
4820  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4821  )
4822 {
4823  assert(conshdlr != NULL);
4824 
4825  return conshdlr->sepalpwasdelayed;
4826 }
4827 
4828 /** was primal solution separation method delayed at the last call? */
4830  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4831  )
4832 {
4833  assert(conshdlr != NULL);
4834 
4835  return conshdlr->sepasolwasdelayed;
4836 }
4837 
4838 /** was propagation method delayed at the last call? */
4840  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4841  )
4842 {
4843  assert(conshdlr != NULL);
4844 
4845  return conshdlr->propwasdelayed;
4846 }
4847 
4848 /** is constraint handler initialized? */
4850  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4851  )
4852 {
4853  assert(conshdlr != NULL);
4854 
4855  return conshdlr->initialized;
4856 }
4857 
4858 /** does the constraint handler have a copy function? */
4860  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4861  )
4862 {
4863  assert(conshdlr != NULL);
4864 
4865  return (conshdlr->conshdlrcopy != NULL);
4866 }
4867 
4868 /** returns the timing mask of the propagation method of the constraint handler */
4870  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4871  )
4872 {
4873  assert(conshdlr != NULL);
4874 
4875  return conshdlr->proptiming;
4876 }
4877 
4878 /** sets the timing mask of the propagation method of the constraint handler */
4880  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4881  SCIP_PROPTIMING proptiming /**< timing mask to be set */
4882  )
4883 {
4884  assert(conshdlr != NULL);
4885 
4886  conshdlr->proptiming = proptiming;
4887 }
4888 
4889 
4890 /** returns the timing mask of the presolving method of the constraint handler */
4892  SCIP_CONSHDLR* conshdlr /**< constraint handler */
4893  )
4894 {
4895  assert(conshdlr != NULL);
4896 
4897  return conshdlr->presoltiming;
4898 }
4899 
4900 /** sets the timing mask of the presolving method of the constraint handler */
4902  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
4903  SCIP_PRESOLTIMING presoltiming /** timing mask to be set */
4904  )
4905 {
4906  assert(conshdlr != NULL);
4907 
4908  conshdlr->presoltiming = presoltiming;
4909 }
4910 
4911 
4912 /*
4913  * Constraint set change methods
4914  */
4915 
4916 /** creates empty constraint set change data */
4917 static
4919  SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data */
4920  BMS_BLKMEM* blkmem /**< block memory */
4921  )
4922 {
4923  assert(conssetchg != NULL);
4924  assert(blkmem != NULL);
4925 
4926  SCIP_ALLOC( BMSallocBlockMemory(blkmem, conssetchg) );
4927  (*conssetchg)->addedconss = NULL;
4928  (*conssetchg)->disabledconss = NULL;
4929  (*conssetchg)->addedconsssize = 0;
4930  (*conssetchg)->naddedconss = 0;
4931  (*conssetchg)->disabledconsssize = 0;
4932  (*conssetchg)->ndisabledconss = 0;
4933 
4934  return SCIP_OKAY;
4935 }
4936 
4937 /** releases all constraints of the constraint set change data */
4938 static
4940  SCIP_CONSSETCHG* conssetchg, /**< constraint set change data */
4941  BMS_BLKMEM* blkmem, /**< block memory */
4942  SCIP_SET* set /**< global SCIP settings */
4943  )
4944 {
4945  int i;
4946 
4947  assert(conssetchg != NULL);
4948 
4949  /* release constraints */
4950  for( i = 0; i < conssetchg->naddedconss; ++i )
4951  {
4952  if( conssetchg->addedconss[i] != NULL )
4953  {
4954  SCIP_CALL( SCIPconsRelease(&conssetchg->addedconss[i], blkmem, set) );
4955  }
4956  }
4957  for( i = 0; i < conssetchg->ndisabledconss; ++i )
4958  {
4959  if( conssetchg->disabledconss[i] != NULL )
4960  {
4961  SCIP_CALL( SCIPconsRelease(&conssetchg->disabledconss[i], blkmem, set) );
4962  }
4963  }
4964 
4965  return SCIP_OKAY;
4966 }
4967 
4968 /** frees constraint set change data and releases all included constraints */
4970  SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change */
4971  BMS_BLKMEM* blkmem, /**< block memory */
4972  SCIP_SET* set /**< global SCIP settings */
4973  )
4974 {
4975  assert(conssetchg != NULL);
4976  assert(blkmem != NULL);
4977 
4978  if( *conssetchg != NULL )
4979  {
4980  /* release constraints */
4981  SCIP_CALL( conssetchgRelease(*conssetchg, blkmem, set) );
4982 
4983  /* free memory */
4984  BMSfreeBlockMemoryArrayNull(blkmem, &(*conssetchg)->addedconss, (*conssetchg)->addedconsssize);
4985  BMSfreeBlockMemoryArrayNull(blkmem, &(*conssetchg)->disabledconss, (*conssetchg)->disabledconsssize);
4986  BMSfreeBlockMemory(blkmem, conssetchg);
4987  }
4988 
4989  return SCIP_OKAY;
4990 }
4991 
4992 /** ensures, that addedconss array can store at least num entries */
4993 static
4995  SCIP_CONSSETCHG* conssetchg, /**< constraint set change data structure */
4996  BMS_BLKMEM* blkmem, /**< block memory */
4997  SCIP_SET* set, /**< global SCIP settings */
4998  int num /**< minimum number of entries to store */
4999  )
5000 {
5001  assert(conssetchg != NULL);
5002 
5003  if( num > conssetchg->addedconsssize )
5004  {
5005  int newsize;
5006 
5007  newsize = SCIPsetCalcMemGrowSize(set, num);
5008  SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &conssetchg->addedconss, conssetchg->addedconsssize, newsize) );
5009  conssetchg->addedconsssize = newsize;
5010  }
5011  assert(num <= conssetchg->addedconsssize);
5012 
5013  return SCIP_OKAY;
5014 }
5015 
5016 /** ensures, that disabledconss array can store at least num entries */
5017 static
5019  SCIP_CONSSETCHG* conssetchg, /**< constraint set change data structure */
5020  BMS_BLKMEM* blkmem, /**< block memory */
5021  SCIP_SET* set, /**< global SCIP settings */
5022  int num /**< minimum number of entries to store */
5023  )
5024 {
5025  assert(conssetchg != NULL);
5026 
5027  if( num > conssetchg->disabledconsssize )
5028  {
5029  int newsize;
5030 
5031  newsize = SCIPsetCalcMemGrowSize(set, num);
5032  SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &conssetchg->disabledconss, conssetchg->disabledconsssize, newsize) );
5033  conssetchg->disabledconsssize = newsize;
5034  }
5035  assert(num <= conssetchg->disabledconsssize);
5036 
5037  return SCIP_OKAY;
5038 }
5039 
5040 /** adds constraint addition to constraint set changes, and captures constraint; activates constraint if the
5041  * constraint set change data is currently active
5042  */
5044  SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data structure */
5045  BMS_BLKMEM* blkmem, /**< block memory */
5046  SCIP_SET* set, /**< global SCIP settings */
5047  SCIP_STAT* stat, /**< dynamic problem statistics */
5048  SCIP_CONS* cons, /**< added constraint */
5049  int depth, /**< depth of constraint set change's node */
5050  SCIP_Bool focusnode, /**< does the constraint set change belong to the focus node? */
5051  SCIP_Bool active /**< is the constraint set change currently active? */
5052  )
5053 {
5054  assert(conssetchg != NULL);
5055  assert(cons != NULL);
5056 
5057  /* if constraint set change doesn't exist, create it */
5058  if( *conssetchg == NULL )
5059  {
5060  SCIP_CALL( conssetchgCreate(conssetchg, blkmem) );
5061  }
5062 
5063  /* add constraint to the addedconss array */
5064  SCIP_CALL( conssetchgEnsureAddedconssSize(*conssetchg, blkmem, set, (*conssetchg)->naddedconss+1) );
5065  (*conssetchg)->addedconss[(*conssetchg)->naddedconss] = cons;
5066  (*conssetchg)->naddedconss++;
5067 
5068  /* undelete constraint, if it was globally deleted in the past */
5069  cons->deleted = FALSE;
5070 
5071  /* capture constraint */
5072  SCIPconsCapture(cons);
5073 
5074  /* activate constraint, if node is active */
5075  if( active && !SCIPconsIsActive(cons) )
5076  {
5077  SCIP_CALL( SCIPconsActivate(cons, set, stat, depth, focusnode) );
5078  assert(SCIPconsIsActive(cons));
5079 
5080  /* remember, that this constraint set change data was responsible for the constraint's addition */
5081  cons->addconssetchg = *conssetchg;
5082  cons->addarraypos = (*conssetchg)->naddedconss-1;
5083  }
5084 
5085  return SCIP_OKAY;
5086 }
5087 
5088 /** adds constraint disabling to constraint set changes, and captures constraint */
5090  SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data structure */
5091  BMS_BLKMEM* blkmem, /**< block memory */
5092  SCIP_SET* set, /**< global SCIP settings */
5093  SCIP_CONS* cons /**< disabled constraint */
5094  )
5095 {
5096  assert(conssetchg != NULL);
5097  assert(cons != NULL);
5098 
5099  /* if constraint set change doesn't exist, create it */
5100  if( *conssetchg == NULL )
5101  {
5102  SCIP_CALL( conssetchgCreate(conssetchg, blkmem) );
5103  }
5104 
5105  /* add constraint to the disabledconss array */
5106  SCIP_CALL( conssetchgEnsureDisabledconssSize(*conssetchg, blkmem, set, (*conssetchg)->ndisabledconss+1) );
5107  (*conssetchg)->disabledconss[(*conssetchg)->ndisabledconss] = cons;
5108  (*conssetchg)->ndisabledconss++;
5109 
5110  /* capture constraint */
5111  SCIPconsCapture(cons);
5112 
5113  return SCIP_OKAY;
5114 }
5115 
5116 /** deactivates, deletes, and releases constraint from the addedconss array of the constraint set change data */
5117 static
5119  SCIP_CONSSETCHG* conssetchg, /**< constraint set change to delete constraint from */
5120  BMS_BLKMEM* blkmem, /**< block memory */
5121  SCIP_SET* set, /**< global SCIP settings */
5122  int arraypos /**< position of constraint in disabledconss array */
5123  )
5124 {
5125  SCIP_CONS* cons;
5126 
5127  assert(conssetchg != NULL);
5128  assert(conssetchg->addedconss != NULL);
5129  assert(0 <= arraypos && arraypos < conssetchg->naddedconss);
5130 
5131  cons = conssetchg->addedconss[arraypos];
5132  assert(cons != NULL);
5133 
5134  SCIPdebugMessage("delete added constraint <%s> at position %d from constraint set change data\n", cons->name, arraypos);
5135 
5136  /* remove the link to the constraint set change data */
5137  if( cons->addconssetchg == conssetchg )
5138  {
5139  cons->addconssetchg = NULL;
5140  cons->addarraypos = -1;
5141  }
5142 
5143  /* release constraint */
5144  SCIP_CALL( SCIPconsRelease(&conssetchg->addedconss[arraypos], blkmem, set) );
5145 
5146  /* we want to keep the order of the constraint additions: move all subsequent constraints one slot to the front */
5147  for( ; arraypos < conssetchg->naddedconss-1; ++arraypos )
5148  {
5149  conssetchg->addedconss[arraypos] = conssetchg->addedconss[arraypos+1];
5150  assert(conssetchg->addedconss[arraypos] != NULL);
5151  if( conssetchg->addedconss[arraypos]->addconssetchg == conssetchg )
5152  {
5153  assert(conssetchg->addedconss[arraypos]->addarraypos == arraypos+1);
5154  conssetchg->addedconss[arraypos]->addarraypos = arraypos;
5155  }
5156  }
5157  conssetchg->naddedconss--;
5158 
5159  return SCIP_OKAY;
5160 }
5161 
5162 /** deletes and releases deactivated constraint from the disabledconss array of the constraint set change data */
5163 static
5165  SCIP_CONSSETCHG* conssetchg, /**< constraint set change to apply */
5166  BMS_BLKMEM* blkmem, /**< block memory */
5167  SCIP_SET* set, /**< global SCIP settings */
5168  int arraypos /**< position of constraint in disabledconss array */
5169  )
5170 {
5171  assert(conssetchg != NULL);
5172  assert(0 <= arraypos && arraypos < conssetchg->ndisabledconss);
5173  assert(conssetchg->disabledconss[arraypos] != NULL);
5174 
5175  SCIPdebugMessage("delete disabled constraint <%s> at position %d from constraint set change data\n",
5176  conssetchg->disabledconss[arraypos]->name, arraypos);
5177 
5178  /* release constraint */
5179  SCIP_CALL( SCIPconsRelease(&conssetchg->disabledconss[arraypos], blkmem, set) );
5180 
5181  /* we want to keep the order of the constraint disablings: move all subsequent constraints one slot to the front */
5182  for( ; arraypos < conssetchg->ndisabledconss-1; ++arraypos )
5183  {
5184  conssetchg->disabledconss[arraypos] = conssetchg->disabledconss[arraypos+1];
5185  assert(conssetchg->disabledconss[arraypos] != NULL);
5186  }
5187  conssetchg->ndisabledconss--;
5188 
5189  return SCIP_OKAY;
5190 }
5191 
5192 /** applies constraint set change */
5194  SCIP_CONSSETCHG* conssetchg, /**< constraint set change to apply */
5195  BMS_BLKMEM* blkmem, /**< block memory */
5196  SCIP_SET* set, /**< global SCIP settings */
5197  SCIP_STAT* stat, /**< dynamic problem statistics */
5198  int depth, /**< depth of constraint set change's node */
5199  SCIP_Bool focusnode /**< does the constraint set change belong to the focus node? */
5200  )
5201 {
5202  SCIP_CONS* cons;
5203  int i;
5204 
5205  if( conssetchg == NULL )
5206  return SCIP_OKAY;
5207 
5208  SCIPdebugMessage("applying constraint set changes at %p: %d constraint additions, %d constraint disablings\n",
5209  (void*)conssetchg, conssetchg->naddedconss, conssetchg->ndisabledconss);
5210 
5211  /* apply constraint additions */
5212  i = 0;
5213  while( i < conssetchg->naddedconss )
5214  {
5215  cons = conssetchg->addedconss[i];
5216  assert(cons != NULL);
5217  assert(!cons->update);
5218 
5219  /* if constraint is already active, or if constraint is globally deleted, it can be removed from addedconss array */
5220  if( cons->active || cons->deleted )
5221  {
5222  /* delete constraint from addedcons array, the empty slot is now used by the next constraint,
5223  * and naddedconss was decreased, so do not increase i
5224  */
5225  SCIP_CALL( conssetchgDelAddedCons(conssetchg, blkmem, set, i) );
5226  }
5227  else
5228  {
5229  assert(cons->addconssetchg == NULL);
5230  assert(cons->addarraypos == -1);
5231 
5232  /* activate constraint */
5233  SCIP_CALL( SCIPconsActivate(cons, set, stat, depth, focusnode) );
5234  assert(cons->active);
5235  assert(!cons->update);
5236 
5237  /* remember, that this constraint set change data was responsible for the constraint's addition */
5238  cons->addconssetchg = conssetchg;
5239  cons->addarraypos = i;
5240 
5241  ++i; /* handle the next constraint */
5242  }
5243  }
5244 
5245  /* apply constraint disablings */
5246  i = 0;
5247  while( i < conssetchg->ndisabledconss )
5248  {
5249  cons = conssetchg->disabledconss[i];
5250  assert(cons != NULL);
5251  assert(!cons->update);
5252 
5253  /* if the constraint is disabled, we can permanently remove it from the disabledconss array */
5254  if( !cons->enabled )
5255  {
5256  SCIPdebugMessage("constraint <%s> of handler <%s> was deactivated -> remove it from disabledconss array\n",
5257  cons->name, cons->conshdlr->name);
5258 
5259  /* release and remove constraint from the disabledconss array, the empty slot is now used by the next constraint
5260  * and ndisabledconss was decreased, so do not increase i
5261  */
5262  SCIP_CALL( conssetchgDelDisabledCons(conssetchg, blkmem, set, i) );
5263  }
5264  else
5265  {
5266  assert(cons->addarraypos >= 0);
5267  assert(!cons->deleted); /* deleted constraints must not be enabled! */
5268  SCIP_CALL( SCIPconsDisable(conssetchg->disabledconss[i], set, stat) );
5269  assert(!cons->update);
5270  assert(!cons->enabled);
5271 
5272  ++i; /* handle the next constraint */
5273  }
5274  }
5275 
5276  return SCIP_OKAY;
5277 }
5278 
5279 /** undoes constraint set change */
5281  SCIP_CONSSETCHG* conssetchg, /**< constraint set change to undo */
5282  BMS_BLKMEM* blkmem, /**< block memory */
5283  SCIP_SET* set, /**< global SCIP settings */
5284  SCIP_STAT* stat /**< dynamic problem statistics */
5285  )
5286 {
5287  SCIP_CONS* cons;
5288  int i;
5289 
5290  if( conssetchg == NULL )
5291  return SCIP_OKAY;
5292 
5293  SCIPdebugMessage("undoing constraint set changes at %p: %d constraint additions, %d constraint disablings\n",
5294  (void*)conssetchg, conssetchg->naddedconss, conssetchg->ndisabledconss);
5295 
5296  /* undo constraint disablings */
5297  for( i = conssetchg->ndisabledconss-1; i >= 0; --i )
5298  {
5299  cons = conssetchg->disabledconss[i];
5300  assert(cons != NULL);
5301  assert(!cons->update);
5302 
5303  /* If the constraint is inactive, we can permanently remove it from the disabledconss array. It was deactivated
5304  * in the subtree of the current node but not reactivated on the switching way back to the current node, which
5305  * means, the deactivation was more global (i.e. valid on a higher level node) than the current node and the
5306  * disabling at the current node doesn't have any effect anymore.
5307  * If the constraint is already enabled, we need not to do anything. This may happen on a path A -> B,
5308  * if the constraint is disabled at node B, and while processing the subtree of B, it is also disabled at
5309  * the more global node A. Then on the switching path back to A, the constraint is enabled at node B (which is
5310  * actually wrong, since it now should be disabled in the whole subtree of A, but we cannot know this), and
5311  * again enabled at node A (where enabling is ignored). If afterwards, a subnode of B is processed, the
5312  * switching disables the constraint in node A, and the disabling is then removed from node B.
5313  */
5314  if( !cons->active )
5315  {
5316  SCIPdebugMessage("constraint <%s> of handler <%s> was deactivated -> remove it from disabledconss array\n",
5317  cons->name, cons->conshdlr->name);
5318 
5319  /* release and remove constraint from the disabledconss array */
5320  SCIP_CALL( conssetchgDelDisabledCons(conssetchg, blkmem, set, i) );
5321  }
5322  else if( !cons->enabled )
5323  {
5324  assert(cons->addarraypos >= 0);
5325  assert(!cons->deleted); /* deleted constraints must not be active! */
5326  SCIP_CALL( SCIPconsEnable(cons, set, stat) );
5327  }
5328  assert(!cons->update);
5329  assert(!cons->active || cons->enabled);
5330  }
5331 
5332  /* undo constraint additions */
5333  for( i = conssetchg->naddedconss-1; i >= 0; --i )
5334  {
5335  cons = conssetchg->addedconss[i];
5336  assert(cons != NULL);
5337  assert(!cons->update);
5338 
5339  /* If the constraint is already deactivated, we need not to do anything. This may happen on a path A -> B,
5340  * if the constraint is added at node B, and while processing the subtree of B, it is also added at
5341  * the more global node A. Then on the switching path back to A, the node is deactivated at node B (which is
5342  * actually wrong, since it now should be active in the whole subtree of A, but we cannot know this), and
5343  * again deactivated at node A (where deactivation is ignored). If afterwards, a subnode of B is processed, the
5344  * switching activates the constraint in node A, and the activation is then removed from node B.
5345  */
5346  if( cons->active )
5347  {
5348  assert(cons->addconssetchg == conssetchg);
5349  assert(cons->addarraypos == i);
5350 
5351  /* deactivate constraint */
5352  SCIP_CALL( SCIPconsDeactivate(cons, set, stat) );
5353 
5354  /* unlink the constraint and the constraint set change */
5355  cons->addconssetchg = NULL;
5356  cons->addarraypos = -1;
5357  }
5358  assert(!cons->active);
5359  assert(!cons->update);
5360  }
5361 
5362  return SCIP_OKAY;
5363 }
5364 
5365 /** applies constraint set change to the global problem and deletes the constraint set change data */
5367  SCIP_CONSSETCHG** conssetchg, /**< pointer to constraint set change data */
5368  BMS_BLKMEM* blkmem, /**< block memory */
5369  SCIP_SET* set, /**< global SCIP settings */
5370  SCIP_STAT* stat, /**< dynamic problem statistics */
5371  SCIP_PROB* prob /**< problem data */
5372  )
5373 {
5374  SCIP_CONS* cons;
5375  int i;
5376 
5377  assert(conssetchg != NULL);
5378 
5379  /* nothing to do on empty constraint set change data */
5380  if( *conssetchg == NULL )
5381  return SCIP_OKAY;
5382 
5383  SCIPdebugMessage("moving constraint set changes at %p to global problem: %d constraint additions, %d constraint disablings\n",
5384  (void*)*conssetchg, (*conssetchg)->naddedconss, (*conssetchg)->ndisabledconss);
5385 
5386  /* apply constraint additions to the global problem (loop backwards, because then conssetchgDelAddedCons() is
5387  * more efficient)
5388  */
5389  for( i = (*conssetchg)->naddedconss-1; i >= 0; --i )
5390  {
5391  cons = (*conssetchg)->addedconss[i];
5392  assert(cons != NULL);
5393  assert(!cons->update);
5394 
5395  /* only move constraints that are not sticking at the current node */
5396  if( !SCIPconsIsStickingAtNode(cons) )
5397  {
5398  /* because we first have to delete the constraint, we have to capture it in order to not loose it */
5399  SCIPconsCapture(cons);
5400 
5401  /* delete constraint addition from constraint set change data */
5402  SCIP_CALL( conssetchgDelAddedCons(*conssetchg, blkmem, set, i) );
5403 
5404  /* don't move deleted constraints to the global problem */
5405  if( !cons->deleted )
5406  {
5407  SCIP_CALL( SCIPprobAddCons(prob, set, stat, cons) );
5408  }
5409 
5410  /* release constraint */
5411  SCIP_CALL( SCIPconsRelease(&cons, blkmem, set) );
5412  }
5413  }
5414 
5415  /* apply constraint disablings to the global problem (loop backwards, because then conssetchgDelDisabledCons() is
5416  * more efficient)
5417  */
5418  for( i = (*conssetchg)->ndisabledconss-1; i >= 0; --i )
5419  {
5420  cons = (*conssetchg)->disabledconss[i];
5421  assert(cons != NULL);
5422  assert(!cons->update);
5423 
5424  /* only delete constraints that are not sticking at the current node */
5425  if( !SCIPconsIsStickingAtNode(cons) )
5426  {
5427  /* globally delete constraint */
5428  if( !cons->deleted )
5429  {
5430  SCIP_CALL( SCIPconsDelete(cons, blkmem, set, stat, prob) );
5431  }
5432 
5433  /* release and remove constraint from the disabledconss array */
5434  SCIP_CALL( conssetchgDelDisabledCons(*conssetchg, blkmem, set, i) );
5435  }
5436  }
5437 
5438  if( (*conssetchg)->naddedconss == 0 && (*conssetchg)->ndisabledconss == 0 )
5439  {
5440  /* free empty constraint set change data */
5441  SCIP_CALL( SCIPconssetchgFree(conssetchg, blkmem, set) );
5442  }
5443 
5444  return SCIP_OKAY;
5445 }
5446 
5447 
5448 
5449 
5450 /*
5451  * Constraint methods
5452  */
5453 
5454 /** creates and captures a constraint, and inserts it into the conss array of its constraint handler
5455  *
5456  * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution
5457  * may be declared feasible even if it violates this particular constraint.
5458  * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a
5459  * local constraint is redundant due to the variable's local bounds.
5460  */
5462  SCIP_CONS** cons, /**< pointer to constraint */
5463  BMS_BLKMEM* blkmem, /**< block memory */
5464  SCIP_SET* set, /**< global SCIP settings */
5465  const char* name, /**< name of constraint */
5466  SCIP_CONSHDLR* conshdlr, /**< constraint handler for this constraint */
5467  SCIP_CONSDATA* consdata, /**< data for this specific constraint */
5468  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
5469  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
5470  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
5471  * Usually set to TRUE. */
5472  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
5473  * TRUE for model constraints, FALSE for additional, redundant constraints. */
5474  SCIP_Bool check, /**< should the constraint be checked for feasibility?
5475  * TRUE for model constraints, FALSE for additional, redundant constraints. */
5476  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
5477  * Usually set to TRUE. */
5478  SCIP_Bool local, /**< is constraint only valid locally?
5479  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
5480  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
5481  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
5482  * adds coefficients to this constraint. */
5483  SCIP_Bool dynamic, /**< is constraint subject to aging?
5484  * Usually set to FALSE. Set to TRUE for own cuts which
5485  * are separated as constraints. */
5486  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
5487  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
5488  SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
5489  * if it may be moved to a more global node?
5490  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
5491  SCIP_Bool original, /**< is constraint belonging to the original problem? */
5492  SCIP_Bool deleteconsdata /**< has the constraint data to be deleted if constraint is freed? */
5493  )
5494 {
5495  assert(cons != NULL);
5496  assert(blkmem != NULL);
5497  assert(set != NULL);
5498  assert(name != NULL);
5499  assert(conshdlr != NULL);
5500  assert(!original || deleteconsdata);
5501 
5502  /* constraints of constraint handlers that don't need constraints cannot be created */
5503  if( !conshdlr->needscons )
5504  {
5505  SCIPerrorMessage("cannot create constraint <%s> of type [%s] - constraint handler does not need constraints\n",
5506  name, conshdlr->name);
5507  return SCIP_INVALIDCALL;
5508  }
5509 
5510  /* create constraint data */
5511  SCIP_ALLOC( BMSallocBlockMemory(blkmem, cons) );
5512  SCIP_ALLOC( BMSduplicateBlockMemoryArray(blkmem, &(*cons)->name, name, strlen(name)+1) );
5513 #ifndef NDEBUG
5514  (*cons)->scip = set->scip;
5515 #endif
5516  (*cons)->conshdlr = conshdlr;
5517  (*cons)->consdata = consdata;
5518  (*cons)->transorigcons = NULL;
5519  (*cons)->addconssetchg = NULL;
5520  (*cons)->addarraypos = -1;
5521  (*cons)->consspos = -1;
5522  (*cons)->initconsspos = -1;
5523  (*cons)->sepaconsspos = -1;
5524  (*cons)->enfoconsspos = -1;
5525  (*cons)->checkconsspos = -1;
5526  (*cons)->propconsspos = -1;
5527  (*cons)->activedepth = -2;
5528  (*cons)->validdepth = (local ? -1 : 0);
5529  (*cons)->age = 0.0;
5530  (*cons)->nlockspos = 0;
5531  (*cons)->nlocksneg = 0;
5532  (*cons)->markedprop = FALSE;
5533  (*cons)->nuses = 0;
5534  (*cons)->nupgradelocks = 0;
5535  (*cons)->initial = initial;
5536  (*cons)->separate = separate;
5537  (*cons)->enforce = enforce;
5538  (*cons)->check = check;
5539  (*cons)->propagate = propagate;
5540  (*cons)->sepaenabled = separate;
5541  (*cons)->propenabled = propagate;
5542  (*cons)->local = local;
5543  (*cons)->modifiable = modifiable;
5544  (*cons)->dynamic = dynamic;
5545  (*cons)->removable = removable;
5546  (*cons)->stickingatnode = stickingatnode;
5547  (*cons)->original = original;
5548  (*cons)->deleteconsdata = deleteconsdata;
5549  (*cons)->active = FALSE;
5550  (*cons)->enabled = FALSE;
5551  (*cons)->obsolete = FALSE;
5552  (*cons)->markpropagate = FALSE;
5553  (*cons)->deleted = FALSE;
5554  (*cons)->update = FALSE;
5555  (*cons)->updateinsert = FALSE;
5556  (*cons)->updateactivate = FALSE;
5557  (*cons)->updatedeactivate = FALSE;
5558  (*cons)->updateenable = FALSE;
5559  (*cons)->updatedisable = FALSE;
5560  (*cons)->updatesepaenable = FALSE;
5561  (*cons)->updatesepadisable = FALSE;
5562  (*cons)->updatepropenable = FALSE;
5563  (*cons)->updatepropdisable = FALSE;
5564  (*cons)->updateobsolete = FALSE;
5565  (*cons)->updatemarkpropagate = FALSE;
5566  (*cons)->updateunmarkpropagate = FALSE;
5567  (*cons)->updatefree = FALSE;
5568  (*cons)->updateactfocus = FALSE;
5569 
5570  /* capture constraint */
5571  SCIPconsCapture(*cons);
5572 
5573  /* insert the constraint as inactive constraint into the transformed constraints array */
5574  if( !original )
5575  {
5576  /* check, if inserting constraint should be delayed */
5577  if( conshdlrAreUpdatesDelayed(conshdlr) )
5578  {
5579  SCIPdebugMessage(" -> delaying insertion of constraint <%s>\n", (*cons)->name);
5580  (*cons)->updateinsert = TRUE;
5581  SCIP_CALL( conshdlrAddUpdateCons((*cons)->conshdlr, set, *cons) );
5582  assert((*cons)->update);
5583  assert((*cons)->nuses == 2);
5584  }
5585  else
5586  {
5587  SCIP_CALL( conshdlrAddCons(conshdlr, set, *cons) );
5588  }
5589  }
5590 
5591  checkConssArrays(conshdlr);
5592 
5593  return SCIP_OKAY;
5594 }
5595 
5596 /** copies source constraint of source SCIP into the target constraint for the target SCIP, using the variable map for
5597  * mapping the variables of the source SCIP to the variables of the target SCIP; if the copying process was successful
5598  * a constraint is created and captured;
5599  *
5600  * @warning If a constraint is marked to be checked for feasibility but not to be enforced, a LP or pseudo solution
5601  * may be declared feasible even if it violates this particular constraint.
5602  * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a
5603  * local constraint is redundant due to the variable's local bounds.
5604  */
5606  SCIP_CONS** cons, /**< pointer to store the created target constraint */
5607  SCIP_SET* set, /**< global SCIP settings of the target SCIP */
5608  const char* name, /**< name of constraint, or NULL if the name of the source constraint should be used */
5609  SCIP* sourcescip, /**< source SCIP data structure */
5610  SCIP_CONSHDLR* sourceconshdlr, /**< source constraint handler for this constraint */
5611  SCIP_CONS* sourcecons, /**< source constraint of the source SCIP */
5612  SCIP_HASHMAP* varmap, /**< a SCIP_HASHMAP mapping variables of the source SCIP to corresponding
5613  * variables of the target SCIP */
5614  SCIP_HASHMAP* consmap, /**< a hashmap to store the mapping of source constraints to the corresponding
5615  * target constraints, must not be NULL! */
5616  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP? */
5617  SCIP_Bool separate, /**< should the constraint be separated during LP processing? */
5618  SCIP_Bool enforce, /**< should the constraint be enforced during node processing? */
5619  SCIP_Bool check, /**< should the constraint be checked for feasibility? */
5620  SCIP_Bool propagate, /**< should the constraint be propagated during node processing? */
5621  SCIP_Bool local, /**< is constraint only valid locally? */
5622  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)? */
5623  SCIP_Bool dynamic, /**< is constraint subject to aging? */
5624  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup? */
5625  SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
5626  * if it may be moved to a more global node? */
5627  SCIP_Bool global, /**< create a global or a local copy? */
5628  SCIP_Bool* success /**< pointer to store whether the copying was successful or not */
5629  )
5630 {
5631  assert(cons != NULL);
5632  assert(set != NULL);
5633  assert(sourcescip != NULL);
5634  assert(sourceconshdlr != NULL);
5635  assert(sourcecons != NULL);
5636  assert(varmap != NULL);
5637  assert(consmap != NULL);
5638  assert(success != NULL);
5639 
5640  /* if constraint handler does not support copying, success will return false. Constraints handlers have to actively set this to true. */
5641  (*success) = FALSE;
5642 
5643  if( sourceconshdlr->conscopy != NULL )
5644  {
5645  SCIP_CALL( sourceconshdlr->conscopy(set->scip, cons, name, sourcescip, sourceconshdlr, sourcecons, varmap, consmap,
5646  initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, global, success) );
5647  }
5648 
5649  return SCIP_OKAY;
5650 }
5651 
5652 
5653 /** parses constraint information (in cip format) out of a string; if the parsing process was successful a constraint is
5654  * created, captured, and inserted into the conss array of its constraint handler.
5655  *
5656  * @warning If a constraint is marked to be checked for feasibility but not to be enforced, an LP or pseudo solution
5657  * may be declared feasible even if it violates this particular constraint.
5658  * This constellation should only be used, if no LP or pseudo solution can violate the constraint -- e.g. if a
5659  * local constraint is redundant due to the variable's local bounds.
5660  */
5662  SCIP_CONS** cons, /**< pointer to constraint */
5663  SCIP_SET* set, /**< global SCIP settings */
5664  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler of target SCIP */
5665  const char* str, /**< string to parse for constraint */
5666  SCIP_Bool initial, /**< should the LP relaxation of constraint be in the initial LP?
5667  * Usually set to TRUE. Set to FALSE for 'lazy constraints'. */
5668  SCIP_Bool separate, /**< should the constraint be separated during LP processing?
5669  * Usually set to TRUE. */
5670  SCIP_Bool enforce, /**< should the constraint be enforced during node processing?
5671  * TRUE for model constraints, FALSE for additional, redundant constraints. */
5672  SCIP_Bool check, /**< should the constraint be checked for feasibility?
5673  * TRUE for model constraints, FALSE for additional, redundant constraints. */
5674  SCIP_Bool propagate, /**< should the constraint be propagated during node processing?
5675  * Usually set to TRUE. */
5676  SCIP_Bool local, /**< is constraint only valid locally?
5677  * Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. */
5678  SCIP_Bool modifiable, /**< is constraint modifiable (subject to column generation)?
5679  * Usually set to FALSE. In column generation applications, set to TRUE if pricing
5680  * adds coefficients to this constraint. */
5681  SCIP_Bool dynamic, /**< is constraint subject to aging?
5682  * Usually set to FALSE. Set to TRUE for own cuts which
5683  * are separated as constraints. */
5684  SCIP_Bool removable, /**< should the relaxation be removed from the LP due to aging or cleanup?
5685  * Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. */
5686  SCIP_Bool stickingatnode, /**< should the constraint always be kept at the node where it was added, even
5687  * if it may be moved to a more global node?
5688  * Usually set to FALSE. Set to TRUE to for constraints that represent node data. */
5689  SCIP_Bool* success /**< pointer store if the paring process was successful */
5690  )
5691 {
5692  SCIP_CONSHDLR* conshdlr;
5693  char conshdlrname[SCIP_MAXSTRLEN];
5694  char consname[SCIP_MAXSTRLEN];
5695  char* endptr;
5696 
5697  assert(cons != NULL);
5698  assert(set != NULL);
5699 
5700  (*success) = FALSE;
5701 
5702  /* scan constraint handler name */
5703  assert(str != NULL);
5704  SCIPstrCopySection(str, '[', ']', conshdlrname, SCIP_MAXSTRLEN, &endptr);
5705  if ( endptr == NULL || endptr == str )
5706  {
5707  SCIPmessagePrintWarning(messagehdlr, "Syntax error: Could not find constraint handler name.\n");
5708  return SCIP_OKAY;
5709  }
5710  assert(endptr != NULL);
5711  SCIPdebugMessage("constraint handler name <%s>\n", conshdlrname);
5712 
5713  /* scan constraint name */
5714  SCIPstrCopySection(endptr, '<', '>', consname, SCIP_MAXSTRLEN, &endptr);
5715  if ( endptr == NULL || endptr == str )
5716  {
5717  SCIPmessagePrintWarning(messagehdlr, "Syntax error: Could not find constraint name.\n");
5718  return SCIP_OKAY;
5719  }
5720  assert(endptr != NULL);
5721  SCIPdebugMessage("constraint name <%s>\n", consname);
5722 
5723  str = endptr;
5724 
5725  /* skip white space */
5726  while ( isspace((unsigned char)* str) )
5727  ++str;
5728 
5729  /* check for colon */
5730  if( *str != ':' )
5731  {
5732  SCIPmessagePrintWarning(messagehdlr, "Syntax error: Could not find colon ':' after constraint name.\n");
5733  return SCIP_OKAY;
5734  }
5735 
5736  /* skip colon */
5737  ++str;
5738 
5739  /* skip white space */
5740  while ( isspace((unsigned char)* str) )
5741  ++str;
5742 
5743  /* check if a constraint handler with parsed name exists */
5744  conshdlr = SCIPsetFindConshdlr(set, conshdlrname);
5745 
5746  if( conshdlr == NULL )
5747  {
5748  SCIPmessagePrintWarning(messagehdlr, "constraint handler <%s> doesn't exist in SCIP data structure\n", conshdlrname);
5749  }
5750  else
5751  {
5752  assert( conshdlr != NULL );
5753  if ( conshdlr->consparse == NULL )
5754  {
5755  SCIPmessagePrintWarning(messagehdlr, "constraint handler <%s> does not support parsing constraints\n", conshdlrname);
5756  }
5757  else
5758  {
5759  SCIP_CALL( conshdlr->consparse(set->scip, conshdlr, cons, consname, str,
5760  initial, separate, enforce, check, propagate, local, modifiable, dynamic, removable, stickingatnode, success) );
5761  }
5762  }
5763 
5764  return SCIP_OKAY;
5765 }
5766 
5767 /** change name of given constraint */
5769  SCIP_CONS* cons, /**< problem constraint */
5770  BMS_BLKMEM* blkmem, /**< block memory buffer */
5771  const char* name /**< new name of constraint */
5772  )
5773 {
5774  assert(cons != NULL);
5775  assert(cons->name != NULL);
5776 
5777  /* free old constraint name */
5778  BMSfreeBlockMemoryArray(blkmem, &cons->name, strlen(cons->name)+1);
5779 
5780  /* copy new constraint name */
5781  SCIP_ALLOC( BMSduplicateBlockMemoryArray(blkmem, &cons->name, name, strlen(name)+1) );
5782 
5783  return SCIP_OKAY;
5784 }
5785 
5786 
5787 /** frees a constraint and removes it from the conss array of its constraint handler */
5789  SCIP_CONS** cons, /**< constraint to free */
5790  BMS_BLKMEM* blkmem, /**< block memory buffer */
5791  SCIP_SET* set /**< global SCIP settings */
5792  )
5793 {
5794  assert(cons != NULL);
5795  assert(*cons != NULL);
5796  assert((*cons)->conshdlr != NULL);
5797  assert((*cons)->nuses == 0);
5798  assert(!(*cons)->active);
5799  assert(!(*cons)->update);
5800  assert(!(*cons)->original || (*cons)->transorigcons == NULL);
5801  assert(blkmem != NULL);
5802  assert(set != NULL);
5803  assert((*cons)->scip == set->scip);
5804 
5805  SCIPdebugMessage("freeing constraint <%s> at conss pos %d of handler <%s>\n",
5806  (*cons)->name, (*cons)->consspos, (*cons)->conshdlr->name);
5807 
5808  /* free constraint data */
5809  if( (*cons)->conshdlr->consdelete != NULL && (*cons)->consdata != NULL && (*cons)->deleteconsdata )
5810  {
5811  SCIP_CALL( (*cons)->conshdlr->consdelete(set->scip, (*cons)->conshdlr, *cons, &(*cons)->consdata) );
5812  }
5813  else if( !(*cons)->deleteconsdata )
5814  (*cons)->consdata = NULL;
5815  assert((*cons)->consdata == NULL);
5816 
5817  /* unlink transformed and original constraint */
5818  if( (*cons)->transorigcons != NULL )
5819  {
5820  assert(!(*cons)->original);
5821  assert((*cons)->transorigcons->original);
5822  assert((*cons)->transorigcons->transorigcons == *cons);
5823 
5824  (*cons)->transorigcons->transorigcons = NULL;
5825  }
5826 
5827  /* remove constraint from the transformed constraints array */
5828  if( !(*cons)->original )
5829  {
5830  conshdlrDelCons((*cons)->conshdlr, *cons);
5831  checkConssArrays((*cons)->conshdlr);
5832  }
5833  assert((*cons)->consspos == -1);
5834 
5835  /* free constraint */
5836  BMSfreeBlockMemoryArray(blkmem, &(*cons)->name, strlen((*cons)->name)+1);
5837  BMSfreeBlockMemory(blkmem, cons);
5838 
5839  return SCIP_OKAY;
5840 }
5841 
5842 /** increases usage counter of constraint */
5843 void SCIPconsCapture(
5844  SCIP_CONS* cons /**< constraint */
5845  )
5846 {
5847  assert(cons != NULL);
5848  assert(cons->nuses >= 0);
5849 
5850  SCIPdebugMessage("capture constraint <%s> with nuses=%d, cons pointer %p\n", cons->name, cons->nuses, (void*)cons);
5851  cons->nuses++;
5852 }
5853 
5854 /** decreases usage counter of constraint, and frees memory if necessary */
5856  SCIP_CONS** cons, /**< pointer to constraint */
5857  BMS_BLKMEM* blkmem, /**< block memory */
5858  SCIP_SET* set /**< global SCIP settings */
5859  )
5860 {
5861  assert(blkmem != NULL);
5862  assert(cons != NULL);
5863  assert(*cons != NULL);
5864  assert((*cons)->conshdlr != NULL);
5865  assert((*cons)->nuses >= 1);
5866  assert(set != NULL);
5867  assert((*cons)->scip == set->scip);
5868 
5869  SCIPdebugMessage("release constraint <%s> with nuses=%d, cons pointer %p\n", (*cons)->name, (*cons)->nuses, (void*)(*cons));
5870  (*cons)->nuses--;
5871  if( (*cons)->nuses == 0 )
5872  {
5873  assert(!(*cons)->active || (*cons)->updatedeactivate);
5874 
5875  /* check, if freeing constraint should be delayed */
5876  if( conshdlrAreUpdatesDelayed((*cons)->conshdlr) )
5877  {
5878  SCIPdebugMessage(" -> delaying freeing constraint <%s>\n", (*cons)->name);
5879  (*cons)->updatefree = TRUE;
5880  SCIP_CALL( conshdlrAddUpdateCons((*cons)->conshdlr, set, *cons) );
5881  assert((*cons)->update);
5882  assert((*cons)->nuses == 1);
5883  }
5884  else
5885  {
5886  SCIP_CALL( SCIPconsFree(cons, blkmem, set) );
5887  }
5888  }
5889  *cons = NULL;
5890 
5891  return SCIP_OKAY;
5892 }
5893 
5894 /** outputs constraint information to file stream */
5896  SCIP_CONS* cons, /**< constraint to print */
5897  SCIP_SET* set, /**< global SCIP settings */
5898  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
5899  FILE* file /**< output file (or NULL for standard output) */
5900  )
5901 {
5902  SCIP_CONSHDLR* conshdlr;
5903 
5904  assert(cons != NULL);
5905  assert(set != NULL);
5906  assert(cons->scip == set->scip);
5907 
5908  conshdlr = cons->conshdlr;
5909  assert(conshdlr != NULL);
5910 
5911  SCIPmessageFPrintInfo(messagehdlr, file, " [%s] <%s>: ", conshdlr->name, cons->name);
5912 
5913  if( conshdlr->consprint != NULL )
5914  {
5915  SCIP_CALL( conshdlr->consprint(set->scip, conshdlr, cons, file) );
5916  }
5917  else
5918  SCIPmessageFPrintInfo(messagehdlr, file, "constraint handler <%s> doesn't support printing constraint", conshdlr->name);
5919 
5920  return SCIP_OKAY;
5921 }
5922 
5923 /** method to collect the variables of a constraint
5924  *
5925  * If the number of variables is greater than the available slots in the variable array, nothing happens except that
5926  * the success point is set to FALSE. With the method SCIPconsGetNVars() it is possible to get the number of variables
5927  * a constraint has in its scope.
5928  *
5929  * @note The success pointer indicates if all variables were copied into the vars arrray.
5930  *
5931  * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is
5932  * set to FALSE.
5933  */
5935  SCIP_CONS* cons, /**< constraint to print */
5936  SCIP_SET* set, /**< global SCIP settings */
5937  SCIP_VAR** vars, /**< array to store the involved variable of the constraint */
5938  int varssize, /**< available slots in vars array which is needed to check if the array is large enough */
5939  SCIP_Bool* success /**< pointer to store whether the variables are successfully copied */
5940  )
5941 {
5942  SCIP_CONSHDLR* conshdlr;
5943 
5944  assert(cons != NULL);
5945  assert(set != NULL);
5946  assert(cons->scip == set->scip);
5947 
5948  conshdlr = cons->conshdlr;
5949  assert(conshdlr != NULL);
5950 
5951  if( conshdlr->consgetvars != NULL )
5952  {
5953  SCIP_CALL( conshdlr->consgetvars(set->scip, conshdlr, cons, vars, varssize, success) );
5954  }
5955  else
5956  {
5957  (*success) = FALSE;
5958  }
5959 
5960  return SCIP_OKAY;
5961 }
5962 
5963 /** methed to collect the number of variables of a constraint
5964  *
5965  * @note The success pointer indicates if the contraint handler was able to return the number of variables
5966  *
5967  * @note It might be that a constraint handler does not support this functionality, in that case the success pointer is
5968  * set to FALSE
5969  */
5971  SCIP_CONS* cons, /**< constraint to print */
5972  SCIP_SET* set, /**< global SCIP settings */
5973  int* nvars, /**< pointer to store the number of variables */
5974  SCIP_Bool* success /**< pointer to store whether the constraint successfully returned the number of variables */
5975  )
5976 {
5977  SCIP_CONSHDLR* conshdlr;
5978 
5979  assert(cons != NULL);
5980  assert(set != NULL);
5981  assert(cons->scip == set->scip);
5982 
5983  conshdlr = cons->conshdlr;
5984  assert(conshdlr != NULL);
5985 
5986  if( conshdlr->consgetnvars != NULL )
5987  {
5988  SCIP_CALL( conshdlr->consgetnvars(set->scip, conshdlr, cons, nvars, success) );
5989  }
5990  else
5991  {
5992  (*nvars) = 0;
5993  (*success) = FALSE;
5994  }
5995 
5996  return SCIP_OKAY;
5997 }
5998 
5999 /** globally removes constraint from all subproblems; removes constraint from the constraint set change data of the
6000  * node, where it was created, or from the problem, if it was a problem constraint
6001  */
6003  SCIP_CONS* cons, /**< constraint to delete */
6004  BMS_BLKMEM* blkmem, /**< block memory */
6005  SCIP_SET* set, /**< global SCIP settings */
6006  SCIP_STAT* stat, /**< dynamic problem statistics */
6007  SCIP_PROB* prob /**< problem data */
6008  )
6009 {
6010  assert(cons != NULL);
6011  assert(cons->conshdlr != NULL);
6012  assert(!cons->active || cons->updatedeactivate || cons->addarraypos >= 0);
6013  assert(set != NULL);
6014  assert(cons->scip == set->scip);
6015 
6016  SCIPdebugMessage("globally deleting constraint <%s> (delay updates: %d)\n",
6017  cons->name, cons->conshdlr->delayupdatecount);
6018 
6019  /* deactivate constraint, if it is currently active */
6020  if( cons->active && !cons->updatedeactivate )
6021  {
6022  SCIP_CALL( SCIPconsDeactivate(cons, set, stat) );
6023  }
6024  else
6025  cons->updateactivate = FALSE;
6026 
6027  assert(!cons->active || cons->updatedeactivate);
6028  assert(!cons->enabled || cons->updatedeactivate);
6029 
6030  /* mark constraint deleted */
6031  cons->deleted = TRUE;
6032 
6033  /* remove formerly active constraint from the conssetchg's addedconss / prob's conss array */
6034  if( cons->addarraypos >= 0 )
6035  {
6036  if( cons->addconssetchg == NULL )
6037  {
6038  /* remove problem constraint from the problem */
6039  SCIP_CALL( SCIPprobDelCons(prob, blkmem, set, stat, cons) );
6040  }
6041  else
6042  {
6043  assert(cons->addconssetchg->addedconss != NULL);
6044  assert(0 <= cons->addarraypos && cons->addarraypos < cons->addconssetchg->naddedconss);
6045  assert(cons->addconssetchg->addedconss[cons->addarraypos] == cons);
6046 
6047  /* remove constraint from the constraint set change addedconss array */
6048  SCIP_CALL( conssetchgDelAddedCons(cons->addconssetchg, blkmem, set, cons->addarraypos) );
6049  }
6050  }
6051 
6052  return SCIP_OKAY;
6053 }
6054 
6055 /** gets and captures transformed constraint of a given original constraint; if the constraint is not yet transformed,
6056  * a new transformed constraint for this constraint is created
6057  */
6059  SCIP_CONS* origcons, /**< original constraint */
6060  BMS_BLKMEM* blkmem, /**< block memory buffer */
6061  SCIP_SET* set, /**< global SCIP settings */
6062  SCIP_CONS** transcons /**< pointer to store the transformed constraint */
6063  )
6064 {
6065  assert(origcons != NULL);
6066  assert(set != NULL);
6067  assert(origcons->scip == set->scip);
6068  assert(origcons->conshdlr != NULL);
6069  assert(origcons->original);
6070  assert(transcons != NULL);
6071 
6072  /* check, if the constraint is already transformed */
6073  if( origcons->transorigcons != NULL )
6074  {
6075  *transcons = origcons->transorigcons;
6076  SCIPconsCapture(*transcons);
6077  }
6078  else
6079  {
6080  /* create transformed constraint */
6081  if( origcons->conshdlr->constrans != NULL )
6082  {
6083  /* use constraint handler's own method to transform constraint */
6084  SCIP_CALL( origcons->conshdlr->constrans(set->scip, origcons->conshdlr, origcons, transcons) );
6085  }
6086  else
6087  {
6088  /* create new constraint with a pointer copy of the constraint data */
6089  SCIP_CALL( SCIPconsCreate(transcons, blkmem, set, origcons->name, origcons->conshdlr, origcons->consdata, origcons->initial,
6090  origcons->separate, origcons->enforce, origcons->check, origcons->propagate,
6091  origcons->local, origcons->modifiable, origcons->dynamic, origcons->removable, origcons->stickingatnode,
6092  FALSE, FALSE) );
6093  }
6094 
6095  /* link original and transformed constraint */
6096  origcons->transorigcons = *transcons;
6097  (*transcons)->transorigcons = origcons;
6098 
6099  /* copy the number of upgradelocks */
6100  (*transcons)->nupgradelocks = origcons->nupgradelocks; /*lint !e732*/
6101  }
6102  assert(*transcons != NULL);
6103 
6104  return SCIP_OKAY;
6105 }
6106 
6107 /** sets the initial flag of the given constraint */
6109  SCIP_CONS* cons, /**< constraint */
6110  SCIP_SET* set, /**< global SCIP settings */
6111  SCIP_STAT* stat, /**< dynamic problem statistics */
6112  SCIP_Bool initial /**< new value */
6113  )
6114 {
6115  assert(cons != NULL);
6116  assert(set != NULL);
6117  assert(cons->scip == set->scip);
6118 
6119  if( cons->initial != initial )
6120  {
6121  cons->initial = initial;
6122  if( !cons->original )
6123  {
6124  if( cons->initial )
6125  {
6126  SCIP_CALL( conshdlrAddInitcons(SCIPconsGetHdlr(cons), set, stat, cons) );
6127  }
6128  else
6129  {
6130  if( cons->initconsspos >= 0 )
6131  {
6132  conshdlrDelInitcons(SCIPconsGetHdlr(cons), cons);
6133  }
6134  }
6135  }
6136  }
6137 
6138  return SCIP_OKAY;
6139 }
6140 
6141 /** sets the separate flag of the given constraint */
6143  SCIP_CONS* cons, /**< constraint */
6144  SCIP_SET* set, /**< global SCIP settings */
6145  SCIP_Bool separate /**< new value */
6146  )
6147 {
6148  assert(cons != NULL);
6149  assert(set != NULL);
6150  assert(cons->scip == set->scip);
6151 
6152  if( cons->separate != separate )
6153  {
6154  if( SCIPsetGetStage(set) == SCIP_STAGE_PROBLEM )
6155  {
6156  cons->separate = separate;
6157  }
6158  else if( cons->enabled && cons->sepaenabled )
6159  {
6160  if( separate )
6161  {
6162  cons->separate = separate;
6163  SCIP_CALL( conshdlrAddSepacons(cons->conshdlr, set, cons) );
6164  }
6165  else
6166  {
6167  conshdlrDelSepacons(cons->conshdlr, cons);
6168  cons->separate = separate;
6169  }
6170  }
6171  }
6172 
6173  return SCIP_OKAY;
6174 }
6175 
6176 /** sets the enforce flag of the given constraint */
6178  SCIP_CONS* cons, /**< constraint */
6179  SCIP_SET* set, /**< global SCIP settings */
6180  SCIP_Bool enforce /**< new value */
6181  )
6182 {
6183  assert(cons != NULL);
6184  assert(set != NULL);
6185  assert(cons->scip == set->scip);
6186 
6187  if( cons->enforce != enforce )
6188  {
6189  if( SCIPsetGetStage(set) == SCIP_STAGE_PROBLEM )
6190  {
6191  cons->enforce = enforce;
6192  }
6193  else if( cons->enabled )
6194  {
6195  if( enforce )
6196  {
6197  cons->enforce = enforce;
6198  SCIP_CALL( conshdlrAddEnfocons(cons->conshdlr, set, cons) );
6199  }
6200  else
6201  {
6202  conshdlrDelEnfocons(cons->conshdlr, cons);
6203  cons->enforce = enforce;
6204  }
6205  }
6206  }
6207 
6208  return SCIP_OKAY;
6209 }
6210 
6211 /** sets the check flag of the given constraint */
6213  SCIP_CONS* cons, /**< constraint */
6214  SCIP_SET* set, /**< global SCIP settings */
6215  SCIP_Bool check /**< new value */
6216  )
6217 {
6218  assert(cons != NULL);
6219  assert(set != NULL);
6220  assert(cons->scip == set->scip);
6221 
6222  if( cons->check != check )
6223  {
6224  cons->check = check;
6225 
6226  if( !cons->original )
6227  {
6228  /* if constraint is a problem constraint, update variable roundings locks */
6229  if( cons->addconssetchg == NULL && cons->addarraypos >= 0 )
6230  {
6231  if( cons->check )
6232  {
6233  SCIP_CALL( SCIPconsAddLocks(cons, set, +1, 0) );
6234  }
6235  else
6236  {
6237  SCIP_CALL( SCIPconsAddLocks(cons, set, -1, 0) );
6238  }
6239  }
6240 
6241  /* if constraint is active, update the checkconss array of the constraint handler */
6242  if( cons->active )
6243  {
6244  if( cons->check )
6245  {
6246  SCIP_CALL( conshdlrAddCheckcons(cons->conshdlr, set, cons) );
6247  }
6248  else
6249  {
6250  conshdlrDelCheckcons(cons->conshdlr, cons);
6251  }
6252  }
6253  }
6254  }
6255 
6256  return SCIP_OKAY;
6257 }
6258 
6259 /** sets the propagate flag of the given constraint */
6261  SCIP_CONS* cons, /**< constraint */
6262  SCIP_SET* set, /**< global SCIP settings */
6263  SCIP_Bool propagate /**< new value */
6264  )
6265 {
6266  assert(cons != NULL);
6267  assert(set != NULL);
6268  assert(cons->scip == set->scip);
6269 
6270  if( cons->propagate != propagate )
6271  {
6272  if( SCIPsetGetStage(set) == SCIP_STAGE_PROBLEM )
6273  {
6274  cons->propagate = propagate;
6275  }
6276  else if( cons->enabled && cons->propenabled )
6277  {
6278  if( propagate )
6279  {
6280  cons->propagate = propagate;
6281  SCIP_CALL( conshdlrAddPropcons(cons->conshdlr, set, cons) );
6282  }
6283  else
6284  {
6285  conshdlrDelPropcons(cons->conshdlr, cons);
6286  cons->propagate = propagate;
6287  }
6288  }
6289  }
6290 
6291  return SCIP_OKAY;
6292 }
6293 
6294 /** sets the local flag of the given constraint */
6295 void SCIPconsSetLocal(
6296  SCIP_CONS* cons, /**< constraint */
6297  SCIP_Bool local /**< new value */
6298  )
6299 {
6300  assert(cons != NULL);
6301 
6302  cons->local = local;
6303  if( !local )
6304  cons->validdepth = 0;
6305 }
6306 
6307 /** sets the modifiable flag of the given constraint */
6309  SCIP_CONS* cons, /**< constraint */
6310  SCIP_Bool modifiable /**< new value */
6311  )
6312 {
6313  assert(cons != NULL);
6314 
6315  cons->modifiable = modifiable;
6316 }
6317 
6318 /** sets the dynamic flag of the given constraint */
6319 void SCIPconsSetDynamic(
6320  SCIP_CONS* cons, /**< constraint */
6321  SCIP_Bool dynamic /**< new value */
6322  )
6323 {
6324  assert(cons != NULL);
6325 
6326  cons->dynamic = dynamic;
6327 }
6328 
6329 /** sets the removable flag of the given constraint */
6331  SCIP_CONS* cons, /**< constraint */
6332  SCIP_Bool removable /**< new value */
6333  )
6334 {
6335  assert(cons != NULL);
6336 
6337  cons->removable = removable;
6338 }
6339 
6340 /** sets the stickingatnode flag of the given constraint */
6342  SCIP_CONS* cons, /**< constraint */
6343  SCIP_Bool stickingatnode /**< new value */
6344  )
6345 {
6346  assert(cons != NULL);
6347 
6348  cons->stickingatnode = stickingatnode;
6349 }
6350 
6351 /** gives the constraint a new name; ATTENTION: to old pointer is over written that might
6352  * result in a memory leakage */
6354  SCIP_CONS* cons, /**< constraint */
6355  const char* name /**< new name of constraint */
6356  )
6357 {
6358  assert( cons != NULL );
6359  assert( name != NULL );
6360 
6361  cons->name = (char*)name;
6362 }
6363 
6364 /** gets associated transformed constraint of an original constraint, or NULL if no associated transformed constraint
6365  * exists
6366  */
6368  SCIP_CONS* cons /**< constraint */
6369  )
6370 {
6371  assert(cons->original);
6372 
6373  return cons->transorigcons;
6374 }
6375 
6376 /** activates constraint or marks constraint to be activated in next update */
6378  SCIP_CONS* cons, /**< constraint */
6379  SCIP_SET* set, /**< global SCIP settings */
6380  SCIP_STAT* stat, /**< dynamic problem statistics */
6381  int depth, /**< depth in the tree where the constraint activation takes place, or -1 for global problem */
6382  SCIP_Bool focusnode /**< does the constraint activation take place at the focus node? */
6383  )
6384 {
6385  assert(cons != NULL);
6386  assert(!cons->original);
6387  assert(!cons->active);
6388  assert(!cons->updateactivate);
6389  assert(!cons->updatedeactivate);
6390  assert(!cons->updateenable);
6391  assert(!cons->updatedisable);
6392  assert(!cons->updateobsolete);
6393  assert(!cons->updatefree);
6394  assert(cons->activedepth == -2);
6395  assert(cons->conshdlr != NULL);
6396  assert(set != NULL);
6397  assert(cons->scip == set->scip);
6398 
6399  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6400  {
6401  SCIPdebugMessage("delayed activation of constraint <%s> in constraint handler <%s> (depth %d)\n",
6402  cons->name, cons->conshdlr->name, depth);
6403  cons->updateactivate = TRUE;
6404  cons->activedepth = depth;
6405  cons->updateactfocus = focusnode;
6406  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6407  assert(cons->update);
6408  }
6409  else
6410  {
6411  SCIP_CALL( conshdlrActivateCons(cons->conshdlr, set, stat, cons, depth, focusnode) );
6412  assert(cons->active);
6413  }
6414 
6415  return SCIP_OKAY;
6416 }
6417 
6418 /** deactivates constraint or marks constraint to be deactivated in next update */
6420  SCIP_CONS* cons, /**< constraint */
6421  SCIP_SET* set, /**< global SCIP settings */
6422  SCIP_STAT* stat /**< dynamic problem statistics */
6423  )
6424 {
6425  assert(cons != NULL);
6426  assert(!cons->original);
6427  assert(cons->active);
6428  assert(!cons->updateactivate);
6429  assert(!cons->updatedeactivate);
6430  assert(cons->activedepth >= -1);
6431  assert(cons->conshdlr != NULL);
6432  assert(set != NULL);
6433  assert(cons->scip == set->scip);
6434 
6435  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6436  {
6437  SCIPdebugMessage("delayed deactivation of constraint <%s> in constraint handler <%s>\n",
6438  cons->name, cons->conshdlr->name);
6439  cons->updatedeactivate = TRUE;
6440  cons->activedepth = -2;
6441  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6442  assert(cons->update);
6443  }
6444  else
6445  {
6446  SCIP_CALL( conshdlrDeactivateCons(cons->conshdlr, set, stat, cons) );
6447  assert(!cons->active);
6448  }
6449 
6450  return SCIP_OKAY;
6451 }
6452 
6453 /** enables constraint's separation, enforcing, and propagation capabilities or marks them to be enabled in next update */
6455  SCIP_CONS* cons, /**< constraint */
6456  SCIP_SET* set, /**< global SCIP settings */
6457  SCIP_STAT* stat /**< dynamic problem statistics */
6458  )
6459 {
6460  assert(cons != NULL);
6461  assert(!cons->original);
6462  assert(cons->conshdlr != NULL);
6463  assert(set != NULL);
6464  assert(cons->scip == set->scip);
6465 
6466  if( !cons->active || cons->updatedeactivate || cons->updateenable || (cons->enabled && !cons->updatedisable) )
6467  return SCIP_OKAY;
6468 
6469  assert(!cons->updateactivate);
6470 
6471  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6472  {
6473  cons->updateenable = TRUE;
6474  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6475  assert(cons->update);
6476  }
6477  else
6478  {
6479  SCIP_CALL( conshdlrEnableCons(cons->conshdlr, set, stat, cons) );
6480  assert(cons->enabled);
6481  }
6482 
6483  return SCIP_OKAY;
6484 }
6485 
6486 /** disables constraint's separation, enforcing, and propagation capabilities or marks them to be disabled in next update */
6488  SCIP_CONS* cons, /**< constraint */
6489  SCIP_SET* set, /**< global SCIP settings */
6490  SCIP_STAT* stat /**< dynamic problem statistics */
6491  )
6492 {
6493  assert(cons != NULL);
6494  assert(!cons->original);
6495  assert(cons->conshdlr != NULL);
6496  assert(set != NULL);
6497  assert(cons->scip == set->scip);
6498 
6499  if( cons->updatedisable || (!cons->enabled && !cons->updateenable) )
6500  return SCIP_OKAY;
6501 
6502  assert(cons->active);
6503  assert(!cons->updateactivate);
6504 
6505  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6506  {
6507  cons->updatedisable = TRUE;
6508  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6509  assert(cons->update);
6510  }
6511  else
6512  {
6513  SCIP_CALL( conshdlrDisableCons(cons->conshdlr, set, stat, cons) );
6514  assert(!cons->enabled);
6515  }
6516 
6517  return SCIP_OKAY;
6518 }
6519 
6520 /** enables constraint's separation capabilities or marks them to be enabled in next update */
6522  SCIP_CONS* cons, /**< constraint */
6523  SCIP_SET* set /**< global SCIP settings */
6524  )
6525 {
6526  assert(cons != NULL);
6527  assert(cons->conshdlr != NULL);
6528  assert(set != NULL);
6529  assert(cons->scip == set->scip);
6530 
6531  if( cons->updatesepaenable || (cons->sepaenabled && !cons->updatesepadisable) )
6532  return SCIP_OKAY;
6533 
6534  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6535  {
6536  cons->updatesepadisable = FALSE;
6537  cons->updatesepaenable = TRUE;
6538  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6539  assert(cons->update);
6540  }
6541  else
6542  {
6543  SCIP_CALL( conshdlrEnableConsSeparation(cons->conshdlr, set, cons) );
6544  assert(cons->sepaenabled);
6545  }
6546 
6547  return SCIP_OKAY;
6548 }
6549 
6550 /** disables constraint's separation capabilities or marks them to be disabled in next update */
6552  SCIP_CONS* cons, /**< constraint */
6553  SCIP_SET* set /**< global SCIP settings */
6554  )
6555 {
6556  assert(cons != NULL);
6557  assert(cons->conshdlr != NULL);
6558 
6559  if( cons->updatesepadisable || (!cons->sepaenabled && !cons->updatesepaenable) )
6560  return SCIP_OKAY;
6561 
6562  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6563  {
6564  cons->updatesepaenable = FALSE;
6565  cons->updatesepadisable = TRUE;
6566  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6567  assert(cons->update);
6568  }
6569  else
6570  {
6572  assert(!cons->sepaenabled);
6573  }
6574 
6575  return SCIP_OKAY;
6576 }
6577 
6578 /** enables constraint's propagation capabilities or marks them to be enabled in next update */
6580  SCIP_CONS* cons, /**< constraint */
6581  SCIP_SET* set /**< global SCIP settings */
6582  )
6583 {
6584  assert(cons != NULL);
6585  assert(cons->conshdlr != NULL);
6586  assert(set != NULL);
6587  assert(cons->scip == set->scip);
6588 
6589  if( cons->updatepropenable || (cons->propenabled && !cons->updatepropdisable) )
6590  return SCIP_OKAY;
6591 
6592  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6593  {
6594  cons->updatepropdisable = FALSE;
6595  cons->updatepropenable = TRUE;
6596  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6597  assert(cons->update);
6598  }
6599  else
6600  {
6601  SCIP_CALL( conshdlrEnableConsPropagation(cons->conshdlr, set, cons) );
6602  assert(cons->propenabled);
6603  }
6604 
6605  return SCIP_OKAY;
6606 }
6607 
6608 /** disables constraint's propagation capabilities or marks them to be disabled in next update */
6610  SCIP_CONS* cons, /**< constraint */
6611  SCIP_SET* set /**< global SCIP settings */
6612  )
6613 {
6614  assert(cons != NULL);
6615  assert(cons->conshdlr != NULL);
6616  assert(set != NULL);
6617  assert(cons->scip == set->scip);
6618 
6619  if( cons->updatepropdisable || (!cons->propenabled && !cons->updatepropenable) )
6620  return SCIP_OKAY;
6621 
6622  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6623  {
6624  cons->updatepropenable = FALSE;
6625  cons->updatepropdisable = TRUE;
6626  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6627  assert(cons->update);
6628  }
6629  else
6630  {
6632  assert(!cons->propenabled);
6633  }
6634 
6635  return SCIP_OKAY;
6636 }
6637 
6638 /** marks the constraint to be propagated (update might be delayed) */
6640  SCIP_CONS* cons, /**< constraint */
6641  SCIP_SET* set /**< global SCIP settings */
6642  )
6643 {
6644  assert(cons != NULL);
6645  assert(cons->conshdlr != NULL);
6646  assert(set != NULL);
6647  assert(cons->scip == set->scip);
6648 
6649  if( cons->updatemarkpropagate || (cons->markpropagate && !cons->updateunmarkpropagate) )
6650  return SCIP_OKAY;
6651 
6652  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6653  {
6654  cons->updateunmarkpropagate = FALSE;
6655  cons->updatemarkpropagate = TRUE;
6656  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6657  assert(cons->update);
6658  }
6659  else
6660  {
6661  conshdlrMarkConsPropagate(cons->conshdlr, cons);
6662  assert(cons->markpropagate || !cons->enabled);
6663  }
6664 
6665  return SCIP_OKAY;
6666 }
6667 
6668 /** unmarks the constraint to be propagated (update might be delayed) */
6670  SCIP_CONS* cons, /**< constraint */
6671  SCIP_SET* set /**< global SCIP settings */
6672  )
6673 {
6674  assert(cons != NULL);
6675  assert(cons->conshdlr != NULL);
6676  assert(set != NULL);
6677  assert(cons->scip == set->scip);
6678 
6679  if( cons->updateunmarkpropagate || (!cons->markpropagate && !cons->updatemarkpropagate) )
6680  return SCIP_OKAY;
6681 
6682  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6683  {
6684  cons->updatemarkpropagate = FALSE;
6685  cons->updateunmarkpropagate = TRUE;
6686  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6687  assert(cons->update);
6688  }
6689  else
6690  {
6692  assert(!cons->markpropagate || !cons->enabled);
6693  }
6694 
6695  return SCIP_OKAY;
6696 
6697 }
6698 
6699 /** adds given value to age of constraint, but age can never become negative;
6700  * should be called
6701  * - in constraint separation, if no cut was found for this constraint,
6702  * - in constraint enforcing, if constraint was feasible, and
6703  * - in constraint propagation, if no domain reduction was deduced;
6704  * if it's age exceeds the constraint age limit, makes constraint obsolete or marks constraint to be made obsolete
6705  * in next update
6706  */
6708  SCIP_CONS* cons, /**< constraint */
6709  BMS_BLKMEM* blkmem, /**< block memory */
6710  SCIP_SET* set, /**< global SCIP settings */
6711  SCIP_STAT* stat, /**< dynamic problem statistics */
6712  SCIP_PROB* prob, /**< problem data */
6713  SCIP_Real deltaage /**< value to add to the constraint's age */
6714  )
6715 {
6716  assert(cons != NULL);
6717  assert(cons->conshdlr != NULL);
6718  assert(!cons->updateactivate);
6719  assert(set != NULL);
6720  assert(cons->scip == set->scip);
6721 
6722  /* no aging in presolving */
6723  if( set->stage == SCIP_STAGE_PRESOLVING )
6724  return SCIP_OKAY;
6725 
6726  SCIPdebugMessage("adding %g to age (%g) of constraint <%s> of handler <%s>\n",
6727  deltaage, cons->age, cons->name, cons->conshdlr->name);
6728 
6729  cons->age += deltaage;
6730  cons->age = MAX(cons->age, 0.0);
6731 
6732  if( !cons->original )
6733  {
6734  if( !cons->check && consExceedsAgelimit(cons, set) )
6735  {
6736  SCIP_CALL( SCIPconsDelete(cons, blkmem, set, stat, prob) );
6737  }
6738  else if( !cons->obsolete && consExceedsObsoleteage(cons, set) )
6739  {
6740  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6741  {
6742  cons->updateobsolete = TRUE;
6743  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6744  assert(cons->update);
6745  }
6746  else
6747  {
6749  assert(cons->obsolete);
6750  }
6751  }
6752  }
6753 
6754  return SCIP_OKAY;
6755 }
6756 
6757 /** increases age of constraint by 1.0;
6758  * should be called
6759  * - in constraint separation, if no cut was found for this constraint,
6760  * - in constraint enforcing, if constraint was feasible, and
6761  * - in constraint propagation, if no domain reduction was deduced;
6762  * if it's age exceeds the constraint age limit, makes constraint obsolete or marks constraint to be made obsolete
6763  * in next update
6764  */
6766  SCIP_CONS* cons, /**< constraint */
6767  BMS_BLKMEM* blkmem, /**< block memory */
6768  SCIP_SET* set, /**< global SCIP settings */
6769  SCIP_STAT* stat, /**< dynamic problem statistics */
6770  SCIP_PROB* prob /**< problem data */
6771  )
6772 {
6773  SCIP_CALL( SCIPconsAddAge(cons, blkmem, set, stat, prob, 1.0) );
6774 
6775  return SCIP_OKAY;
6776 }
6777 
6778 /** resets age of constraint to zero;
6779  * should be called
6780  * - in constraint separation, if a cut was found for this constraint,
6781  * - in constraint enforcing, if the constraint was violated, and
6782  * - in constraint propagation, if a domain reduction was deduced;
6783  * if it was obsolete, makes constraint useful again or marks constraint to be made useful again in next update
6784  */
6786  SCIP_CONS* cons, /**< constraint */
6787  SCIP_SET* set /**< global SCIP settings */
6788  )
6789 {
6790  assert(cons != NULL);
6791  assert(cons->conshdlr != NULL);
6792  assert(!cons->updateactivate);
6793  assert(set != NULL);
6794  assert(cons->scip == set->scip);
6795 
6796  SCIPdebugMessage("resetting age %g of constraint <%s> of handler <%s>\n", cons->age, cons->name, cons->conshdlr->name);
6797 
6798  conshdlrUpdateAgeresetavg(cons->conshdlr, cons->age);
6799  cons->age = 0.0;
6800 
6801  if( cons->obsolete )
6802  {
6803  assert(!cons->original);
6804  if( conshdlrAreUpdatesDelayed(cons->conshdlr) )
6805  {
6806  cons->updateobsolete = TRUE;
6807  SCIP_CALL( conshdlrAddUpdateCons(cons->conshdlr, set, cons) );
6808  assert(cons->update);
6809  }
6810  else
6811  {
6812  SCIP_CALL( conshdlrMarkConsUseful(cons->conshdlr, cons) );
6813  assert(!cons->obsolete);
6814  }
6815  }
6816 
6817  return SCIP_OKAY;
6818 }
6819 
6820 /** adds an active constraint to the propagation queue(if not already marked for propagation) of corresponding
6821  * constraint handler and marks the constraint to be propagated in the next propagation round
6822  *
6823  * @note if constraint is added to the queue it will be captured
6824  */
6826  SCIP_CONS* cons /**< constraint */
6827  )
6828 {
6829  assert(cons != NULL);
6830  assert(cons->conshdlr != NULL);
6831 
6832  if( !SCIPconsIsActive(cons) )
6833  return SCIP_OKAY;
6834 
6835  if( !cons->markedprop )
6836  {
6837  SCIP_CALL( SCIPqueueInsert(cons->conshdlr->pendingconss, (void*)cons) );
6838  SCIPconsCapture(cons);
6839  cons->markedprop = TRUE;
6840  }
6841  assert(cons->markedprop);
6842 
6843  return SCIP_OKAY;
6844 }
6845 
6846 /** returns first constraint from propagation queue(if not empty) of given constraint handler */
6848  SCIP_CONSHDLR* conshdlr /**< constraint handler */
6849  )
6850 {
6851  if( SCIPqueueIsEmpty(conshdlr->pendingconss) )
6852  return NULL;
6853 
6854  return (SCIP_CONS*)SCIPqueueFirst(conshdlr->pendingconss);
6855 }
6856 
6857 /** removes constraint from propagation queue(if not empty) of given constraint handler and unmarks constraint to be
6858  * propagated in the next propagation round
6859  *
6860  * @note if constraint is removed from the queue it will be released
6861  */
6863  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
6864  BMS_BLKMEM* blkmem, /**< block memory */
6865  SCIP_SET* set /**< global SCIP settings */
6866  )
6867 {
6868  SCIP_CONS* cons;
6869 
6870  if( SCIPqueueIsEmpty(conshdlr->pendingconss) )
6871  return SCIP_OKAY;
6872 
6873  cons = (SCIP_CONS*)SCIPqueueRemove(conshdlr->pendingconss);
6874  assert(cons != NULL);
6875 
6876  cons->markedprop = FALSE;
6877  SCIP_CALL( SCIPconsRelease(&cons, blkmem, set) );
6878 
6879  return SCIP_OKAY;
6880 }
6881 
6882 /** resolves the given conflicting bound, that was deduced by the given constraint, by putting all "reason" bounds
6883  * leading to the deduction into the conflict queue with calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(),
6884  * SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or SCIPaddConflictBinvar();
6885  *
6886  * @note it is sufficient to explain the relaxed bound change
6887  */
6889  SCIP_CONS* cons, /**< constraint that deduced the assignment */
6890  SCIP_SET* set, /**< global SCIP settings */
6891  SCIP_VAR* infervar, /**< variable whose bound was deduced by the constraint */
6892  int inferinfo, /**< user inference information attached to the bound change */
6893  SCIP_BOUNDTYPE inferboundtype, /**< bound that was deduced (lower or upper bound) */
6894  SCIP_BDCHGIDX* bdchgidx, /**< bound change index, representing the point of time where change took place */
6895  SCIP_Real relaxedbd, /**< the relaxed bound */
6896  SCIP_RESULT* result /**< pointer to store the result of the callback method */
6897  )
6898 {
6899  SCIP_CONSHDLR* conshdlr;
6900 
6901  assert(cons != NULL);
6902  assert((inferboundtype == SCIP_BOUNDTYPE_LOWER
6903  && SCIPvarGetLbAtIndex(infervar, bdchgidx, TRUE) > SCIPvarGetLbGlobal(infervar))
6904  || (inferboundtype == SCIP_BOUNDTYPE_UPPER
6905  && SCIPvarGetUbAtIndex(infervar, bdchgidx, TRUE) < SCIPvarGetUbGlobal(infervar)));
6906  assert(result != NULL);
6907  assert(set != NULL);
6908  assert(cons->scip == set->scip);
6909 
6910  *result = SCIP_DIDNOTRUN;
6911 
6912  conshdlr = cons->conshdlr;
6913  assert(conshdlr != NULL);
6914 
6915  if( conshdlr->consresprop != NULL )
6916  {
6917  /* start timing */
6918  SCIPclockStart(conshdlr->resproptime, set);
6919 
6920  SCIP_CALL( conshdlr->consresprop(set->scip, conshdlr, cons, infervar, inferinfo, inferboundtype, bdchgidx,
6921  relaxedbd, result) );
6922 
6923  /* stop timing */
6924  SCIPclockStop(conshdlr->resproptime, set);
6925 
6926  /* update statistics */
6927  conshdlr->nrespropcalls++;
6928 
6929  /* check result code */
6930  if( *result != SCIP_SUCCESS && *result != SCIP_DIDNOTFIND )
6931  {
6932  SCIPerrorMessage("propagation conflict resolving method of constraint handler <%s> returned invalid result <%d>\n",
6933  conshdlr->name, *result);
6934  return SCIP_INVALIDRESULT;
6935  }
6936  }
6937  else
6938  {
6939  SCIPerrorMessage("propagation conflict resolving method of constraint handler <%s> is not implemented\n",
6940  conshdlr->name);
6941  return SCIP_PLUGINNOTFOUND;
6942  }
6943 
6944  return SCIP_OKAY;
6945 }
6946 
6947 /** adds given values to lock status of the constraint and updates the rounding locks of the involved variables */
6949  SCIP_CONS* cons, /**< constraint */
6950  SCIP_SET* set, /**< global SCIP settings */
6951  int nlockspos, /**< increase in number of rounding locks for constraint */
6952  int nlocksneg /**< increase in number of rounding locks for constraint's negation */
6953  )
6954 {
6955  int oldnlockspos;
6956  int oldnlocksneg;
6957  int updlockpos;
6958  int updlockneg;
6959 
6960  assert(cons != NULL);
6961  assert(cons->conshdlr != NULL);
6962  assert(cons->conshdlr->conslock != NULL);
6963  assert(cons->nlockspos >= 0);
6964  assert(cons->nlocksneg >= 0);
6965  assert(-2 <= nlockspos && nlockspos <= 2);
6966  assert(-2 <= nlocksneg && nlocksneg <= 2);
6967  assert(set != NULL);
6968  assert(cons->scip == set->scip);
6969 
6970  /* update the rounding locks */
6971  oldnlockspos = cons->nlockspos;
6972  oldnlocksneg = cons->nlocksneg;
6973  cons->nlockspos += nlockspos;
6974  cons->nlocksneg += nlocksneg;
6975  assert(cons->nlockspos >= 0);
6976  assert(cons->nlocksneg >= 0);
6977 
6978  /* check, if the constraint switched from unlocked to locked, or from locked to unlocked */
6979  updlockpos = (int)(cons->nlockspos > 0) - (int)(oldnlockspos > 0);
6980  updlockneg = (int)(cons->nlocksneg > 0) - (int)(oldnlocksneg > 0);
6981 
6982  /* lock the variables, if the constraint switched from unlocked to locked or from locked to unlocked */
6983  if( updlockpos != 0 || updlockneg != 0 )
6984  {
6985  SCIP_CALL( cons->conshdlr->conslock(set->scip, cons->conshdlr, cons, updlockpos, updlockneg) );
6986  }
6987 
6988  return SCIP_OKAY;
6989 }
6990 
6991 /** checks single constraint for feasibility of the given solution */
6993  SCIP_CONS* cons, /**< constraint to check */
6994  SCIP_SET* set, /**< global SCIP settings */
6995  SCIP_SOL* sol, /**< primal CIP solution */
6996  SCIP_Bool checkintegrality, /**< Has integrality to be checked? */
6997  SCIP_Bool checklprows, /**< Do constraints represented by rows in the current LP have to be checked? */
6998  SCIP_Bool printreason, /**< Should the reason for the violation be printed? */
6999  SCIP_RESULT* result /**< pointer to store the result of the callback method */
7000  )
7001 {
7002  SCIP_CONSHDLR* conshdlr;
7003 
7004  assert(cons != NULL);
7005  assert(set != NULL);
7006  assert(cons->scip == set->scip);
7007  assert(result != NULL);
7008 
7009  conshdlr = cons->conshdlr;
7010  assert(conshdlr != NULL);
7011 
7012  /* call external method */
7013  assert(conshdlr->conscheck != NULL);
7014 
7015  SCIP_CALL( conshdlr->conscheck(set->scip, conshdlr, &cons, 1, sol, checkintegrality, checklprows, printreason, result) );
7016  SCIPdebugMessage(" -> checking returned result <%d>\n", *result);
7017 
7018  if( *result != SCIP_INFEASIBLE && *result != SCIP_FEASIBLE )
7019  {
7020  SCIPerrorMessage("feasibility check of constraint handler <%s> on constraint <%s> returned invalid result <%d>\n",
7021  conshdlr->name, cons->name, *result);
7022  return SCIP_INVALIDRESULT;
7023  }
7024 
7025  return SCIP_OKAY;
7026 }
7027 
7028 /** enforces single constraint for a given pseudo solution */
7030  SCIP_CONS* cons, /**< constraint to enforce */
7031  SCIP_SET* set, /**< global SCIP settings */
7032  SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */
7033  SCIP_Bool objinfeasible, /**< is the solution infeasible anyway due to violating lower objective bound? */
7034  SCIP_RESULT* result /**< pointer to store the result of the callback method */
7035  )
7036 {
7037  SCIP_CONSHDLR* conshdlr;
7038 
7039  assert(cons != NULL);
7040  assert(set != NULL);
7041  assert(cons->scip == set->scip);
7042  assert(result != NULL);
7043 
7044  conshdlr = cons->conshdlr;
7045  assert(conshdlr != NULL);
7046 
7047  /* call external method */
7048  assert(conshdlr->consenfops != NULL);
7049 
7050  SCIP_CALL( conshdlr->consenfops(set->scip, conshdlr, &cons, 1, 1, solinfeasible, objinfeasible, result) );
7051  SCIPdebugMessage(" -> enfops returned result <%d>\n", *result);
7052 
7053  if( *result != SCIP_CUTOFF
7054  && *result != SCIP_CONSADDED
7055  && *result != SCIP_REDUCEDDOM
7056  && *result != SCIP_BRANCHED
7057  && *result != SCIP_SOLVELP
7058  && *result != SCIP_INFEASIBLE
7059  && *result != SCIP_FEASIBLE
7060  && *result != SCIP_DIDNOTRUN )
7061  {
7062  SCIPerrorMessage("enforcing method of constraint handler <%s> for pseudo solutions returned invalid result <%d>\n",
7063  conshdlr->name, *result);
7064  return SCIP_INVALIDRESULT;
7065  }
7066 
7067  /* do not update statistics */
7068 
7069  return SCIP_OKAY;
7070 }
7071 
7072 /** enforces single constraint for a given LP solution */
7074  SCIP_CONS* cons, /**< constraint to enforce */
7075  SCIP_SET* set, /**< global SCIP settings */
7076  SCIP_Bool solinfeasible, /**< was the solution already declared infeasible by a constraint handler? */
7077  SCIP_RESULT* result /**< pointer to store the result of the callback method */
7078  )
7079 {
7080  SCIP_CONSHDLR* conshdlr;
7081 
7082  assert(cons != NULL);
7083  assert(set != NULL);
7084  assert(cons->scip == set->scip);
7085  assert(result != NULL);
7086 
7087  conshdlr = cons->conshdlr;
7088  assert(conshdlr != NULL);
7089 
7090  /* call external method */
7091  assert(conshdlr->consenfolp != NULL);
7092 
7093  SCIP_CALL( conshdlr->consenfolp(set->scip, conshdlr, &cons, 1, 1, solinfeasible, result) );
7094  SCIPdebugMessage(" -> enfolp returned result <%d>\n", *result);
7095 
7096  if( *result != SCIP_CUTOFF
7097  && *result != SCIP_CONSADDED
7098  && *result != SCIP_REDUCEDDOM
7099  && *result != SCIP_BRANCHED
7100  && *result != SCIP_SEPARATED
7101  && *result != SCIP_INFEASIBLE
7102  && *result != SCIP_FEASIBLE)
7103  {
7104  SCIPerrorMessage("enforcing method of constraint handler <%s> for LP returned invalid result <%d>\n",
7105  conshdlr->name, *result);
7106  return SCIP_INVALIDRESULT;
7107  }
7108 
7109  /* do not update statistics */
7110 
7111  return SCIP_OKAY;
7112 }
7113 
7114 
7115 /** calls LP initialization method for single constraint */
7117  SCIP_CONS* cons, /**< constraint to initialize */
7118  SCIP_SET* set /**< global SCIP settings */
7119  )
7120 {
7121  SCIP_CONSHDLR* conshdlr;
7122 
7123  assert(cons != NULL);
7124  assert(set != NULL);
7125  assert(cons->scip == set->scip);
7126 
7127  conshdlr = cons->conshdlr;
7128  assert(conshdlr != NULL);
7129 
7130  /* call external method */
7131  if( conshdlr->consinitlp != NULL )
7132  {
7133  SCIP_CALL( conshdlr->consinitlp(set->scip, conshdlr, &cons, 1) );
7134  }
7135 
7136  return SCIP_OKAY;
7137 }
7138 
7139 /** calls separation method of single constraint for LP solution */
7141  SCIP_CONS* cons, /**< constraint to separate */
7142  SCIP_SET* set, /**< global SCIP settings */
7143  SCIP_RESULT* result /**< pointer to store the result of the separation call */
7144  )
7145 {
7146  SCIP_CONSHDLR* conshdlr;
7147 
7148  assert(cons != NULL);
7149  assert(set != NULL);
7150  assert(cons->scip == set->scip);
7151  assert(result != NULL);
7152 
7153  conshdlr = cons->conshdlr;
7154  assert(conshdlr != NULL);
7155 
7156  /* call external method */
7157  if( conshdlr->conssepalp != NULL )
7158  {
7159  SCIP_CALL( conshdlr->conssepalp(set->scip, conshdlr, &cons, 1, 1, result) );
7160  SCIPdebugMessage(" -> sepalp returned result <%d>\n", *result);
7161 
7162  if( *result != SCIP_CUTOFF
7163  && *result != SCIP_CONSADDED
7164  && *result != SCIP_REDUCEDDOM
7165  && *result != SCIP_SEPARATED
7166  && *result != SCIP_NEWROUND
7167  && *result != SCIP_DIDNOTFIND
7168  && *result != SCIP_DIDNOTRUN
7169  && *result != SCIP_DELAYED )
7170  {
7171  SCIPerrorMessage("separation method of constraint handler <%s> returned invalid result <%d>\n", conshdlr->name,
7172  *result);
7173  return SCIP_INVALIDRESULT;
7174  }
7175  }
7176 
7177  return SCIP_OKAY;
7178 }
7179 
7180 /** calls separation method of single constraint for given primal solution */
7182  SCIP_CONS* cons, /**< constraint to separate */
7183  SCIP_SET* set, /**< global SCIP settings */
7184  SCIP_SOL* sol, /**< primal solution that should be separated */
7185  SCIP_RESULT* result /**< pointer to store the result of the separation call */
7186  )
7187 {
7188  SCIP_CONSHDLR* conshdlr;
7189 
7190  assert(cons != NULL);
7191  assert(set != NULL);
7192  assert(cons->scip == set->scip);
7193  assert(sol != NULL);
7194  assert(result != NULL);
7195 
7196  conshdlr = cons->conshdlr;
7197  assert(conshdlr != NULL);
7198 
7199  /* call external method */
7200  if( conshdlr->conssepasol != NULL )
7201  {
7202  SCIP_CALL( conshdlr->conssepasol(set->scip, conshdlr, &cons, 1, 1, sol, result) );
7203  SCIPdebugMessage(" -> sepasol returned result <%d>\n", *result);
7204 
7205  if( *result != SCIP_CUTOFF
7206  && *result != SCIP_CONSADDED
7207  && *result != SCIP_REDUCEDDOM
7208  && *result != SCIP_SEPARATED
7209  && *result != SCIP_NEWROUND
7210  && *result != SCIP_DIDNOTFIND
7211  && *result != SCIP_DIDNOTRUN
7212  && *result != SCIP_DELAYED )
7213  {
7214  SCIPerrorMessage("separation method of constraint handler for arbitrary primal solution <%s> returned invalid result <%d>\n",
7215  conshdlr->name, *result);
7216  return SCIP_INVALIDRESULT;
7217  }
7218  }
7219 
7220  return SCIP_OKAY;
7221 }
7222 
7223 /** calls domain propagation method of single constraint */
7225  SCIP_CONS* cons, /**< constraint to propagate */
7226  SCIP_SET* set, /**< global SCIP settings */
7227  SCIP_PROPTIMING proptiming, /**< current point in the node solving loop */
7228  SCIP_RESULT* result /**< pointer to store the result of the callback method */
7229  )
7230 {
7231  SCIP_CONSHDLR* conshdlr;
7232 
7233  assert(cons != NULL);
7234  assert(set != NULL);
7235  assert(cons->scip == set->scip);
7236  assert(result != NULL);
7237 
7238  conshdlr = cons->conshdlr;
7239  assert(conshdlr != NULL);
7240 
7241  /* call external method */
7242  if( conshdlr->consprop != NULL )
7243  {
7244  SCIP_CALL( conshdlr->consprop(set->scip, conshdlr, &cons, 1, 1, 1, proptiming, result) );
7245  SCIPdebugMessage(" -> prop returned result <%d>\n", *result);
7246 
7247  if( *result != SCIP_CUTOFF
7248  && *result != SCIP_CONSADDED
7249  && *result != SCIP_REDUCEDDOM
7250  && *result != SCIP_DIDNOTFIND
7251  && *result != SCIP_DIDNOTRUN
7252  && *result != SCIP_DELAYED )
7253  {
7254  SCIPerrorMessage("propagation method of constraint handler <%s> returned invalid result <%d>\n",
7255  conshdlr->name, *result);
7256  return SCIP_INVALIDRESULT;
7257  }
7258  }
7259 
7260  return SCIP_OKAY;
7261 }
7262 
7263 /** resolves propagation conflict of single constraint */
7265  SCIP_CONS* cons, /**< constraint to resolve conflict for */
7266  SCIP_SET* set, /**< global SCIP settings */
7267  SCIP_VAR* infervar, /**< the conflict variable whose bound change has to be resolved */
7268  int inferinfo, /**< the user information passed to the corresponding SCIPinferVarLbCons() or SCIPinferVarUbCons() call */
7269  SCIP_BOUNDTYPE boundtype, /**< the type of the changed bound (lower or upper bound) */
7270  SCIP_BDCHGIDX* bdchgidx, /**< the index of the bound change, representing the point of time where the change took place */
7271  SCIP_Real relaxedbd, /**< the relaxed bound which is sufficient to be explained */
7272  SCIP_RESULT* result /**< pointer to store the result of the callback method */
7273  )
7274 {
7275  SCIP_CONSHDLR* conshdlr;
7276 
7277  assert(cons != NULL);
7278  assert(set != NULL);
7279  assert(cons->scip == set->scip);
7280  assert(result != NULL);
7281  assert(infervar != NULL);
7282  assert(bdchgidx != NULL);
7283 
7284  conshdlr = cons->conshdlr;
7285  assert(conshdlr != NULL);
7286 
7287  /* call external method */
7288  if( conshdlr->consresprop != NULL )
7289  {
7290  SCIP_CALL( conshdlr->consresprop(set->scip, conshdlr, cons, infervar, inferinfo, boundtype, bdchgidx, relaxedbd, result) );
7291  SCIPdebugMessage(" -> resprop returned result <%d>\n", *result);
7292 
7293  if( *result != SCIP_SUCCESS
7294  && *result != SCIP_DIDNOTFIND )
7295  {
7296  SCIPerrorMessage("propagation conflict resolving method of constraint handler <%s> returned invalid result <%d>\n",
7297  conshdlr->name, *result);
7298  return SCIP_INVALIDRESULT;
7299  }
7300  }
7301 
7302  return SCIP_OKAY;
7303 }
7304 
7305 /** presolves single constraint */
7307  SCIP_CONS* cons, /**< constraint to presolve */
7308  SCIP_SET* set, /**< global SCIP settings */
7309  int nrounds, /**< number of presolving rounds already done */
7310  SCIP_PRESOLTIMING timing, /**< current presolving timing */
7311  int nnewfixedvars, /**< number of variables fixed since the last call to the presolving method */
7312  int nnewaggrvars, /**< number of variables aggregated since the last call to the presolving method */
7313  int nnewchgvartypes, /**< number of variable type changes since the last call to the presolving method */
7314  int nnewchgbds, /**< number of variable bounds tightened since the last call to the presolving method */
7315  int nnewholes, /**< number of domain holes added since the last call to the presolving method */
7316  int nnewdelconss, /**< number of deleted constraints since the last call to the presolving method */
7317  int nnewaddconss, /**< number of added constraints since the last call to the presolving method */
7318  int nnewupgdconss, /**< number of upgraded constraints since the last call to the presolving method */
7319  int nnewchgcoefs, /**< number of changed coefficients since the last call to the presolving method */
7320  int nnewchgsides, /**< number of changed left or right hand sides since the last call to the presolving method */
7321  int* nfixedvars, /**< pointer to count total number of variables fixed of all presolvers */
7322  int* naggrvars, /**< pointer to count total number of variables aggregated of all presolvers */
7323  int* nchgvartypes, /**< pointer to count total number of variable type changes of all presolvers */
7324  int* nchgbds, /**< pointer to count total number of variable bounds tightened of all presolvers */
7325  int* naddholes, /**< pointer to count total number of domain holes added of all presolvers */
7326  int* ndelconss, /**< pointer to count total number of deleted constraints of all presolvers */
7327  int* naddconss, /**< pointer to count total number of added constraints of all presolvers */
7328  int* nupgdconss, /**< pointer to count total number of upgraded constraints of all presolvers */
7329  int* nchgcoefs, /**< pointer to count total number of changed coefficients of all presolvers */
7330  int* nchgsides, /**< pointer to count total number of changed left/right hand sides of all presolvers */
7331  SCIP_RESULT* result /**< pointer to store the result of the callback method */
7332  )
7333 {
7334  SCIP_CONSHDLR* conshdlr;
7335 
7336  assert(cons != NULL);
7337  assert(set != NULL);
7338  assert(cons->scip == set->scip);
7339  assert(nfixedvars != NULL);
7340  assert(naggrvars != NULL);
7341  assert(nchgvartypes != NULL);
7342  assert(nchgbds != NULL);
7343  assert(naddholes != NULL);
7344  assert(ndelconss != NULL);
7345  assert(naddconss != NULL);
7346  assert(nupgdconss != NULL);
7347  assert(nchgcoefs != NULL);
7348  assert(nchgsides != NULL);
7349  assert(result != NULL);
7350 
7351  conshdlr = cons->conshdlr;
7352  assert(conshdlr != NULL);
7353 
7354  /* call external method */
7355  if( conshdlr->conspresol != NULL )
7356  {
7357  SCIP_CALL( conshdlr->conspresol(set->scip, conshdlr, &cons, 1, nrounds, timing,
7358  nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewholes, nnewdelconss, nnewaddconss,
7359  nnewupgdconss, nnewchgcoefs, nnewchgsides, nfixedvars, naggrvars, nchgvartypes,
7360  nchgbds, naddholes, ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides, result) );
7361  SCIPdebugMessage(" -> presol returned result <%d>\n", *result);
7362 
7363  if( *result != SCIP_UNBOUNDED
7364  && *result != SCIP_CUTOFF
7365  && *result != SCIP_SUCCESS
7366  && *result != SCIP_DIDNOTFIND
7367  && *result != SCIP_DIDNOTRUN
7368  && *result != SCIP_DELAYED )
7369  {
7370  SCIPerrorMessage("presolving method of constraint handler <%s> returned invalid result <%d>\n",
7371  conshdlr->name, *result);
7372  return SCIP_INVALIDRESULT;
7373  }
7374  }
7375 
7376  return SCIP_OKAY;
7377 }
7378 
7379 /** calls constraint activation notification method of single constraint */
7381  SCIP_CONS* cons, /**< constraint to notify */
7382  SCIP_SET* set /**< global SCIP settings */
7383  )
7384 {
7385  SCIP_CONSHDLR* conshdlr;
7386 
7387  assert(cons != NULL);
7388  assert(set != NULL);
7389  assert(cons->scip == set->scip);
7390 
7391  conshdlr = cons->conshdlr;
7392  assert(conshdlr != NULL);
7393 
7394  /* call external method */
7395  if( conshdlr->consactive != NULL )
7396  {
7397  SCIP_CALL( conshdlr->consactive(set->scip, conshdlr, cons) );
7398  }
7399 
7400  return SCIP_OKAY;
7401 }
7402 
7403 /** calls constraint deactivation notification method of single constraint */
7405  SCIP_CONS* cons, /**< constraint to notify */
7406  SCIP_SET* set /**< global SCIP settings */
7407  )
7408 {
7409  SCIP_CONSHDLR* conshdlr;
7410 
7411  assert(cons != NULL);
7412  assert(set != NULL);
7413  assert(cons->scip == set->scip);
7414 
7415  conshdlr = cons->conshdlr;
7416  assert(conshdlr != NULL);
7417 
7418  /* call external method */
7419  if( conshdlr->consdeactive != NULL )
7420  {
7421  SCIP_CALL( conshdlr->consdeactive(set->scip, conshdlr, cons) );
7422  }
7423 
7424  return SCIP_OKAY;
7425 }
7426 
7427 
7428 
7429 /*
7430  * Hash functions
7431  */
7432 
7433 /** gets the key (i.e. the name) of the given constraint */
7434 SCIP_DECL_HASHGETKEY(SCIPhashGetKeyCons)
7435 { /*lint --e{715}*/
7436  SCIP_CONS* cons = (SCIP_CONS*)elem;
7437 
7438  assert(cons != NULL);
7439  return cons->name;
7440 }
7441 
7442 
7443 /*
7444  * method for arrays of contraint handlers
7445  */
7446 
7447 /** ensures size of storage for propagable constraints with a minimum size of num */
7448 static
7450  SCIP_SET* set, /**< global SCIP settings */
7451  SCIP_CONSHDLR* conshdlr, /**< constraint handler */
7452  int num /**< minimum number of entries to store */
7453  )
7454 {
7455  assert(set != NULL);
7456  assert(conshdlr != NULL);
7457 
7458  if( num > conshdlr->storedpropconsssize )
7459  {
7460  int newsize;
7461 
7462  newsize = SCIPsetCalcMemGrowSize(set, num);
7463  SCIP_ALLOC( BMSreallocMemoryArray(&(conshdlr->storedpropconss), newsize) );
7464 
7465  conshdlr->storedpropconsssize = newsize;
7466  }
7467  assert(num <= conshdlr->storedpropconsssize);
7468 
7469  return SCIP_OKAY;
7470 }
7471 
7472 /** stores all constraints marked for propagation away when probing is started */
7474  SCIP_SET* set, /**< global SCIP settings */
7475  SCIP_CONSHDLR** conshdlrs, /**< all constraint handlers */
7476  int nconshdlrs /**< number of contraint handlers */
7477  )
7478 {
7479  SCIP_CONSHDLR* conshdlr;
7480  int c;
7481 
7482  assert(set != NULL);
7483  assert(conshdlrs != NULL || nconshdlrs == 0);
7484 
7485  for( c = nconshdlrs - 1; c >= 0; --c )
7486  {
7487  conshdlr = conshdlrs[c]; /*lint !e613*/
7488  assert(conshdlr != NULL);
7489  assert(conshdlr->storednmarkedpropconss == 0);
7490 
7491  if( conshdlr->nmarkedpropconss > 0 )
7492  {
7493  int v;
7494 
7495  SCIP_CALL( ensurePropagationStorage(set, conshdlr, conshdlr->nmarkedpropconss) );
7496  BMScopyMemoryArray(conshdlr->storedpropconss, conshdlr->propconss, conshdlr->nmarkedpropconss);
7497 
7498  conshdlr->storednmarkedpropconss = conshdlr->nmarkedpropconss;
7499  conshdlr->storedpropdomchgcount = conshdlr->lastpropdomchgcount;
7500 
7501  for( v = conshdlr->storednmarkedpropconss - 1; v >= 0; --v )
7502  {
7503  SCIPconsCapture(conshdlr->storedpropconss[v]);
7504  SCIP_CALL( SCIPconsUnmarkPropagate(conshdlr->storedpropconss[v], set) );
7505  }
7506  assert(conshdlr->nmarkedpropconss == 0);
7507  }
7508  }
7509 
7510  return SCIP_OKAY;
7511 }
7512 
7513 /** reset all constraints marked for propagation when probing was finished */
7515  SCIP_SET* set, /**< global SCIP settings */
7516  BMS_BLKMEM* blkmem, /**< block memory */
7517  SCIP_CONSHDLR** conshdlrs, /**< all constraint handlers */
7518  int nconshdlrs /**< number of contraint handlers */
7519  )
7520 {
7521  SCIP_CONSHDLR* conshdlr;
7522  int c;
7523 
7524  assert(set != NULL);
7525  assert(blkmem != NULL);
7526  assert(conshdlrs != NULL || nconshdlrs == 0);
7527 
7528  for( c = nconshdlrs - 1; c >= 0; --c )
7529  {
7530  conshdlr = conshdlrs[c]; /*lint !e613*/
7531  assert(conshdlr != NULL);
7532 
7533  if( conshdlr->storednmarkedpropconss > 0 )
7534  {
7535 #ifndef NDEBUG
7536  int ndisabled = 0;
7537 #endif
7538  int v;
7539 
7540  /* mark all previously marked constraint, which were marked before probing */
7541  for( v = conshdlr->storednmarkedpropconss - 1; v >= 0; --v )
7542  {
7543  SCIP_CONS* cons = conshdlr->storedpropconss[v];
7544  assert(cons != NULL);
7545 
7546  if( cons->enabled && cons->propagate && cons->propenabled )
7547  {
7548  SCIP_CALL( SCIPconsMarkPropagate(cons, set) );
7549  }
7550 #ifndef NDEBUG
7551  else
7552  ++ndisabled;
7553 #endif
7554  SCIP_CALL( SCIPconsRelease(&cons, blkmem, set) );
7555  }
7556  assert(conshdlr->storednmarkedpropconss - ndisabled <= conshdlr->npropconss);
7557  assert(conshdlr->nmarkedpropconss + ndisabled >= conshdlr->storednmarkedpropconss || (conshdlrAreUpdatesDelayed(conshdlr) && conshdlr->nupdateconss + ndisabled >= conshdlr->storednmarkedpropconss));
7558 
7559  conshdlr->lastpropdomchgcount = conshdlr->storedpropdomchgcount;
7560  conshdlr->storednmarkedpropconss = 0;
7561  }
7562  }
7563 
7564  return SCIP_OKAY;
7565 }
7566 
7567 /*
7568  * simple functions implemented as defines
7569  */
7570 
7571 /* In debug mode, the following methods are implemented as function calls to ensure
7572  * type validity.
7573  * In optimized mode, the methods are implemented as defines to improve performance.
7574  * However, we want to have them in the library anyways, so we have to undef the defines.
7575  */
7576 
7577 #undef SCIPconsGetName
7578 #undef SCIPconsGetPos
7579 #undef SCIPconsGetHdlr
7580 #undef SCIPconsGetData
7581 #undef SCIPconsGetNUses
7582 #undef SCIPconsGetActiveDepth
7583 #undef SCIPconsGetValidDepth
7584 #undef SCIPconsIsActive
7585 #undef SCIPconsIsEnabled
7586 #undef SCIPconsIsSeparationEnabled
7587 #undef SCIPconsIsPropagationEnabled
7588 #undef SCIPconsIsDeleted
7589 #undef SCIPconsIsObsolete
7590 #undef SCIPconsGetAge
7591 #undef SCIPconsIsInitial
7592 #undef SCIPconsIsSeparated
7593 #undef SCIPconsIsEnforced
7594 #undef SCIPconsIsChecked
7595 #undef SCIPconsIsMarkedPropagate
7596 #undef SCIPconsIsPropagated
7597 #undef SCIPconsIsGlobal
7598 #undef SCIPconsIsLocal
7599 #undef SCIPconsIsModifiable
7600 #undef SCIPconsIsDynamic
7601 #undef SCIPconsIsRemovable
7602 #undef SCIPconsIsStickingAtNode
7603 #undef SCIPconsIsInProb
7604 #undef SCIPconsIsOriginal
7605 #undef SCIPconsIsTransformed
7606 #undef SCIPconsIsLockedPos
7607 #undef SCIPconsIsLockedNeg
7608 #undef SCIPconsIsLocked
7609 #undef SCIPconsGetNLocksPos
7610 #undef SCIPconsGetNLocksNeg
7611 #undef SCIPconsIsAdded
7612 #undef SCIPconsGetNUpgradeLocks
7613 
7614 /** returns the name of the constraint
7615  *
7616  * @note to change the name of a constraint, use SCIPchgConsName() from scip.h
7617  */
7618 const char* SCIPconsGetName(
7619  SCIP_CONS* cons /**< constraint */
7620  )
7621 {
7622  assert(cons != NULL);
7623 
7624  return cons->name;
7625 }
7626 
7627 /** returns the position of constraint in the corresponding handler's conss array */
7628 int SCIPconsGetPos(
7629  SCIP_CONS* cons /**< constraint */
7630  )
7631 {
7632  assert(cons != NULL);
7633 
7634  return cons->consspos;
7635 }
7636 
7637 /** returns the constraint handler of the constraint */
7639  SCIP_CONS* cons /**< constraint */
7640  )
7641 {
7642  assert(cons != NULL);
7643 
7644  return cons->conshdlr;
7645 }
7646 
7647 /** returns the constraint data field of the constraint */
7649  SCIP_CONS* cons /**< constraint */
7650  )
7651 {
7652  assert(cons != NULL);
7653 
7654  return cons->consdata;
7655 }
7656 
7657 /** gets number of times, the constraint is currently captured */
7658 int SCIPconsGetNUses(
7659  SCIP_CONS* cons /**< constraint */
7660  )
7661 {
7662  assert(cons != NULL);
7663 
7664  return cons->nuses;
7665 }
7666 
7667 /** for an active constraint, returns the depth in the tree at which the constraint was activated */
7669  SCIP_CONS* cons /**< constraint */
7670  )
7671 {
7672  assert(cons != NULL);
7673  assert(SCIPconsIsActive(cons));
7674 
7675  return cons->activedepth;
7676 }
7677 
7678 /** returns TRUE iff constraint is active in the current node */
7680  SCIP_CONS* cons /**< constraint */
7681  )
7682 {
7683  assert(cons != NULL);
7684 
7685  return cons->updateactivate || (cons->active && !cons->updatedeactivate);
7686 }
7687 
7688 /** returns the depth in the tree at which the constraint is valid; returns INT_MAX, if the constraint is local
7689  * and currently not active
7690  */
7692  SCIP_CONS* cons /**< constraint */
7693  )
7694 {
7695  assert(cons != NULL);
7696  assert(cons->validdepth == 0 || cons->local);
7697 
7698  return (!cons->local ? 0
7699  : !SCIPconsIsActive(cons) ? INT_MAX
7700  : cons->validdepth == -1 ? SCIPconsGetActiveDepth(cons)
7701  : cons->validdepth);
7702 }
7703 
7704 /** returns TRUE iff constraint is enabled in the current node */
7706  SCIP_CONS* cons /**< constraint */
7707  )
7708 {
7709  assert(cons != NULL);
7710 
7711  return cons->updateenable || (cons->enabled && !cons->updatedisable);
7712 }
7713 
7714 /** returns TRUE iff constraint's separation is enabled in the current node */
7716  SCIP_CONS* cons /**< constraint */
7717  )
7718 {
7719  assert(cons != NULL);
7720 
7721  return SCIPconsIsEnabled(cons)
7722  && (cons->updatesepaenable || (cons->sepaenabled && !cons->updatesepadisable));
7723 }
7724 
7725 /** returns TRUE iff constraint's propagation is enabled in the current node */
7727  SCIP_CONS* cons /**< constraint */
7728  )
7729 {
7730  assert(cons != NULL);
7731 
7732  return SCIPconsIsEnabled(cons)
7733  && (cons->updatepropenable || (cons->propenabled && !cons->updatepropdisable));
7734 }
7735 
7736 /** returns TRUE iff constraint is deleted or marked to be deleted */
7738  SCIP_CONS* cons /**< constraint */
7739  )
7740 {
7741  assert(cons != NULL);
7742 
7743  return cons->deleted;
7744 }
7745 
7746 /** returns TRUE iff constraint is marked obsolete */
7748  SCIP_CONS* cons /**< constraint */
7749  )
7750 {
7751  assert(cons != NULL);
7752 
7753  return cons->updateobsolete || cons->obsolete;
7754 }
7755 
7756 /** gets age of constraint */
7758  SCIP_CONS* cons /**< constraint */
7759  )
7760 {
7761  assert(cons != NULL);
7762 
7763  return cons->age;
7764 }
7765 
7766 /** returns TRUE iff the LP relaxation of constraint should be in the initial LP */
7768  SCIP_CONS* cons /**< constraint */
7769  )
7770 {
7771  assert(cons != NULL);
7772 
7773  return cons->initial;
7774 }
7775 
7776 /** returns TRUE iff constraint should be separated during LP processing */
7778  SCIP_CONS* cons /**< constraint */
7779  )
7780 {
7781  assert(cons != NULL);
7782 
7783  return cons->separate;
7784 }
7785 
7786 /** returns TRUE iff constraint should be enforced during node processing */
7788  SCIP_CONS* cons /**< constraint */
7789  )
7790 {
7791  assert(cons != NULL);
7792 
7793  return cons->enforce;
7794 }
7795 
7796 /** returns TRUE iff constraint should be checked for feasibility */
7798  SCIP_CONS* cons /**< constraint */
7799  )
7800 {
7801  assert(cons != NULL);
7802 
7803  return cons->check;
7804 }
7805 
7806 /** returns whether the constraint is marked for propagation */
7808  SCIP_CONS* cons /**< constraint */
7809  )
7810 {
7811  assert(cons != NULL);
7812 
7813  return cons->markpropagate;
7814 }
7815 
7816 /** returns TRUE iff constraint should be propagated during node processing */
7818  SCIP_CONS* cons /**< constraint */
7819  )
7820 {
7821  assert(cons != NULL);
7822 
7823  return cons->propagate;
7824 }
7825 
7826 /** returns TRUE iff constraint is globally valid */
7828  SCIP_CONS* cons /**< constraint */
7829  )
7830 {
7831  assert(cons != NULL);
7832 
7833  return !cons->local;
7834 }
7835 
7836 /** returns TRUE iff constraint is only locally valid or not added to any (sub)problem */
7838  SCIP_CONS* cons /**< constraint */
7839  )
7840 {
7841  assert(cons != NULL);
7842 
7843  return cons->local;
7844 }
7845 
7846 /** returns TRUE iff constraint is modifiable (subject to column generation) */
7848  SCIP_CONS* cons /**< constraint */
7849  )
7850 {
7851  assert(cons != NULL);
7852 
7853  return cons->modifiable;
7854 }
7855 
7856 /** returns TRUE iff constraint is subject to aging */
7858  SCIP_CONS* cons /**< constraint */
7859  )
7860 {
7861  assert(cons != NULL);
7862 
7863  return cons->dynamic;
7864 }
7865 
7866 /** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */
7868  SCIP_CONS* cons /**< constraint */
7869  )
7870 {
7871  assert(cons != NULL);
7872 
7873  return cons->removable;
7874 }
7875 
7876 /** returns TRUE iff constraint's relaxation should be removed from the LP due to aging or cleanup */
7878  SCIP_CONS* cons /**< constraint */
7879  )
7880 {
7881  assert(cons != NULL);
7882 
7883  return cons->stickingatnode;
7884 }
7885 
7886 /** returns TRUE iff constraint belongs to the global problem */
7888  SCIP_CONS* cons /**< constraint */
7889  )
7890 {
7891  assert(cons != NULL);
7892 
7893  return (cons->addconssetchg == NULL && cons->addarraypos >= 0);
7894 }
7895 
7896 /** returns TRUE iff constraint is belonging to original space */
7898  SCIP_CONS* cons /**< constraint */
7899  )
7900 {
7901  assert(cons != NULL);
7902 
7903  return cons->original;
7904 }
7905 
7906 /** returns TRUE iff constraint is belonging to transformed space */
7908  SCIP_CONS* cons /**< constraint */
7909  )
7910 {
7911  assert(cons != NULL);
7912 
7913  return !cons->original;
7914 }
7915 
7916 /** returns TRUE iff roundings for variables in constraint are locked */
7918  SCIP_CONS* cons /**< constraint */
7919  )
7920 {
7921  assert(cons != NULL);
7922 
7923  return (cons->nlockspos > 0);
7924 }
7925 
7926 /** returns TRUE iff roundings for variables in constraint's negation are locked */
7928  SCIP_CONS* cons /**< constraint */
7929  )
7930 {
7931  assert(cons != NULL);
7932 
7933  return (cons->nlocksneg > 0);
7934 }
7935 
7936 /** returns TRUE iff roundings for variables in constraint or in constraint's negation are locked */
7938  SCIP_CONS* cons /**< constraint */
7939  )
7940 {
7941  assert(cons != NULL);
7942 
7943  return (cons->nlockspos > 0 || cons->nlocksneg > 0);
7944 }
7945 
7946 /** get number of times the roundings for variables in constraint are locked */
7948  SCIP_CONS* cons /**< constraint */
7949  )
7950 {
7951  assert(cons != NULL);
7952 
7953  return cons->nlockspos;
7954 }
7955 
7956 /** get number of times the roundings for variables in constraint's negation are locked */
7958  SCIP_CONS* cons /**< constraint */
7959  )
7960 {
7961  assert(cons != NULL);
7962 
7963  return cons->nlocksneg;
7964 }
7965 
7966 /** returns if the constraint was already added to a SCIP instance */
7968  SCIP_CONS* cons /**< constraint */
7969  )
7970 {
7971  assert(cons != NULL);
7972 
7973  return (cons->addarraypos >= 0);
7974 }
7975 
7976 /** adds locks to (dis-)allow upgrading of constraint */
7978  SCIP_CONS* cons, /**< constraint to add locks */
7979  int nlocks /**< number of locks to add */
7980  )
7981 {
7982  assert(cons != NULL);
7983 
7984  assert(cons->nupgradelocks < (1 << 29) - nlocks); /*lint !e574*/
7985  cons->nupgradelocks += (unsigned int) nlocks;
7986 }
7987 
7988 /** gets number of locks against upgrading the constraint, 0 means this constraint can be upgraded */
7990  SCIP_CONS* cons /**< constraint */
7991  )
7992 {
7993  assert(cons != NULL);
7994 
7995  return cons->nupgradelocks;
7996 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:51
SCIP_Longint SCIPconshdlrGetNChildren(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4581
SCIP_CONS * SCIPconshdlrFrontProp(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:6849
SCIP_CONS ** updateconss
Definition: struct_cons.h:185
SCIP_RETCODE SCIPconsSetChecked(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool check)
Definition: cons.c:6214
int SCIPconshdlrGetNAddHoles(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4651
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:102
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:4641
SCIP_RETCODE SCIPconsUnmarkPropagate(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:6671
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:7919
SCIP_Longint nenfolpcalls
Definition: struct_cons.h:119
SCIP_Bool SCIPconsIsLocked(SCIP_CONS *cons)
Definition: cons.c:7939
int initconsspos
Definition: struct_cons.h:51
#define BMSallocBlockMemory(mem, ptr)
Definition: memory.h:406
#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:7451
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:6767
SCIP_RETCODE SCIPconssetchgFree(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:4971
SCIP_RETCODE SCIPconsActivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Bool focusnode)
Definition: cons.c:6379
SCIP_Bool SCIPconshdlrWasPropagationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4841
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:6004
#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:5120
static SCIP_RETCODE conshdlrDisableConsSeparation(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:1300
SCIP_Longint SCIPconshdlrGetNSepaCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4451
void SCIPconshdlrSetPrint(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRINT((*consprint)))
Definition: cons.c:4198
#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:6321
void SCIPconsSetStickingAtNode(SCIP_CONS *cons, SCIP_Bool stickingatnode)
Definition: cons.c:6343
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:7183
SCIP_Bool SCIPconsIsOriginal(SCIP_CONS *cons)
Definition: cons.c:7899
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:201
#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:7889
int validdepth
Definition: struct_cons.h:59
int SCIPconshdlrGetNConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4288
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:4154
#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:4048
SCIP_Bool SCIPconshdlrIsPropagationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4811
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:5663
SCIP_CONS ** SCIPconshdlrGetConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4258
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:7849
void SCIPconshdlrSetInitsol(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITSOL((*consinitsol)))
Definition: cons.c:4026
SCIP_Longint ndomredsfound
Definition: struct_cons.h:128
int SCIPconshdlrGetSepaPriority(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4721
SCIP_Bool duringprop
Definition: struct_cons.h:266
SCIP_Longint SCIPconshdlrGetNConssFound(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4561
SCIP_RETCODE SCIPqueueInsert(SCIP_QUEUE *queue, void *elem)
Definition: misc.c:788
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:7681
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:17067
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:4801
int SCIPconshdlrGetNChgCoefs(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4691
int SCIPconshdlrGetNActiveConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4322
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:4381
int SCIPconsGetActiveDepth(SCIP_CONS *cons)
Definition: cons.c:7670
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:5936
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:4268
SCIP_RETCODE SCIPconsSetSeparated(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool separate)
Definition: cons.c:6144
SCIP_Bool SCIPconsIsTransformed(SCIP_CONS *cons)
Definition: cons.c:7909
SCIP_CONSDATA * consdata
Definition: struct_cons.h:44
#define FALSE
Definition: def.h:56
SCIP_Bool SCIPconshdlrDoesPresolve(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4791
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:4941
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:8174
SCIP_Bool SCIPconsIsMarkedPropagate(SCIP_CONS *cons)
Definition: cons.c:7809
SCIP_RESULT lastenfolpresult
Definition: struct_cons.h:136
#define TRUE
Definition: def.h:55
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
Definition: cons.c:7640
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:3993
#define SCIP_PRESOLTIMING_EXHAUSTIVE
Definition: type_timing.h:45
unsigned int enabled
Definition: struct_cons.h:81
#define SCIP_CALL(x)
Definition: def.h:266
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:4766
SCIP_Longint SCIPconshdlrGetNPropCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4481
int SCIPconshdlrGetNAddConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4671
SCIP_RETCODE SCIPconsEnableSeparation(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:6523
int SCIPconsGetNUpgradeLocks(SCIP_CONS *cons)
Definition: cons.c:7991
#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:3978
SCIP_Longint nconssfound
Definition: struct_cons.h:127
SCIP_RETCODE SCIPconsSetPropagated(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool propagate)
Definition: cons.c:6262
SCIP_Longint nchildren
Definition: struct_cons.h:129
SCIP_Real SCIPvarGetLbAtIndex(SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
Definition: var.c:15737
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:6355
unsigned int updateunmarkpropagate
Definition: struct_cons.h:99
int SCIPconshdlrGetStartNActiveConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4601
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:4781
SCIP_CLOCK * sepatime
Definition: struct_cons.h:188
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
Definition: cons.c:7839
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
Definition: cons.c:7779
SCIP_Bool SCIPqueueIsEmpty(SCIP_QUEUE *queue)
Definition: misc.c:884
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:6369
SCIP_CONS ** disabledconss
Definition: struct_cons.h:108
static void conshdlrDelSepacons(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:919
#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:4441
SCIP_Bool SCIPconshdlrIsInitialized(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4851
#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:7769
SCIP_Longint SCIPconshdlrGetNEnfoPSCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4471
SCIP_Real SCIPconshdlrGetStrongBranchPropTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4421
SCIP_RETCODE SCIPconsResetAge(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:6787
SCIP_RETCODE SCIPconsActive(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7382
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:4881
SCIP_Real SCIPconshdlrGetEnfoLPTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4391
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:4571
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:3917
unsigned int updateinsert
Definition: struct_cons.h:86
SCIP_RETCODE SCIPconsDisableSeparation(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:6553
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:5166
SCIP_RETCODE SCIPconshdlrCopyInclude(SCIP_CONSHDLR *conshdlr, SCIP_SET *set, SCIP_Bool *valid)
Definition: cons.c:1959
int SCIPconshdlrGetNDelConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4661
SCIP_CONSHDLR * SCIPsetFindConshdlr(SCIP_SET *set, const char *name)
Definition: set.c:3381
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:4037
#define SCIP_DECL_CONSPRINT(x)
Definition: type_cons.h:682
SCIP_Longint SCIPconshdlrGetNCutoffs(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4511
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:6581
int SCIPconshdlrGetNChgSides(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4701
#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:5195
unsigned int sepaenabled
Definition: struct_cons.h:67
void SCIPconshdlrEnableOrDisableClocks(SCIP_CONSHDLR *conshdlr, SCIP_Bool enable)
Definition: cons.c:4342
#define SCIP_DECL_CONSDELVARS(x)
Definition: type_cons.h:668
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
Definition: cons.c:7879
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:7266
#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:6060
SCIP_QUEUE * pendingconss
Definition: struct_cons.h:269
int SCIPconsGetNUses(SCIP_CONS *cons)
Definition: cons.c:7660
SCIP_Longint lpcount
Definition: struct_stat.h:141
unsigned int obsolete
Definition: struct_cons.h:82
#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:7226
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:3897
SCIP_Real SCIPvarGetUbAtIndex(SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
Definition: var.c:15859
int SCIPconshdlrGetEnfoPriority(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4731
SCIP_RETCODE SCIPconsDeactive(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7406
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:3836
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:8275
SCIP_Longint SCIPconshdlrGetNCheckCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4491
SCIP_Real SCIPconshdlrGetCheckTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4431
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:7620
void SCIPconshdlrSetPresolTiming(SCIP_CONSHDLR *conshdlr, SCIP_PRESOLTIMING presoltiming)
Definition: cons.c:4903
int SCIPsepastoreGetNCuts(SCIP_SEPASTORE *sepastore)
Definition: sepastore.c:1357
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:4741
SCIP_CONS ** initconss
Definition: struct_cons.h:177
#define BMSallocMemory(ptr)
Definition: memory.h:74
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:4165
SCIP_RETCODE SCIPconsChgName(SCIP_CONS *cons, BMS_BLKMEM *blkmem, const char *name)
Definition: cons.c:5770
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:5607
SCIP_Bool SCIPconsIsGlobal(SCIP_CONS *cons)
Definition: cons.c:7829
SCIP_RETCODE SCIPconsInitlp(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:7118
#define SCIP_DECL_CONSDISABLE(x)
Definition: type_cons.h:651
SCIP_Bool SCIPconshdlrIsClonable(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4861
unsigned int markedprop
Definition: struct_cons.h:61
void SCIPconshdlrSetExit(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXIT((*consexit)))
Definition: cons.c:4015
#define SCIP_PROPTIMING_ALWAYS
Definition: type_timing.h:62
SCIP_Real SCIPconsGetAge(SCIP_CONS *cons)
Definition: cons.c:7759
SCIP_Longint npropcalls
Definition: struct_cons.h:121
SCIP_Bool SCIPconshdlrWasLPSeparationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4821
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:7717
#define SCIP_PROPTIMING_AFTERLPLOOP
Definition: type_timing.h:56
internal methods for global SCIP settings
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
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:82
SCIP_Bool needscons
Definition: struct_cons.h:260
SCIP_Bool SCIPconsIsPropagationEnabled(SCIP_CONS *cons)
Definition: cons.c:7728
SCIP_Bool SCIPconsIsObsolete(SCIP_CONS *cons)
Definition: cons.c:7749
#define BMSfreeMemory(ptr)
Definition: memory.h:100
SCIP_Real SCIPconshdlrGetSetupTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4361
#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:6950
int SCIPconsGetValidDepth(SCIP_CONS *cons)
Definition: cons.c:7693
SCIP_RETCODE SCIPconsDisable(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:6489
#define AGERESETAVG_AGELIMIT
Definition: cons.c:48
static SCIP_RETCODE conssetchgCreate(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem)
Definition: cons.c:4920
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:2455
void SCIPconsAddUpgradeLocks(SCIP_CONS *cons, int nlocks)
Definition: cons.c:7979
#define AGERESETAVG_DECAY
Definition: cons.c:47
void SCIPqueueFree(SCIP_QUEUE **queue)
Definition: misc.c:766
#define SCIP_DECL_CONSENFOLP(x)
Definition: type_cons.h:313
int SCIPconshdlrGetPropFreq(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4761
SCIP_RESULT lastenfopsresult
Definition: struct_cons.h:137
void SCIPconshdlrSetActive(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSACTIVE((*consactive)))
Definition: cons.c:4143
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:7650
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:3882
#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:4551
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:103
internal methods for problem variables
int SCIPconshdlrGetSepaFreq(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4751
#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:5972
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:3693
SCIP_Longint ncutsfound
Definition: struct_cons.h:125
#define SCIP_Bool
Definition: def.h:53
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:7031
SCIP_Longint SCIPconshdlrGetNEnfoLPCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4461
static const char * paramname[]
Definition: lpi_msk.c:4201
void SCIPconsSetModifiable(SCIP_CONS *cons, SCIP_Bool modifiable)
Definition: cons.c:6310
SCIP_Longint SCIPconshdlrGetNRespropCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4501
SCIP_CONS ** propconss
Definition: struct_cons.h:181
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
Definition: cons.c:7859
unsigned int initial
Definition: struct_cons.h:62
SCIP_DECL_HASHGETKEY(SCIPhashGetKeyCons)
Definition: cons.c:7436
SCIP_RETCODE SCIPconsRelease(SCIP_CONS **cons, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:5857
SCIP_CONSHDLR * conshdlr
Definition: struct_cons.h:43
void SCIPconshdlrSetDelete(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELETE((*consdelete)))
Definition: cons.c:4099
int nlocksneg
Definition: struct_cons.h:57
void SCIPconshdlrSetInit(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINIT((*consinit)))
Definition: cons.c:4004
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:4541
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
Definition: cons.c:7869
SCIP_Bool SCIPconsIsAdded(SCIP_CONS *cons)
Definition: cons.c:7969
unsigned int separate
Definition: struct_cons.h:63
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
Definition: cons.c:7739
void SCIPconsSetRemovable(SCIP_CONS *cons, SCIP_Bool removable)
Definition: cons.c:6332
#define BMSfreeBlockMemory(mem, ptr)
Definition: memory.h:419
SCIP_RETCODE SCIPconshdlrSetPresol(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPRESOL((*conspresol)), int maxprerounds, SCIP_PRESOLTIMING presoltiming)
Definition: cons.c:4070
SCIP_RETCODE SCIPconshdlrsResetPropagationStatus(SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_CONSHDLR **conshdlrs, int nconshdlrs)
Definition: cons.c:7516
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:3526
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:7630
#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:4591
int consspos
Definition: struct_cons.h:50
int SCIPconshdlrGetNUpgdConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4681
SCIP_RETCODE SCIPprobDelCons(SCIP_PROB *prob, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: prob.c:1297
#define SCIP_DECL_CONSENFOPS(x)
Definition: type_cons.h:356
void SCIPconshdlrSetGetNVars(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETNVARS((*consgetnvars)))
Definition: cons.c:4231
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:4209
SCIP_Real age
Definition: struct_cons.h:41
int SCIPconshdlrGetNPresolCalls(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4711
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:4411
unsigned int updateactfocus
Definition: struct_cons.h:97
SCIP_PROPTIMING SCIPconshdlrGetPropTiming(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4871
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17057
int nactiveconss
Definition: struct_stat.h:186
void SCIPconsCapture(SCIP_CONS *cons)
Definition: cons.c:5845
unsigned int SCIP_PROPTIMING
Definition: type_timing.h:64
SCIP_RETCODE SCIPqueueCreate(SCIP_QUEUE **queue, int initsize, SCIP_Real sizefac)
Definition: misc.c:742
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:5282
SCIP_Longint domchgcount
Definition: struct_stat.h:85
SCIP_Bool SCIPconsIsLockedNeg(SCIP_CONS *cons)
Definition: cons.c:7929
SCIP_Longint lastenfolplpcount
Definition: struct_cons.h:196
SCIP_Longint SCIPconshdlrGetNCutsFound(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4521
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:5045
#define SCIP_DECL_CONSFREE(x)
Definition: type_cons.h:74
SCIP_Bool SCIPconshdlrWasSolSeparationDelayed(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4831
SCIP_CLOCK * enfolptime
Definition: struct_cons.h:189
int SCIPconshdlrGetNEnfoConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4298
void SCIPconshdlrSetDisable(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDISABLE((*consdisable)))
Definition: cons.c:4176
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:5368
int SCIPconshdlrGetEagerFreq(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4771
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:4893
#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:4308
SCIP_RETCODE SCIPconsAddAge(SCIP_CONS *cons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_Real deltaage)
Definition: cons.c:6709
SCIP_RETCODE SCIPconsSetInitial(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat, SCIP_Bool initial)
Definition: cons.c:6110
void SCIPconshdlrSetResprop(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSRESPROP((*consresprop)))
Definition: cons.c:4132
#define SCIP_Real
Definition: def.h:127
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:7799
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:3959
#define MIN(x, y)
Definition: memory.c:67
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:7308
SCIP_Real SCIPconshdlrGetEnfoPSTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4401
#define SCIP_DECL_CONSSEPASOL(x)
Definition: type_cons.h:271
void SCIPconshdlrSetDelvars(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSDELVARS((*consdelvars)))
Definition: cons.c:4187
#define SCIP_DECL_CONSPROP(x)
Definition: type_cons.h:421
SCIP_RETCODE SCIPconsPrint(SCIP_CONS *cons, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: cons.c:5897
SCIP_Real SCIPconshdlrGetPresolTime(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4371
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:5020
int SCIPconshdlrGetNChgVarTypes(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4631
void SCIPconshdlrSetGetVars(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETVARS((*consgetvars)))
Definition: cons.c:4220
#define SCIP_Longint
Definition: def.h:112
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:5790
void * SCIPqueueRemove(SCIP_QUEUE *queue)
Definition: misc.c:832
void SCIPconshdlrSetTrans(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSTRANS((*constrans)))
Definition: cons.c:4110
SCIP_Real ageresetavg
Definition: struct_cons.h:138
SCIP_RETCODE SCIPconsMarkPropagate(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:6641
SCIP_RETCODE SCIPconssetchgAddDisabledCons(SCIP_CONSSETCHG **conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_CONS *cons)
Definition: cons.c:5091
SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
Definition: set.c:2423
SCIP_RETCODE SCIPconsEnable(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:6456
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:4611
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:4531
SCIP_RETCODE SCIPconshdlrPopProp(SCIP_CONSHDLR *conshdlr, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:6864
SCIP_RETCODE SCIPprobAddCons(SCIP_PROB *prob, SCIP_SET *set, SCIP_STAT *stat, SCIP_CONS *cons)
Definition: prob.c:1230
void SCIPconshdlrSetExitpre(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSEXITPRE((*consexitpre)))
Definition: cons.c:4059
SCIP_RETCODE SCIPconsEnfolp(SCIP_CONS *cons, SCIP_SET *set, SCIP_Bool solinfeasible, SCIP_RESULT *result)
Definition: cons.c:7075
int addarraypos
Definition: struct_cons.h:49
SCIP_RETCODE SCIPconsDeactivate(SCIP_CONS *cons, SCIP_SET *set, SCIP_STAT *stat)
Definition: cons.c:6421
SCIP_RETCODE SCIPconsDisablePropagation(SCIP_CONS *cons, SCIP_SET *set)
Definition: cons.c:6611
void SCIPconsSetLocal(SCIP_CONS *cons, SCIP_Bool local)
Definition: cons.c:6297
#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:866
const char * SCIPconshdlrGetDesc(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:3907
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:3938
SCIP_RETCODE SCIPconshdlrsStorePropagationStatus(SCIP_SET *set, SCIP_CONSHDLR **conshdlrs, int nconshdlrs)
Definition: cons.c:7475
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:7707
#define SCIP_ALLOC(x)
Definition: def.h:277
unsigned int propagate
Definition: struct_cons.h:66
SCIP_CONS ** SCIPconshdlrGetCheckConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4278
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:2433
SCIP_Longint nprobholechgs
Definition: struct_stat.h:89
SCIP_RETCODE SCIPconshdlrLockVars(SCIP_CONSHDLR *conshdlr, SCIP_SET *set)
Definition: cons.c:3867
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
Definition: cons.c:7789
static SCIP_RETCODE conshdlrMarkConsObsolete(SCIP_CONSHDLR *conshdlr, SCIP_CONS *cons)
Definition: cons.c:379
int SCIPconshdlrGetNEnabledConss(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4332
int SCIPconsGetNLocksPos(SCIP_CONS *cons)
Definition: cons.c:7949
unsigned int nupgradelocks
Definition: struct_cons.h:100
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
Definition: cons.c:7819
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:7959
void SCIPconshdlrSetInitlp(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSINITLP((*consinitlp)))
Definition: cons.c:4121
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
Definition: cons.c:3927
#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:5463
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:6994
SCIP_RETCODE SCIPconsSepalp(SCIP_CONS *cons, SCIP_SET *set, SCIP_RESULT *result)
Definition: cons.c:7142
static SCIP_RETCODE conssetchgEnsureAddedconssSize(SCIP_CONSSETCHG *conssetchg, BMS_BLKMEM *blkmem, SCIP_SET *set, int num)
Definition: cons.c:4996
SCIP_CONSHDLRDATA * conshdlrdata
Definition: struct_cons.h:172
int SCIPconshdlrGetNAggrVars(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4621
void SCIPconshdlrSetGetDiveBdChgs(SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSGETDIVEBDCHGS((*consgetdivebdchgs)))
Definition: cons.c:4242
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:6179
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:6890
SCIP_RETCODE SCIPconsPushProp(SCIP_CONS *cons)
Definition: cons.c:6827