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