Scippy

SCIP

Solving Constraint Integer Programs

conflictstore.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-2017 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file conflictstore.c
17  * @brief methods for storing conflicts
18  * @author Jakob Witzig
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <assert.h>
24 #include <string.h>
25 
26 #include "scip/conflictstore.h"
27 #include "scip/cons.h"
28 #include "scip/event.h"
29 #include "scip/set.h"
30 #include "scip/tree.h"
31 #include "scip/misc.h"
32 #include "scip/prob.h"
33 #include "scip/reopt.h"
34 #include "scip/scip.h"
35 #include "scip/def.h"
36 #include "scip/cons_linear.h"
38 
39 
40 #define CONFLICTSTORE_DUALRAYSIZE 100 /* default size of conflict store */
41 #define CONFLICTSTORE_DUALSOLSIZE 75 /* default size of conflict store */
42 #define CONFLICTSTORE_MINSIZE 2000 /* default minimal size of a dynamic conflict store */
43 #define CONFLICTSTORE_MAXSIZE 60000 /* maximal size of a dynamic conflict store (multiplied by 3) */
44 #define CONFLICTSTORE_SIZE 10000 /* default size of conflict store */
45 #define CONFLICTSTORE_SORTFREQ 20 /* frequency to resort the conflict array */
46 
47 /* event handler properties */
48 #define EVENTHDLR_NAME "ConflictStore"
49 #define EVENTHDLR_DESC "Solution event handler for conflict store."
50 
51 
52 /* exec the event handler */
53 static
54 SCIP_DECL_EVENTEXEC(eventExecConflictstore)
55 {/*lint --e{715}*/
56  assert(eventhdlr != NULL);
57  assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
58  assert(event != NULL);
60 
62  {
64  }
65 
66  return SCIP_OKAY;
67 }
68 
69 /** solving process initialization method of event handler (called when branch and bound process is about to begin) */
70 static
71 SCIP_DECL_EVENTINITSOL(eventInitsolConflictstore)
72 {
73  SCIP_Bool cleanboundexceeding;
74 
75  assert(scip != NULL);
76  assert(eventhdlr != NULL);
77  assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
78 
79  SCIP_CALL( SCIPgetBoolParam(scip, "conflict/cleanboundexceedings", &cleanboundexceeding) );
80 
81  if( !cleanboundexceeding )
82  return SCIP_OKAY;
83 
84  SCIP_CALL( SCIPcatchEvent(scip, SCIP_EVENTTYPE_BESTSOLFOUND, eventhdlr, NULL, NULL) );
85 
86  return SCIP_OKAY;
87 }
88 
89 /** solving process deinitialization method of event handler (called before branch and bound process data is freed) */
90 static
91 SCIP_DECL_EVENTEXITSOL(eventExitsolConflictstore)
92 {
93  SCIP_Bool cleanboundexceeding;
94 
95  assert(scip != NULL);
96  assert(eventhdlr != NULL);
97  assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
98 
99  SCIP_CALL( SCIPgetBoolParam(scip, "conflict/cleanboundexceedings", &cleanboundexceeding) );
100 
101  if( !cleanboundexceeding )
102  return SCIP_OKAY;
103 
104  SCIP_CALL( SCIPdropEvent(scip, SCIP_EVENTTYPE_BESTSOLFOUND, eventhdlr, NULL, -1) );
105 
106  return SCIP_OKAY;
107 }
108 
109 /* comparison method for constraints */
110 static
112 {
113  /*lint --e{715}*/
114  SCIP_CONS* cons1 = (SCIP_CONS*)elem1;
115  SCIP_CONS* cons2 = (SCIP_CONS*)elem2;
116 
117  assert(cons1 != NULL);
118  assert(cons2 != NULL);
119 
120  if( SCIPconsGetAge(cons1) > SCIPconsGetAge(cons2) + 1e-09 )
121  return -1;
122  else if ( SCIPconsGetAge(cons1) < SCIPconsGetAge(cons2) - 1e-09 )
123  return +1;
124  else
125 #ifdef SCIP_DISABLED_CODE
126  /* @todo if both constraints have the same age we prefere the constraint with more non-zeros
127  * this requires a larges change of the callback, passing void-pointer (i.e. a scip
128  * object) would necessary.
129  */
130  {
131  SCIP_Bool success;
132  int nvars1;
133  int nvars2;
134 
135  SCIP_CALL( SCIPgetConsNVars(scip, cons1, &nvars1, &success) );
136  assert(success)
137 
138  SCIP_CALL( SCIPgetConsNVars(scip, cons2, &nvars2, &success) );
139  assert(success)
140 
141  if( nvars1 >= nvars2 )
142  return -1;
143  else
144  return +1;
145  }
146 #else
147  {
148  SCIP_CONSHDLR* conshdlr1 = SCIPconsGetHdlr(cons1);
149  SCIP_CONSHDLR* conshdlr2 = SCIPconsGetHdlr(cons2);
150 
151  if( strcmp(SCIPconshdlrGetName(conshdlr1), "linear") == strcmp(SCIPconshdlrGetName(conshdlr2), "linear") )
152  return 0;
153  else if( strcmp(SCIPconshdlrGetName(conshdlr1), "linear") == 0 )
154  return -1;
155  else
156  return +1;
157  }
158 #endif
159 }
160 
161 /* initializes the conflict store */
162 static
164  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
165  SCIP_SET* set, /**< global SCIP settings */
166  SCIP_PROB* transprob /**< transformed problem */
167  )
168 {
169  assert(conflictstore != NULL);
170 
171  /* calculate the maximal size of the conflict store */
172  if( conflictstore->maxstoresize == -1 )
173  {
174  SCIP_CALL( SCIPsetGetIntParam(set, "conflict/maxstoresize", &conflictstore->maxstoresize) );
175 
176  /* the size should be dynamic wrt number of variables after presolving */
177  if( conflictstore->maxstoresize == -1 )
178  {
179  int nconss;
180  int nvars;
181 
182  nconss = SCIPprobGetNConss(transprob);
183  nvars = SCIPprobGetNVars(transprob);
184 
185  conflictstore->initstoresize = CONFLICTSTORE_MINSIZE;
186  conflictstore->initstoresize += 2*nconss;
187 
188  if( nvars/2 <= 500 )
189  conflictstore->initstoresize += (int) CONFLICTSTORE_MAXSIZE/100;
190  else if( nvars/2 <= 5000 )
191  conflictstore->initstoresize += (int) CONFLICTSTORE_MAXSIZE/10;
192  else
193  conflictstore->initstoresize += CONFLICTSTORE_MAXSIZE/2;
194 
195  conflictstore->initstoresize = MIN(conflictstore->initstoresize, CONFLICTSTORE_MAXSIZE);
196  conflictstore->storesize = conflictstore->initstoresize;
197  conflictstore->maxstoresize = (int)(MIN(3.0 * conflictstore->initstoresize, CONFLICTSTORE_MAXSIZE));
198  }
199  else
200  {
201  conflictstore->initstoresize = conflictstore->maxstoresize;
202  conflictstore->storesize = conflictstore->maxstoresize;
203  }
204 
205 #ifdef NDEBUG
206  if( conflictstore->maxstoresize == 0 )
207  SCIPsetDebugMsg(set, "usage of conflict pool is disabled.\n");
208  else
209  SCIPsetDebugMsg(set, "[init,max] size of conflict pool is [%d,%d].\n",
210  conflictstore->initstoresize, conflictstore->maxstoresize);
211 #endif
212  }
213 
214  return SCIP_OKAY;
215 }
216 
217 /** resizes conflict and primal bound arrays to be able to store at least num entries */
218 static
220  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
221  SCIP_SET* set, /**< global SCIP settings */
222  BMS_BLKMEM* blkmem, /**< block memory */
223  int num /**< minimal number of slots in array */
224  )
225 {
226  assert(conflictstore != NULL);
227  assert(set != NULL);
228 
229  /* we do not allocate more memory as allowed */
230  if( conflictstore->conflictsize == conflictstore->maxstoresize )
231  return SCIP_OKAY;
232 
233  if( num > conflictstore->conflictsize )
234  {
235  int newsize;
236 #ifndef NDEBUG
237  int i;
238 #endif
239  /* initialize the complete data structure */
240  if( conflictstore->conflictsize == 0 )
241  {
242  assert(conflictstore->storesize > 0);
243 
244  newsize = MIN(conflictstore->storesize, CONFLICTSTORE_SIZE);
245  newsize = MAX(newsize, num);
246  SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &conflictstore->conflicts, newsize) );
247  SCIP_ALLOC( BMSallocBlockMemoryArray(blkmem, &conflictstore->confprimalbnds, newsize) );
248  }
249  else
250  {
251  newsize = SCIPsetCalcMemGrowSize(set, num);
252  newsize = MIN(conflictstore->maxstoresize, newsize);
253  SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &conflictstore->conflicts, conflictstore->conflictsize, \
254  newsize) );
255  SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &conflictstore->confprimalbnds, conflictstore->conflictsize, \
256  newsize) );
257  }
258 
259 #ifndef NDEBUG
260  for( i = conflictstore->nconflicts; i < newsize; i++ )
261  {
262  conflictstore->conflicts[i] = NULL;
263  conflictstore->confprimalbnds[i] = -SCIPsetInfinity(set);
264  }
265 #endif
266  conflictstore->conflictsize = newsize;
267  }
268  assert(num <= conflictstore->conflictsize || conflictstore->conflictsize == conflictstore->maxstoresize);
269 
270  return SCIP_OKAY;
271 }
272 
273 /* increase the dynamic storage if we could not delete enough conflicts
274  *
275  * we want to have at least set->conf_maxconss free slots in the conflict array, because this is the maximal number
276  * of conflicts generated at a node. we increase the size by the minimum of set->conf_maxconss and 1% of the current
277  * store size. nevertheless, we don't exceed conflictstore->maxstoresize.
278  */
279 static
281  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
282  SCIP_SET* set /**< global SCIP settings */
283  )
284 {
285  assert(conflictstore != NULL);
286 
287  /* increase storage */
288  if( conflictstore->storesize - conflictstore->nconflicts <= set->conf_maxconss
289  && conflictstore->storesize < conflictstore->maxstoresize )
290  {
291  SCIP_Real increase = ceil(0.01 * conflictstore->storesize);
292  conflictstore->storesize += MIN(set->conf_maxconss, (int)(increase));
293  conflictstore->storesize = MIN(conflictstore->storesize, conflictstore->maxstoresize);
294  }
295 
296  return;
297 }
298 
299 /* removes conflict at position pos */
300 static
302  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
303  SCIP_SET* set, /**< global SCIP settings */
304  SCIP_STAT* stat, /**< dynamic SCIP statistics */
305  SCIP_PROB* transprob, /**< transformed problem, or NULL if delete = FALSE */
306  BMS_BLKMEM* blkmem, /**< block memory */
307  SCIP_REOPT* reopt, /**< reoptimization data */
308  int pos, /**< position to remove */
309  SCIP_Bool deleteconflict /**< should the conflict be deleted? */
310  )
311 {
312  SCIP_CONS* conflict;
313  int lastpos;
314 
315  assert(conflictstore != NULL);
316  assert(pos >= 0 && pos < conflictstore->nconflicts);
317 
318  lastpos = conflictstore->nconflicts-1;
319  conflict = conflictstore->conflicts[pos];
320  assert(conflict != NULL);
321 
322  /* decrease number of conflicts depending an a cutoff bound */
323  conflictstore->ncbconflicts -= (SCIPsetIsInfinity(set, REALABS(conflictstore->confprimalbnds[pos])) ? 0 : 1);
324 
325 #ifdef SCIP_PRINT_DETAILS
326  SCIPsetDebugMsg(set, "-> remove conflict at pos=%d with age=%g\n", pos, SCIPconsGetAge(conflict));
327 #endif
328 
329  /* mark the constraint as deleted */
330  if( deleteconflict && !SCIPconsIsDeleted(conflict) )
331  {
332  assert(transprob != NULL);
333  SCIP_CALL( SCIPconsDelete(conflictstore->conflicts[pos], blkmem, set, stat, transprob, reopt) );
334  }
335  SCIP_CALL( SCIPconsRelease(&conflictstore->conflicts[pos], blkmem, set) );
336 
337  /* replace with conflict at the last position */
338  if( pos < lastpos )
339  {
340  conflictstore->conflicts[pos] = conflictstore->conflicts[lastpos];
341  conflictstore->confprimalbnds[pos] = conflictstore->confprimalbnds[lastpos];
342  }
343 
344 #ifndef NDEBUG
345  conflictstore->conflicts[lastpos] = NULL;
346  conflictstore->confprimalbnds[lastpos] = -SCIPsetInfinity(set);
347 #endif
348 
349  /* decrease number of conflicts */
350  --conflictstore->nconflicts;
351 
352  return SCIP_OKAY;
353 }
354 
355 /* removes proof based on a dual ray at position pos */
356 static
358  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
359  SCIP_SET* set, /**< global SCIP settings */
360  SCIP_STAT* stat, /**< dynamic SCIP statistics */
361  SCIP_PROB* transprob, /**< transformed problem, or NULL if delete = FALSE */
362  BMS_BLKMEM* blkmem, /**< block memory */
363  SCIP_REOPT* reopt, /**< reoptimization data */
364  int pos, /**< position to remove */
365  SCIP_Bool deleteconflict /**< should the dual ray be deleted? */
366  )
367 {
368  SCIP_CONS* dualproof;
369  SCIP_Bool success;
370  int lastpos;
371  int nvars;
372 
373  assert(conflictstore != NULL);
374 
375  lastpos = conflictstore->ndualrayconfs-1;
376  dualproof = conflictstore->dualrayconfs[pos];
377  assert(dualproof != NULL);
378 
379  /* decrease the number of non-zeros */
380  SCIP_CALL( SCIPconsGetNVars(dualproof, set, &nvars, &success) );
381  assert(success);
382  conflictstore->nnzdualrays -= nvars;
383 
384 #ifdef SCIP_PRINT_DETAILS
385  SCIPsetDebugMsg(set, "-> remove dual proof (ray) at pos=%d age=%g nvars=%d\n", pos, SCIPconsGetAge(dualproof), nvars);
386 #endif
387 
388  /* mark the constraint as deleted */
389  if( deleteconflict && !SCIPconsIsDeleted(dualproof) )
390  {
391  assert(transprob != NULL);
392  SCIP_CALL( SCIPconsDelete(dualproof, blkmem, set, stat, transprob, reopt) );
393  }
394  SCIP_CALL( SCIPconsRelease(&dualproof, blkmem, set) );
395 
396  /* replace with dual ray at the last position */
397  if( pos < lastpos )
398  {
399  conflictstore->dualrayconfs[pos] = conflictstore->dualrayconfs[lastpos];
400 
401 #ifndef NDEBUG
402  conflictstore->dualrayconfs[lastpos] = NULL;
403 #endif
404  }
405 
406  /* decrease number of dual rays */
407  --conflictstore->ndualrayconfs;
408 
409  return SCIP_OKAY;
410 }
411 
412 /* removes proof based on a dual solution at position pos */
413 static
415  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
416  SCIP_SET* set, /**< global SCIP settings */
417  SCIP_STAT* stat, /**< dynamic SCIP statistics */
418  SCIP_PROB* transprob, /**< transformed problem, or NULL if delete = FALSE */
419  BMS_BLKMEM* blkmem, /**< block memory */
420  SCIP_REOPT* reopt, /**< reoptimization data */
421  int pos, /**< position to remove */
422  SCIP_Bool deleteconflict /**< should the dual ray be deleted? */
423  )
424 {
425  SCIP_CONS* dualproof;
426  SCIP_Bool success;
427  int lastpos;
428  int nvars;
429 
430  assert(conflictstore != NULL);
431  assert(pos >= 0 && pos < conflictstore->ndualsolconfs);
432 
433  lastpos = conflictstore->ndualsolconfs-1;
434  dualproof = conflictstore->dualsolconfs[pos];
435  assert(dualproof != NULL);
436 
437  /* decrease the number of non-zeros */
438  SCIP_CALL( SCIPconsGetNVars(dualproof, set, &nvars, &success) );
439  assert(success);
440  conflictstore->nnzdualsols -= nvars;
441 
442 #ifdef SCIP_PRINT_DETAILS
443  SCIPsetDebugMsg(set, "-> remove dual proof (sol) at pos=%d age=%g nvars=%d\n", pos, SCIPconsGetAge(dualproof), nvars);
444 #endif
445 
446  /* mark the constraint as deleted */
447  if( deleteconflict && !SCIPconsIsDeleted(dualproof) )
448  {
449  assert(transprob != NULL);
450  SCIP_CALL( SCIPconsDelete(dualproof, blkmem, set, stat, transprob, reopt) );
451  }
452  SCIP_CALL( SCIPconsRelease(&dualproof, blkmem, set) );
453 
454  /* replace with dual ray at the last position */
455  if( pos < lastpos )
456  {
457  conflictstore->dualsolconfs[pos] = conflictstore->dualsolconfs[lastpos];
458  conflictstore->dualprimalbnds[pos] = conflictstore->dualprimalbnds[lastpos];
459  conflictstore->scalefactors[pos] = conflictstore->scalefactors[lastpos];
460  conflictstore->updateside[pos] = conflictstore->updateside[lastpos];
461 
462 #ifndef NDEBUG
463  conflictstore->dualsolconfs[lastpos] = NULL;
464  conflictstore->dualprimalbnds[lastpos] = SCIP_UNKNOWN;
465  conflictstore->scalefactors[lastpos] = 1.0;
466  conflictstore->updateside[lastpos] = FALSE;
467 #endif
468  }
469 
470  /* decrease number of dual rays */
471  --conflictstore->ndualsolconfs;
472 
473  return SCIP_OKAY;
474 }
475 
476 /** removes all deleted conflicts from the storage */
477 static
479  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
480  SCIP_SET* set, /**< global SCIP settings */
481  SCIP_STAT* stat, /**< dynamic SCIP statistics */
482  BMS_BLKMEM* blkmem, /**< block memory */
483  SCIP_REOPT* reopt, /**< reoptimization data */
484  int* ndelconfs /**< pointer to store the number of deleted conflicts */
485  )
486 {
487  int i;
488 
489  assert(conflictstore != NULL);
490 
491  (*ndelconfs) = 0;
492 
493  /* we traverse backwards to avoid swapping of pointers */
494  for( i = conflictstore->nconflicts-1; i >= 0; i-- )
495  {
496  assert(conflictstore->conflicts[i] != NULL);
497 
498  /* check whether the constraint is already marked as deleted */
499  if( SCIPconsIsDeleted(conflictstore->conflicts[i]) )
500  {
501  /* remove conflict at current position */
502  SCIP_CALL( delPosConflict(conflictstore, set, stat, NULL, blkmem, reopt, i, FALSE) );
503 
504  ++(*ndelconfs);
505  }
506  }
507  SCIPsetDebugMsg(set, "> removed %d/%d as deleted marked conflicts.\n", *ndelconfs, conflictstore->nconflicts + (*ndelconfs));
508 
509  return SCIP_OKAY;
510 }
511 
512 /** removes all deleted dual proofs of infeasible LP relaxations from the storage */
513 static
515  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
516  SCIP_SET* set, /**< global SCIP settings */
517  SCIP_STAT* stat, /**< dynamic SCIP statistics */
518  BMS_BLKMEM* blkmem, /**< block memory */
519  SCIP_REOPT* reopt, /**< reoptimization data */
520  int* ndelproofs /**< pointer to store the number of deleted conflicts */
521  )
522 {
523  int i;
524 
525  assert(conflictstore != NULL);
526 
527  (*ndelproofs) = 0;
528 
529  /* we traverse backwards to avoid swapping of pointers */
530  for( i = conflictstore->ndualrayconfs-1; i >= 0; i-- )
531  {
532  assert(conflictstore->dualrayconfs[i] != NULL);
533 
534  /* check whether the constraint is already marked as deleted */
535  if( SCIPconsIsDeleted(conflictstore->dualrayconfs[i]) )
536  {
537  /* remove proof at current position */
538  SCIP_CALL( delPosDualray(conflictstore, set, stat, NULL, blkmem, reopt, i, FALSE) );
539 
540  ++(*ndelproofs);
541  }
542  }
543 
544  SCIPsetDebugMsg(set, "> removed %d/%d as deleted marked dual infeasibility proofs.\n",
545  *ndelproofs, conflictstore->ndualrayconfs + (*ndelproofs));
546 
547  return SCIP_OKAY;
548 }
549 
550 /** removes all deleted dual proofs of bound exceeding LP relaxations from the storage */
551 static
553  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
554  SCIP_SET* set, /**< global SCIP settings */
555  SCIP_STAT* stat, /**< dynamic SCIP statistics */
556  BMS_BLKMEM* blkmem, /**< block memory */
557  SCIP_REOPT* reopt, /**< reoptimization data */
558  int* ndelproofs /**< pointer to store the number of deleted conflicts */
559  )
560 {
561  int i;
562 
563  assert(conflictstore != NULL);
564 
565  (*ndelproofs) = 0;
566 
567  /* we traverse backwards to avoid swapping of pointers */
568  for( i = conflictstore->ndualsolconfs-1; i >= 0; i-- )
569  {
570  assert(conflictstore->dualsolconfs[i] != NULL);
571 
572  /* check whether the constraint is already marked as deleted */
573  if( SCIPconsIsDeleted(conflictstore->dualsolconfs[i]) )
574  {
575  /* remove proof at current position */
576  SCIP_CALL( delPosDualsol(conflictstore, set, stat, NULL, blkmem, reopt, i, FALSE) );
577 
578  ++(*ndelproofs);
579  }
580  }
581 
582  SCIPsetDebugMsg(set, "> removed %d/%d as deleted marked dual boundexceeding proofs.\n",
583  *ndelproofs, conflictstore->ndualrayconfs + (*ndelproofs));
584 
585  return SCIP_OKAY;
586 }
587 
588 /** cleans up the storage */
589 static
591  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
592  SCIP_SET* set, /**< global SCIP settings */
593  SCIP_STAT* stat, /**< dynamic SCIP statistics */
594  SCIP_PROB* transprob, /**< transformed problem */
595  BMS_BLKMEM* blkmem, /**< block memory */
596  SCIP_REOPT* reopt /**< reoptimization data */
597  )
598 {
599  int ndelconfs;
600 
601  assert(conflictstore != NULL);
602  assert(blkmem != NULL);
603  assert(set != NULL);
604  assert(stat != NULL);
605  assert(transprob != NULL);
606 
607  /* the storage is empty */
608  if( conflictstore->nconflicts == 0 )
609  return SCIP_OKAY;
610  assert(conflictstore->nconflicts >= 1);
611 
612  ndelconfs = 0;
613 
614  /* remove all as deleted marked conflicts */
615  SCIP_CALL( cleanDeletedConflicts(conflictstore, set, stat, blkmem, reopt, &ndelconfs) );
616 
617  /* return if at least one conflict could be deleted */
618  if( ndelconfs > 0 )
619  goto TERMINATE;
620 
621  /* only clean up the storage if it is filled enough */
622  if( conflictstore->nconflicts < conflictstore->conflictsize )
623  goto TERMINATE;
624 
625  /* resort the array regularly */
626  if( conflictstore->ncleanups % CONFLICTSTORE_SORTFREQ == 0 )
627  {
628  /* sort conflict */
629  SCIPsortPtrReal((void**)conflictstore->conflicts, conflictstore->confprimalbnds, compareConss, conflictstore->nconflicts);
630  assert(SCIPsetIsGE(set, SCIPconsGetAge(conflictstore->conflicts[0]),
631  SCIPconsGetAge(conflictstore->conflicts[conflictstore->nconflicts-1])));
632  }
633  assert(conflictstore->nconflicts > 0);
634 
635  if( conflictstore->ncleanups % CONFLICTSTORE_SORTFREQ == 0 )
636  {
637  /* remove conflict at first position (array is sorted) */
638  SCIP_CALL( delPosConflict(conflictstore, set, stat, transprob, blkmem, reopt, 0, TRUE) );
639  }
640  else
641  {
642  SCIP_Real maxage;
643  int oldest_i;
644  int i;
645 
646  assert(!SCIPconsIsDeleted(conflictstore->conflicts[0]));
647 
648  maxage = SCIPconsGetAge(conflictstore->conflicts[0]);
649  oldest_i = 0;
650 
651  /* check the first 10% of conflicts and find the oldest */
652  for( i = 1; i < 0.1 * conflictstore->nconflicts; i++ )
653  {
654  assert(!SCIPconsIsDeleted(conflictstore->conflicts[i]));
655 
656  if( SCIPconsGetAge(conflictstore->conflicts[i]) > maxage )
657  {
658  maxage = SCIPconsGetAge(conflictstore->conflicts[i]);
659  oldest_i = i;
660  }
661  }
662 
663  /* remove conflict at position oldest_i */
664  SCIP_CALL( delPosConflict(conflictstore, set, stat, transprob, blkmem, reopt, oldest_i, TRUE) );
665  }
666  ++ndelconfs;
667 
668  /* adjust size of the storage if we use a dynamic store */
669  if( set->conf_maxstoresize == -1 )
670  adjustStorageSize(conflictstore, set);
671  assert(conflictstore->initstoresize <= conflictstore->storesize);
672  assert(conflictstore->storesize <= conflictstore->maxstoresize);
673 
674  TERMINATE:
675 
676  /* increase the number of clean ups */
677  ++conflictstore->ncleanups;
678 
679  SCIPsetDebugMsg(set, "clean-up #%lld: removed %d/%d conflicts, %d depending on cutoff bound\n",
680  conflictstore->ncleanups, ndelconfs, conflictstore->nconflicts+ndelconfs, conflictstore->ncbconflicts);
681 
682  return SCIP_OKAY;
683 }
684 
685 /** adds an original conflict constraint to the store
686  *
687  * @note the constraint will be only transfered to the storage of the transformed problem after calling
688  * SCIPconflictstoreTransform()
689  */
690 static
692  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
693  SCIP_SET* set, /**< global SCIP settings */
694  BMS_BLKMEM* blkmem, /**< block memory */
695  SCIP_CONS* cons /**< conflict constraint */
696  )
697 {
698  assert(conflictstore != NULL);
699  assert(cons != NULL);
700 
701  if( conflictstore->origconfs == NULL )
702  {
704  conflictstore->origconflictsize = CONFLICTSTORE_MINSIZE;
705  }
706  else if( conflictstore->norigconfs == conflictstore->origconflictsize )
707  {
708  int newsize = SCIPsetCalcMemGrowSize(set, conflictstore->origconflictsize+1);
709  SCIP_ALLOC( BMSreallocBlockMemoryArray(blkmem, &conflictstore->origconfs, conflictstore->origconflictsize, newsize) );
710  conflictstore->origconflictsize = newsize;
711  }
712 
713  SCIPconsCapture(cons);
714  conflictstore->origconfs[conflictstore->norigconfs] = cons;
715  ++conflictstore->norigconfs;
716 
717  return SCIP_OKAY;
718 }
719 
720 
721 /** creates conflict store */
723  SCIP_CONFLICTSTORE** conflictstore, /**< pointer to store conflict store */
724  SCIP_SET* set /**< global SCIP settings */
725  )
726 {
727  assert(conflictstore != NULL);
728 
729  SCIP_ALLOC( BMSallocMemory(conflictstore) );
730 
731  (*conflictstore)->conflicts = NULL;
732  (*conflictstore)->confprimalbnds = NULL;
733  (*conflictstore)->dualprimalbnds = NULL;
734  (*conflictstore)->scalefactors = NULL;
735  (*conflictstore)->updateside = NULL;
736  (*conflictstore)->dualrayconfs = NULL;
737  (*conflictstore)->dualsolconfs = NULL;
738  (*conflictstore)->origconfs = NULL;
739  (*conflictstore)->nnzdualrays = 0;
740  (*conflictstore)->nnzdualsols = 0;
741  (*conflictstore)->conflictsize = 0;
742  (*conflictstore)->origconflictsize = 0;
743  (*conflictstore)->nconflicts = 0;
744  (*conflictstore)->ndualrayconfs = 0;
745  (*conflictstore)->ndualsolconfs = 0;
746  (*conflictstore)->norigconfs = 0;
747  (*conflictstore)->ncbconflicts = 0;
748  (*conflictstore)->nconflictsfound = 0;
749  (*conflictstore)->initstoresize = -1;
750  (*conflictstore)->storesize = -1;
751  (*conflictstore)->maxstoresize = -1;
752  (*conflictstore)->ncleanups = 0;
753  (*conflictstore)->lastcutoffbound = SCIP_INVALID;
754  (*conflictstore)->lastnodenum = -1;
755  (*conflictstore)->eventhdlr = SCIPsetFindEventhdlr(set, EVENTHDLR_NAME);
756 
757  /* create event handler for LP events */
758  if( (*conflictstore)->eventhdlr == NULL )
759  {
760  SCIP_CALL( SCIPeventhdlrCreate(&(*conflictstore)->eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, NULL, NULL,
761  NULL, NULL, eventInitsolConflictstore, eventExitsolConflictstore, NULL, eventExecConflictstore, NULL) );
762  SCIP_CALL( SCIPsetIncludeEventhdlr(set, (*conflictstore)->eventhdlr) );
763  }
764  assert((*conflictstore)->eventhdlr != NULL);
765 
766  return SCIP_OKAY;
767 }
768 
769 /** frees conflict store */
771  SCIP_CONFLICTSTORE** conflictstore, /**< pointer to store conflict store */
772  BMS_BLKMEM* blkmem, /**< block memory */
773  SCIP_SET* set, /**< global SCIP settings */
774  SCIP_STAT* stat, /**< dynamic SCIP statistics */
775  SCIP_REOPT* reopt /**< reoptimization data */
776  )
777 {
778  assert(conflictstore != NULL);
779  assert(*conflictstore != NULL);
780 
781  /* clear the storage */
782  SCIP_CALL( SCIPconflictstoreClear(*conflictstore, blkmem, set, stat, reopt) );
783 
784  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->origconfs, (*conflictstore)->origconflictsize);
785  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->conflicts, (*conflictstore)->conflictsize);
786  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->confprimalbnds, (*conflictstore)->conflictsize);
787  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->dualrayconfs, CONFLICTSTORE_DUALRAYSIZE);
788  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->dualsolconfs, CONFLICTSTORE_DUALSOLSIZE);
789  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->dualprimalbnds, CONFLICTSTORE_DUALSOLSIZE);
790  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->scalefactors, CONFLICTSTORE_DUALSOLSIZE);
791  BMSfreeBlockMemoryArrayNull(blkmem, &(*conflictstore)->updateside, CONFLICTSTORE_DUALSOLSIZE);
792  BMSfreeMemoryNull(conflictstore);
793 
794  return SCIP_OKAY;
795 }
796 
797 /** clears conflict store */
799  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
800  BMS_BLKMEM* blkmem, /**< block memory */
801  SCIP_SET* set, /**< global SCIP settings */
802  SCIP_STAT* stat, /**< dynamic SCIP statistics */
803  SCIP_REOPT* reopt /**< reoptimization data */
804  )
805 {
806  int i;
807 
808  assert(conflictstore != NULL);
809 
810  SCIPsetDebugMsg(set, "clearing conflict store: %d origconfs, %d conflicts, %d dual proofs\n",
811  conflictstore->norigconfs, conflictstore->nconflicts, conflictstore->ndualrayconfs + conflictstore->ndualsolconfs);
812 
813  /* remove original constraints (if present) */
814  if( conflictstore->origconfs != NULL )
815  {
816  for( i = 0; i < conflictstore->norigconfs; i++ )
817  {
818  SCIP_CONS* conflict = conflictstore->origconfs[i];
819  SCIP_CALL( SCIPconsRelease(&conflict, blkmem, set) );
820  }
821  conflictstore->norigconfs = 0;
822  }
823 
824  /* clean up storage of conflict constraints */
825  if( conflictstore->conflicts != NULL )
826  {
827  /* we traverse in reverse order to avoid swapping of pointers */
828  for( i = conflictstore->nconflicts-1; i >= 0; i--)
829  {
830  SCIP_CALL( delPosConflict(conflictstore, set, stat, NULL, blkmem, reopt, i, FALSE) );
831  }
832  assert(conflictstore->nconflicts == 0);
833  }
834 
835  /* clean up storage of proof constraints based on dual rays */
836  if( conflictstore->dualrayconfs != NULL )
837  {
838  /* we traverse in reverse order to avoid swapping of pointers */
839  for( i = conflictstore->ndualrayconfs-1; i >= 0; i-- )
840  {
841  SCIP_CALL( delPosDualray(conflictstore, set, stat, NULL, blkmem, reopt, i, FALSE) );
842  }
843  assert(conflictstore->ndualrayconfs == 0);
844  }
845 
846  /* clean up storage of proof constraints based on dual solutions */
847  if( conflictstore->dualsolconfs != NULL )
848  {
849  /* we traverse in reverse order to avoid swapping of pointers */
850  for( i = conflictstore->ndualsolconfs-1; i >= 0; i-- )
851  {
852  SCIP_CALL( delPosDualsol(conflictstore, set, stat, NULL, blkmem, reopt, i, FALSE) );
853  }
854  assert(conflictstore->ndualsolconfs == 0);
855  }
856 
857  return SCIP_OKAY;
858 }
859 
860 /** cleans up conflict store */
862  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
863  BMS_BLKMEM* blkmem, /**< block memory */
864  SCIP_SET* set, /**< global SCIP settings */
865  SCIP_STAT* stat, /**< dynamic SCIP statistics */
866  SCIP_REOPT* reopt /**< reoptimization data */
867  )
868 {
869  int ndelconfs;
870  int ndeldualray;
871  int ndeldualsol;
872 
873  assert(conflictstore != NULL);
874 
875  SCIPsetDebugMsg(set, "cleaning conflict store: %d conflicts, %d dual proofs\n",
876  conflictstore->norigconfs, conflictstore->nconflicts, conflictstore->ndualrayconfs + conflictstore->ndualsolconfs);
877 
878  ndelconfs = 0;
879  ndeldualray = 0;
880  ndeldualsol = 0;
881 
882  /* remove all as deleted marked conflicts */
883  SCIP_CALL( cleanDeletedConflicts(conflictstore, set, stat, blkmem, reopt, &ndelconfs) );
884 
885  /* remove all as deleted marked dual infeasibility proofs */
886  SCIP_CALL( cleanDeletedDualrayCons(conflictstore, set, stat, blkmem, reopt, &ndeldualray) );
887 
888  /* remove all as deleted marked dual bound exceeding proofs */
889  SCIP_CALL( cleanDeletedDualsolCons(conflictstore, set, stat, blkmem, reopt, &ndeldualsol) );
890 
891  /* don't update bound exceeding proofs after a restart
892  *
893  * TODO: check whether we want to delete bound exceeding proofs in general during a restart
894  */
895  if( SCIPisInRestart(set->scip) )
896  {
897  int i;
898  for( i = 0; i < conflictstore->ndualsolconfs; i++ )
899  conflictstore->updateside[i] = FALSE;
900  }
901 
902  return SCIP_OKAY;
903 }
904 
905 /** adds a constraint to the pool of proof constraints based on dual rays
906  *
907  * @note this methods captures the constraint
908  */
910  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
911  SCIP_CONS* dualproof, /**< constraint based on a dual ray */
912  BMS_BLKMEM* blkmem, /**< block memory */
913  SCIP_SET* set, /**< global SCIP settings */
914  SCIP_STAT* stat, /**< dynamic SCIP statistics */
915  SCIP_PROB* transprob, /**< transformed problem */
916  SCIP_REOPT* reopt /**< reoptimization data */
917  )
918 {
919  int nvars;
920  SCIP_Bool success;
921 
922  assert(conflictstore != NULL);
923  assert(conflictstore->ndualrayconfs <= CONFLICTSTORE_DUALRAYSIZE);
924 
925  /* mark the constraint to be a conflict */
926  SCIPconsMarkConflict(dualproof);
927 
928  /* create an array to store constraints based on dual rays */
929  if( conflictstore->dualrayconfs == NULL )
930  {
932  }
933 
934  /* the store is full, we proceed as follows
935  *
936  * 1. check whether some constraints are marked as deleted and remove those
937  * 2. if no constraint is marked as deleted: remove the oldest
938  */
939  if( conflictstore->ndualrayconfs == CONFLICTSTORE_DUALRAYSIZE )
940  {
941  int ndeleted = 0;
942 
943  /* remove all as deleted marked dual infeasibility proofs */
944  SCIP_CALL( cleanDeletedDualrayCons(conflictstore, set, stat, blkmem, reopt, &ndeleted) );
945 
946  /* if we could not remove a dual ray that is already marked as deleted we need to remove the oldest active one */
947  if( ndeleted == 0 )
948  {
949  /* sort dual rays */
950  SCIPsortPtr((void**)conflictstore->dualrayconfs, compareConss, conflictstore->ndualrayconfs);
951  assert(SCIPsetIsGE(set, SCIPconsGetAge(conflictstore->dualrayconfs[0]),
952  SCIPconsGetAge(conflictstore->dualrayconfs[conflictstore->ndualrayconfs-1])));
953 
954  SCIP_CALL( delPosDualray(conflictstore, set, stat, transprob, blkmem, reopt, 0, TRUE) );
955  }
956  }
957 
958  /* add the new constraint based on a dual ray at the last position */
959  SCIPconsCapture(dualproof);
960  conflictstore->dualrayconfs[conflictstore->ndualrayconfs] = dualproof;
961  ++conflictstore->ndualrayconfs;
962 
963  /* increase the number of non-zeros */
964  SCIP_CALL( SCIPconsGetNVars(dualproof, set, &nvars, &success) );
965  assert(success);
966  conflictstore->nnzdualrays += nvars;
967 
968  return SCIP_OKAY;
969 }
970 
971 /** adds a constraint to the pool of proof constraints based on dual solutions
972  *
973  * @note this methods captures the constraint
974  */
976  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
977  SCIP_CONS* dualproof, /**< constraint based on a dual solution */
978  BMS_BLKMEM* blkmem, /**< block memory */
979  SCIP_SET* set, /**< global SCIP settings */
980  SCIP_STAT* stat, /**< dynamic SCIP statistics */
981  SCIP_PROB* transprob, /**< transformed problem */
982  SCIP_REOPT* reopt, /**< reoptimization data */
983  SCIP_Real scale, /**< scaling factor that needs to be considered when updating the side */
984  SCIP_Bool updateside /**< should the side be updated if a new incumbent is found */
985  )
986 {
987  int nvars;
988  SCIP_Bool success;
989 
990  assert(conflictstore != NULL);
991  assert(conflictstore->ndualsolconfs <= CONFLICTSTORE_DUALSOLSIZE);
992 
993  /* mark the constraint to be a conflict */
994  SCIPconsMarkConflict(dualproof);
995 
996  /* create an array to store constraints based on dual rays */
997  if( conflictstore->dualsolconfs == NULL )
998  {
1003  }
1004 
1005  /* the store is full, we proceed as follows
1006  *
1007  * 1. check whether some constraints are marked as deleted and remove those
1008  * 2. if no constraint is marked as deleted: remove the oldest
1009  */
1010  if( conflictstore->ndualsolconfs == CONFLICTSTORE_DUALSOLSIZE )
1011  {
1012  int ndeleted = 0;
1013 
1014  /* remove all as deleted marked dual bound exceeding proofs */
1015  SCIP_CALL( cleanDeletedDualsolCons(conflictstore, set, stat, blkmem, reopt, &ndeleted) );
1016 
1017  /* if we could not remove a dual proof that is already marked as deleted we need to remove the oldest active one */
1018  if( ndeleted == 0 )
1019  {
1020  /* sort dual rays */
1021  SCIPsortPtrRealRealInt((void**)conflictstore->dualsolconfs, conflictstore->dualprimalbnds,
1022  conflictstore->scalefactors, (int*)conflictstore->updateside, compareConss, conflictstore->ndualsolconfs);
1023  assert(SCIPsetIsGE(set, SCIPconsGetAge(conflictstore->dualsolconfs[0]),
1024  SCIPconsGetAge(conflictstore->dualsolconfs[conflictstore->ndualsolconfs-1])));
1025 
1026  SCIP_CALL( delPosDualsol(conflictstore, set, stat, transprob, blkmem, reopt, 0, TRUE) );
1027  }
1028  }
1029 
1030  /* add the new constraint based on a dual solution at the last position */
1031  SCIPconsCapture(dualproof);
1032  conflictstore->dualsolconfs[conflictstore->ndualsolconfs] = dualproof;
1033  conflictstore->dualprimalbnds[conflictstore->ndualsolconfs] = SCIPgetCutoffbound(set->scip) - SCIPsetSumepsilon(set);
1034  conflictstore->scalefactors[conflictstore->ndualsolconfs] = scale;
1035  conflictstore->updateside[conflictstore->ndualsolconfs] = updateside;
1036  ++conflictstore->ndualsolconfs;
1037 
1038  /* increase the number of non-zeros */
1039  SCIP_CALL( SCIPconsGetNVars(dualproof, set, &nvars, &success) );
1040  assert(success);
1041  conflictstore->nnzdualsols += nvars;
1042 
1043  return SCIP_OKAY;
1044 }
1045 
1046 /** adds a conflict to the conflict store
1047  *
1048  * @note this method captures the constraint
1049  */
1051  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
1052  BMS_BLKMEM* blkmem, /**< block memory */
1053  SCIP_SET* set, /**< global SCIP settings */
1054  SCIP_STAT* stat, /**< dynamic SCIP statistics */
1055  SCIP_TREE* tree, /**< branch and bound tree (or NULL for an original constraint) */
1056  SCIP_PROB* transprob, /**< transformed problem (or NULL for an original constraint) */
1057  SCIP_REOPT* reopt, /**< reoptimization data */
1058  SCIP_CONS* cons, /**< constraint representing the conflict */
1059  SCIP_CONFTYPE conftype, /**< type of the conflict */
1060  SCIP_Bool cutoffinvolved, /**< is a cutoff bound involved in this conflict */
1061  SCIP_Real primalbound /**< primal bound the conflict depend on (or -SCIPinfinity) */
1062  )
1063 {
1064  SCIP_Longint curnodenum;
1065  int nconflicts;
1066 
1067  assert(conflictstore != NULL);
1068  assert(blkmem != NULL);
1069  assert(set != NULL);
1070  assert(stat != NULL);
1071  assert(tree != NULL || SCIPconsIsOriginal(cons));
1072  assert(transprob != NULL || SCIPconsIsOriginal(cons));
1073  assert(cons != NULL);
1074  assert(conftype != SCIP_CONFTYPE_BNDEXCEEDING || cutoffinvolved);
1075  assert(!cutoffinvolved || !SCIPsetIsInfinity(set, REALABS(primalbound)));
1076 
1077  /* mark the constraint to be a conflict */
1078  SCIPconsMarkConflict(cons);
1079 
1080  /* add the constraint to a special store */
1081  if( SCIPconsIsOriginal(cons) )
1082  {
1083  assert(SCIPsetGetStage(set) == SCIP_STAGE_PROBLEM);
1084  SCIP_CALL( conflictstoreAddOrigConflict(conflictstore, set, blkmem, cons) );
1085  return SCIP_OKAY;
1086  }
1087 
1088  nconflicts = conflictstore->nconflicts;
1089 
1090  /* initialize the storage */
1091  if( conflictstore->maxstoresize == -1 )
1092  {
1093  SCIP_CALL( initConflictstore(conflictstore, set, transprob) );
1094  }
1095  assert(conflictstore->initstoresize >= 0);
1096  assert(conflictstore->initstoresize <= conflictstore->maxstoresize);
1097 
1098  /* return if conflict pool is disabled */
1099  if( conflictstore->maxstoresize <= 0 )
1100  return SCIP_OKAY;
1101 
1102  SCIP_CALL( conflictstoreEnsureMem(conflictstore, set, blkmem, nconflicts+1) );
1103 
1104  /* return if the store has size zero */
1105  if( conflictstore->conflictsize == 0 )
1106  {
1107  assert(conflictstore->maxstoresize == 0);
1108  return SCIP_OKAY;
1109  }
1110 
1111  assert(tree != NULL);
1112  curnodenum = (SCIPtreeGetFocusNode(tree) == NULL ? -1 : SCIPnodeGetNumber(SCIPtreeGetFocusNode(tree)));
1113 
1114  /* clean up the storage if we are at a new node or the storage is full */
1115  if( conflictstore->lastnodenum != curnodenum || conflictstore->nconflicts == conflictstore->conflictsize )
1116  {
1117  SCIP_CALL( conflictstoreCleanUpStorage(conflictstore, set, stat, transprob, blkmem, reopt) );
1118  }
1119 
1120  /* update the last seen node */
1121  conflictstore->lastnodenum = curnodenum;
1122 
1123  SCIPconsCapture(cons);
1124  conflictstore->conflicts[conflictstore->nconflicts] = cons;
1125  conflictstore->confprimalbnds[conflictstore->nconflicts] = primalbound;
1126  conflictstore->ncbconflicts += (SCIPsetIsInfinity(set, REALABS(primalbound)) ? 0 : 1);
1127 
1128  ++conflictstore->nconflicts;
1129  ++conflictstore->nconflictsfound;
1130 
1131 #ifdef SCIP_PRINT_DETAILS
1132  SCIPsetDebugMsg(set, "add conflict <%s> to conflict store at position %d\n", SCIPconsGetName(cons), conflictstore->nconflicts-1);
1133  SCIPsetDebugMsg(set, " -> conflict type: %d, cutoff involved = %u\n", conftype, cutoffinvolved);
1134  if( cutoffinvolved )
1135  SCIPsetDebugMsg(set, " -> current primal bound: %g\n", primalbound);
1136 #endif
1137 
1138  return SCIP_OKAY;
1139 }
1140 
1141 /** deletes all conflicts depending on a cutoff bound larger than the given bound */
1143  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
1144  SCIP_SET* set, /**< global SCIP settings */
1145  SCIP_STAT* stat, /**< dynamic SCIP statistics */
1146  BMS_BLKMEM* blkmem, /**< block memory */
1147  SCIP_PROB* transprob, /**< transformed problem*/
1148  SCIP_REOPT* reopt, /**< reoptimization data */
1149  SCIP_Real cutoffbound /**< current cutoff bound */
1150  )
1151 {
1152  SCIP_Real improvement;
1153  int ndelconfs;
1154  int nchgsides;
1155  int i;
1156 
1157  assert(conflictstore != NULL);
1158  assert(set != NULL);
1159  assert(stat != NULL);
1160  assert(blkmem != NULL);
1161  assert(transprob != NULL);
1162 
1163  /* return if we do not want to use the storage */
1164  if( set->conf_maxstoresize == 0 )
1165  return SCIP_OKAY;
1166 
1167  /* return if we do not want to remove conflicts related to an older cutoff bound */
1168  if( !set->conf_cleanbnddepend )
1169  return SCIP_OKAY;
1170 
1171  /* there is nothing to clean */
1172  if( conflictstore->ndualsolconfs == 0 && conflictstore->nconflicts == 0 )
1173  return SCIP_OKAY;
1174 
1175  /* we can stop whenever we have found a new incumbent but the cutoff bound has not changed */
1176  if( conflictstore->lastcutoffbound != SCIP_INVALID && SCIPsetIsGE(set, cutoffbound, conflictstore->lastcutoffbound) ) /*lint !e777*/
1177  return SCIP_OKAY;
1178 
1179  conflictstore->lastcutoffbound = cutoffbound;
1180 
1181  /* calculate scalar to determine whether the old primal bound is worse enough to remove the conflict */
1182  if( SCIPsetIsPositive(set, cutoffbound) )
1183  improvement = (1 - set->conf_minimprove);
1184  else
1185  improvement = (1 + set->conf_minimprove);
1186 
1187  /* remove all conflicts depending on a primalbound*improvement > cutoffbound
1188  *
1189  * note: we cannot remove conflicts that are marked as deleted because at this point in time we would destroy
1190  * the internal data structure
1191  */
1192  ndelconfs = 0;
1193  for( i = 0; i < conflictstore->nconflicts; )
1194  {
1195  assert(conflictstore->conflicts[i] != NULL);
1196 
1197  /* check if the conflict depends on the cutoff bound */
1198  if( SCIPsetIsGT(set, improvement * conflictstore->confprimalbnds[i], cutoffbound) )
1199  {
1200  /* remove conflict at current position
1201  *
1202  * don't increase i because delPosConflict will swap the last pointer to the i-th position
1203  */
1204  SCIP_CALL( delPosConflict(conflictstore, set, stat, transprob, blkmem, reopt, i, TRUE) );
1205  ++ndelconfs;
1206  }
1207  else
1208  /* increase i */
1209  ++i;
1210  }
1211  assert(conflictstore->ncbconflicts >= 0);
1212  assert(conflictstore->nconflicts >= 0);
1213 
1214  SCIPsetDebugMsg(set, "-> removed %d/%d conflicts, %d depending on cutoff bound\n", ndelconfs,
1215  conflictstore->nconflicts+ndelconfs, ndelconfs);
1216 
1217  ndelconfs = 0;
1218  nchgsides = 0;
1219  /* update all proof constraints based on a dual solution */
1220  for( i = 0; i < conflictstore->ndualsolconfs; )
1221  {
1222  SCIP_CONSHDLR* conshdlr;
1223  SCIP_CONS* dualproof;
1224 
1225  dualproof = conflictstore->dualsolconfs[i];
1226  assert(dualproof != NULL);
1227 
1228  if( SCIPconsIsDeleted(dualproof) )
1229  {
1230  ++i;
1231  continue;
1232  }
1233  if( !conflictstore->updateside[i] || SCIPsetIsLE(set, improvement * conflictstore->dualprimalbnds[i], cutoffbound) )
1234  {
1235  ++i;
1236  continue;
1237  }
1238  conshdlr = SCIPconsGetHdlr(dualproof);
1239  assert(conshdlr != NULL);
1240 
1241  if( strcmp(SCIPconshdlrGetName(conshdlr), "linear") == 0 )
1242  {
1243  SCIP_Real rhs;
1244  SCIP_Real newside;
1245 
1246  assert(SCIPsetIsGT(set, conflictstore->dualprimalbnds[i], cutoffbound));
1247 
1248  rhs = SCIPgetRhsLinear(NULL, dualproof);
1249 
1250  if( !SCIPsetIsInfinity(set, rhs) )
1251  {
1252  assert(SCIPsetIsInfinity(set, -SCIPgetLhsLinear(NULL, dualproof)));
1253  assert(SCIPsetIsPositive(set, conflictstore->scalefactors[i]));
1254 
1255  /* get unscaled rhs */
1256  newside = rhs * conflictstore->scalefactors[i];
1257  newside -= conflictstore->dualprimalbnds[i];
1258  newside += cutoffbound - SCIPsetSumepsilon(set);
1259 
1260  /* scale rhs */
1261  newside /= conflictstore->scalefactors[i];
1262 
1263  SCIP_CALL( SCIPchgRhsLinear(set->scip, dualproof, newside) );
1264  }
1265  else
1266  {
1267  SCIP_Real lhs = SCIPgetLhsLinear(NULL, dualproof);
1268  assert(!SCIPsetIsInfinity(set, -lhs));
1269  assert(SCIPsetIsNegative(set, conflictstore->scalefactors[i]));
1270 
1271  /* get unscaled lhs */
1272  newside = lhs * conflictstore->scalefactors[i];
1273  newside += conflictstore->dualprimalbnds[i];
1274  newside -= (cutoffbound - SCIPsetSumepsilon(set));
1275 
1276  /* scale lhs */
1277  newside /= conflictstore->scalefactors[i];
1278 
1279  SCIP_CALL( SCIPchgLhsLinear(set->scip, dualproof, newside) );
1280  }
1281 
1282  ++nchgsides;
1283 
1284  conflictstore->dualprimalbnds[i] = cutoffbound - SCIPsetSumepsilon(set);
1285 
1286  ++i;
1287  }
1288  else if( SCIPsetIsGT(set, improvement * conflictstore->dualprimalbnds[i], cutoffbound) )
1289  {
1290  /* remove conflict at current position
1291  *
1292  * don't increase i because delPosDualsol will swap the last pointer to the i-th position
1293  */
1294  SCIP_CALL( delPosDualsol(conflictstore, set, stat, transprob, blkmem, reopt, i, TRUE) );
1295  ++ndelconfs;
1296  }
1297  else
1298  /* increase i */
1299  ++i;
1300  }
1301 
1302  SCIPsetDebugMsg(set, "-> changed %d sides of dual solution constraints\n", nchgsides);
1303  SCIPsetDebugMsg(set, "-> deleted %d dual solution constraints\n", ndelconfs);
1304 
1305  return SCIP_OKAY;
1306 }
1307 
1308 /** returns the maximal size of the conflict pool */
1310  SCIP_CONFLICTSTORE* conflictstore /**< conflict store */
1311  )
1312 {
1313  assert(conflictstore != NULL);
1314 
1315  return MIN(conflictstore->storesize, conflictstore->maxstoresize);
1316 }
1317 
1318 /** returns the initial size of the conflict pool */
1320  SCIP_CONFLICTSTORE* conflictstore /**< conflict store */
1321  )
1322 {
1323  assert(conflictstore != NULL);
1324 
1325  return conflictstore->initstoresize;
1326 }
1327 
1328 /** returns the number of stored conflicts on the conflict pool
1329  *
1330  * @note the number of active conflicts can be less
1331  */
1333  SCIP_CONFLICTSTORE* conflictstore /**< conflict store */
1334  )
1335 {
1336  assert(conflictstore != NULL);
1337 
1338  return conflictstore->nconflicts;
1339 }
1340 
1341 /** returns all active conflicts stored in the conflict store */
1343  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
1344  SCIP_CONS** conflicts, /**< array to store conflicts */
1345  int conflictsize, /**< size of the conflict array */
1346  int* nconflicts /**< pointer to store the number of conflicts */
1347  )
1348 {
1349  int i;
1350 
1351  assert(conflictstore != NULL);
1352 
1353  /* return if the allocated memory is obviously to small */
1354  if( conflictstore->nconflicts > conflictsize )
1355  {
1356  (*nconflicts) = conflictstore->nconflicts;
1357  return SCIP_OKAY;
1358  }
1359 
1360  (*nconflicts) = 0;
1361  for( i = 0; i < conflictstore->nconflicts; i++ )
1362  {
1363  SCIP_CONS* conflict;
1364 
1365  conflict = conflictstore->conflicts[i];
1366  assert(conflict != NULL);
1367 
1368  /* skip deactivated and deleted constraints */
1369  if( !SCIPconsIsActive(conflict) || SCIPconsIsDeleted(conflict) )
1370  continue;
1371 
1372  /* count exact number conflicts */
1373  if( *nconflicts > conflictsize )
1374  ++(*nconflicts);
1375  else
1376  {
1377  conflicts[*nconflicts] = conflict;
1378  ++(*nconflicts);
1379  }
1380  }
1381 
1382  return SCIP_OKAY;
1383 }
1384 
1385 /** transformes all original conflicts into transformed conflicts */
1387  SCIP_CONFLICTSTORE* conflictstore, /**< conflict store */
1388  BMS_BLKMEM* blkmem, /**< block memory */
1389  SCIP_SET* set, /**< global SCIP settings */
1390  SCIP_STAT* stat, /**< dynamic SCIP statistics */
1391  SCIP_TREE* tree, /**< branch and bound tree */
1392  SCIP_PROB* transprob, /**< transformed problem */
1393  SCIP_REOPT* reopt /**< reoptimization data */
1394  )
1395 {
1396  int ntransconss;
1397  int i;
1398 
1399  assert(conflictstore != NULL);
1400  assert(set != NULL);
1401  assert(SCIPsetGetStage(set) == SCIP_STAGE_TRANSFORMING);
1402 
1403  /* return if no original constraints are stored */
1404  if( conflictstore->norigconfs == 0 )
1405  return SCIP_OKAY;
1406 
1407  ntransconss = 0;
1408 
1409  for( i = 0; i < conflictstore->norigconfs; i++ )
1410  {
1411  SCIP_CONS* transcons;
1412 
1413  assert(conflictstore->origconfs[i] != NULL);
1414  assert(SCIPconsIsOriginal(conflictstore->origconfs[i]));
1415 
1416  transcons = SCIPconsGetTransformed(conflictstore->origconfs[i]);
1417 
1418  if( transcons != NULL )
1419  {
1420  SCIP_CALL( SCIPconflictstoreAddConflict(conflictstore, blkmem, set, stat, tree, transprob, reopt, transcons, \
1422 
1423  ++ntransconss;
1424  }
1425 
1426  SCIP_CALL( SCIPconsRelease(&conflictstore->origconfs[i], blkmem, set) );
1427  }
1428 
1429  SCIPsetDebugMsg(set, "-> transform %d/%d conflicts into transformed space\n", ntransconss, conflictstore->norigconfs);
1430 
1431  conflictstore->norigconfs = 0;
1432 
1433  return SCIP_OKAY;
1434 }
1435 
1436 /** returns the average number of non-zeros over all stored dual ray constraints */
1438  SCIP_CONFLICTSTORE* conflictstore /**< conflict store */
1439  )
1440 {
1441  assert(conflictstore != NULL);
1442 
1443  if( conflictstore->ndualrayconfs == 0 )
1444  return 0.0;
1445  else
1446  return (SCIP_Real) conflictstore->nnzdualrays / ((SCIP_Real) conflictstore->ndualrayconfs);
1447 }
1448 
1449 /** returns the number of all stored dual ray constraints */
1451  SCIP_CONFLICTSTORE* conflictstore /**< conflict store */
1452  )
1453 {
1454  assert(conflictstore != NULL);
1455 
1456  return conflictstore->ndualrayconfs;
1457 }
1458 
1459 /** returns the average number of non-zeros over all stored boundexceeding proofs */
1461  SCIP_CONFLICTSTORE* conflictstore /**< conflict store */
1462  )
1463 {
1464  assert(conflictstore != NULL);
1465  assert(conflictstore->ndualsolconfs >= 0);
1466 
1467  if( conflictstore->ndualsolconfs == 0 )
1468  return 0.0;
1469  else
1470  return (SCIP_Real) conflictstore->nnzdualsols / ((SCIP_Real) conflictstore->ndualsolconfs);
1471 }
1472 
1473 /** returns the number of all stored boundexceeding proofs */
1475  SCIP_CONFLICTSTORE* conflictstore /**< conflict store */
1476  )
1477 {
1478  assert(conflictstore != NULL);
1479 
1480  return conflictstore->ndualsolconfs;
1481 }
1482 
SCIP_RETCODE SCIPclearConflictStore(SCIP *scip, SCIP_EVENT *event)
Definition: scip.c:13103
SCIP_RETCODE SCIPconsDelete(SCIP_CONS *cons, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *prob, SCIP_REOPT *reopt)
Definition: cons.c:6259
SCIP_RETCODE SCIPsetIncludeEventhdlr(SCIP_SET *set, SCIP_EVENTHDLR *eventhdlr)
Definition: set.c:4429
SCIP_Bool SCIPsetIsInfinity(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5776
#define BMSfreeBlockMemoryArrayNull(mem, ptr, num)
Definition: memory.h:449
internal methods for managing events
static SCIP_DECL_SORTPTRCOMP(compareConss)
SCIP_Bool SCIPsetIsLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5834
#define EVENTHDLR_NAME
Definition: conflictstore.c:48
#define CONFLICTSTORE_SORTFREQ
Definition: conflictstore.c:45
SCIP_RETCODE SCIPeventhdlrCreate(SCIP_EVENTHDLR **eventhdlr, const char *name, const char *desc, SCIP_DECL_EVENTCOPY((*eventcopy)), SCIP_DECL_EVENTFREE((*eventfree)), SCIP_DECL_EVENTINIT((*eventinit)), SCIP_DECL_EVENTEXIT((*eventexit)), SCIP_DECL_EVENTINITSOL((*eventinitsol)), SCIP_DECL_EVENTEXITSOL((*eventexitsol)), SCIP_DECL_EVENTDELETE((*eventdelete)), SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: event.c:64
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:821
int SCIPprobGetNConss(SCIP_PROB *prob)
Definition: prob.c:2359
internal methods for branch and bound tree
static SCIP_RETCODE delPosDualsol(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, BMS_BLKMEM *blkmem, SCIP_REOPT *reopt, int pos, SCIP_Bool deleteconflict)
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
Definition: scip.c:43447
static SCIP_DECL_EVENTEXITSOL(eventExitsolConflictstore)
Definition: conflictstore.c:91
int SCIPconflictstoreGetNConflictsInStore(SCIP_CONFLICTSTORE *conflictstore)
SCIP_RETCODE SCIPconflictstoreTransform(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_PROB *transprob, SCIP_REOPT *reopt)
#define CONFLICTSTORE_MINSIZE
Definition: conflictstore.c:42
SCIP_RETCODE SCIPconflictstoreCleanNewIncumbent(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_PROB *transprob, SCIP_REOPT *reopt, SCIP_Real cutoffbound)
SCIP_Bool SCIPsetIsPositive(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5899
SCIP_EVENTHDLR * SCIPsetFindEventhdlr(SCIP_SET *set, const char *name)
Definition: set.c:4452
static SCIP_RETCODE cleanDeletedConflicts(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_REOPT *reopt, int *ndelconfs)
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
Definition: set.c:5636
int SCIPprobGetNVars(SCIP_PROB *prob)
Definition: prob.c:2305
void SCIPconsMarkConflict(SCIP_CONS *cons)
Definition: cons.c:6900
#define FALSE
Definition: def.h:64
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:278
static SCIP_RETCODE cleanDeletedDualsolCons(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_REOPT *reopt, int *ndelproofs)
static SCIP_RETCODE conflictstoreEnsureMem(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, BMS_BLKMEM *blkmem, int num)
#define TRUE
Definition: def.h:63
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
int SCIPsetCalcMemGrowSize(SCIP_SET *set, int num)
Definition: set.c:5326
SCIP_NODE * SCIPtreeGetFocusNode(SCIP_TREE *tree)
Definition: tree.c:8208
SCIP_Bool SCIPsetIsNegative(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5910
SCIP_CONS * SCIPconsGetTransformed(SCIP_CONS *cons)
Definition: cons.c:6628
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:8047
SCIP_RETCODE SCIPconflictstoreClean(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_REOPT *reopt)
#define CONFLICTSTORE_DUALRAYSIZE
Definition: conflictstore.c:40
SCIP_RETCODE SCIPconflictstoreCreate(SCIP_CONFLICTSTORE **conflictstore, SCIP_SET *set)
int SCIPconflictstoreGetNDualInfProofs(SCIP_CONFLICTSTORE *conflictstore)
SCIP_Bool SCIPconsIsOriginal(SCIP_CONS *cons)
Definition: cons.c:8285
SCIP_Bool SCIPsetIsGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5870
static SCIP_DECL_EVENTEXEC(eventExecConflictstore)
Definition: conflictstore.c:54
SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
Definition: tree.c:7340
static SCIP_RETCODE delPosDualray(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, BMS_BLKMEM *blkmem, SCIP_REOPT *reopt, int pos, SCIP_Bool deleteconflict)
#define CONFLICTSTORE_DUALSOLSIZE
Definition: conflictstore.c:41
SCIP_RETCODE SCIPconflictstoreClear(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_REOPT *reopt)
SCIP_Real SCIPconsGetAge(SCIP_CONS *cons)
Definition: cons.c:8145
internal methods for storing and manipulating the main problem
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
Definition: cons.c:4113
SCIP_RETCODE SCIPgetConsNVars(SCIP *scip, SCIP_CONS *cons, int *nvars, SCIP_Bool *success)
Definition: scip.c:29170
static SCIP_RETCODE conflictstoreAddOrigConflict(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, BMS_BLKMEM *blkmem, SCIP_CONS *cons)
SCIP_RETCODE SCIPconflictstoreFree(SCIP_CONFLICTSTORE **conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_REOPT *reopt)
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:7986
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
Definition: scip.c:4432
internal miscellaneous methods
#define REALABS(x)
Definition: def.h:173
void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
internal methods for global SCIP settings
internal methods for storing conflicts
#define SCIP_CALL(x)
Definition: def.h:350
int SCIPconflictstoreGetInitPoolSize(SCIP_CONFLICTSTORE *conflictstore)
#define CONFLICTSTORE_MAXSIZE
Definition: conflictstore.c:43
static SCIP_RETCODE initConflictstore(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_PROB *transprob)
static SCIP_RETCODE delPosConflict(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, BMS_BLKMEM *blkmem, SCIP_REOPT *reopt, int pos, SCIP_Bool deleteconflict)
data structures and methods for collecting reoptimization information
#define SCIP_UNKNOWN
Definition: def.h:170
SCIP_RETCODE SCIPconsGetNVars(SCIP_CONS *cons, SCIP_SET *set, int *nvars, SCIP_Bool *success)
Definition: cons.c:6227
#define SCIP_Bool
Definition: def.h:61
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip.c:41152
SCIP_Real SCIPsetSumepsilon(SCIP_SET *set)
Definition: set.c:5668
#define BMSallocBlockMemoryArray(mem, ptr, num)
Definition: memory.h:435
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Definition: event.c:959
static SCIP_RETCODE conflictstoreCleanUpStorage(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, BMS_BLKMEM *blkmem, SCIP_REOPT *reopt)
SCIP_RETCODE SCIPconsRelease(SCIP_CONS **cons, BMS_BLKMEM *blkmem, SCIP_SET *set)
Definition: cons.c:6112
SCIP_RETCODE SCIPsetGetIntParam(SCIP_SET *set, const char *name, int *value)
Definition: set.c:2966
#define MAX(x, y)
Definition: tclique_def.h:75
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
Definition: cons.c:8006
SCIP_Real SCIPconflictstoreGetAvgNnzDualBndProofs(SCIP_CONFLICTSTORE *conflictstore)
#define CONFLICTSTORE_SIZE
Definition: conflictstore.c:44
SCIP_Bool SCIPconsIsDeleted(SCIP_CONS *cons)
Definition: cons.c:8115
#define SCIPsetDebugMsg
Definition: set.h:1913
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip.c:41186
SCIP_RETCODE SCIPconflictstoreAddDualraycons(SCIP_CONFLICTSTORE *conflictstore, SCIP_CONS *dualproof, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_REOPT *reopt)
#define EVENTHDLR_DESC
Definition: conflictstore.c:49
Constraint handler for linear constraints in their most general form, .
SCIP_RETCODE SCIPchgRhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
int SCIPconflictstoreGetMaxPoolSize(SCIP_CONFLICTSTORE *conflictstore)
static SCIP_RETCODE cleanDeletedDualrayCons(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set, SCIP_STAT *stat, BMS_BLKMEM *blkmem, SCIP_REOPT *reopt, int *ndelproofs)
#define SCIP_EVENTTYPE_BESTSOLFOUND
Definition: type_event.h:88
void SCIPconsCapture(SCIP_CONS *cons)
Definition: cons.c:6100
#define BMSfreeMemoryNull(ptr)
Definition: memory.h:128
SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5852
#define SCIP_Real
Definition: def.h:149
enum SCIP_ConflictType SCIP_CONFTYPE
Definition: type_conflict.h:56
SCIP_RETCODE SCIPconflictstoreAddConflict(SCIP_CONFLICTSTORE *conflictstore, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_TREE *tree, SCIP_PROB *transprob, SCIP_REOPT *reopt, SCIP_CONS *cons, SCIP_CONFTYPE conftype, SCIP_Bool cutoffinvolved, SCIP_Real primalbound)
void SCIPsortPtrRealRealInt(void **ptrarray, SCIP_Real *realarray1, SCIP_Real *realarray2, int *intarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
#define BMSallocMemory(ptr)
Definition: memory.h:101
#define SCIP_INVALID
Definition: def.h:169
SCIP_RETCODE SCIPconflictstoreAddDualsolcons(SCIP_CONFLICTSTORE *conflictstore, SCIP_CONS *dualproof, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_PROB *transprob, SCIP_REOPT *reopt, SCIP_Real scale, SCIP_Bool updateside)
internal methods for constraints and constraint handlers
void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
int SCIPconflictstoreGetNDualBndProofs(SCIP_CONFLICTSTORE *conflictstore)
#define SCIP_Longint
Definition: def.h:134
static SCIP_DECL_EVENTINITSOL(eventInitsolConflictstore)
Definition: conflictstore.c:71
SCIP_Real SCIPconflictstoreGetAvgNnzDualInfProofs(SCIP_CONFLICTSTORE *conflictstore)
SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
Definition: set.c:2781
SCIP_RETCODE SCIPchgLhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real lhs)
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:419
#define SCIP_ALLOC(x)
Definition: def.h:361
SCIP_Bool SCIPisInRestart(SCIP *scip)
Definition: scip.c:17576
#define BMSreallocBlockMemoryArray(mem, ptr, oldnum, newnum)
Definition: memory.h:439
SCIP_Real SCIPgetLhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPconflictstoreGetConflicts(SCIP_CONFLICTSTORE *conflictstore, SCIP_CONS **conflicts, int conflictsize, int *nconflicts)
SCIP callable library.
static void adjustStorageSize(SCIP_CONFLICTSTORE *conflictstore, SCIP_SET *set)