Scippy

SCIP

Solving Constraint Integer Programs

debug.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 debug.c
17  * @ingroup OTHER_CFILES
18  * @brief methods for debugging
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #include <stdio.h>
25 #include <string.h>
26 #include <assert.h>
27 #if defined(_WIN32) || defined(_WIN64)
28 #else
29 #include <strings.h> /*lint --e{766}*/
30 #endif
31 
32 #include "scip/def.h"
33 #include "blockmemshell/memory.h"
34 #include "scip/set.h"
35 #include "scip/lp.h"
36 #include "scip/var.h"
37 #include "scip/prob.h"
38 #include "scip/tree.h"
39 #include "scip/scip.h"
40 #include "scip/debug.h"
41 #include "scip/pub_message.h"
42 #include "scip/pub_misc.h"
43 #include "scip/struct_scip.h"
44 
45 #ifdef WITH_DEBUG_SOLUTION
46 
47 #define SCIP_HASHSIZE_DEBUG 500 /**< minimum size of hash map for storing whether a solution is valid for the node */
48 
49 struct SCIP_DebugSolData
50 {
51  char** solnames; /**< variable names in the solution */
52  SCIP_Real* solvals; /**< solution value array (only nonzero entries) */
53  int nsolvals; /**< number of entries in the debug solution */
54  int solsize; /**< size of the array entries */
55  SCIP_SOL* debugsol; /**< a debug solution */
56  SCIP_STAGE debugsolstage; /**< solving stage of debug solution */
57  SCIP_HASHMAP* solinnode; /**< maps nodes to bools, storing whether the solution is valid for the node */
58  SCIP_Bool falseptr; /**< pointer to value FALSE used for hashmap */
59  SCIP_Bool trueptr; /**< pointer to value TRUE used for hashmap */
60  SCIP_Bool solisachieved; /**< means if current best solution is better than the given debug solution */
61  SCIP_Real debugsolval; /**< objective value for debug solution */
62  SCIP_Bool debugsoldisabled; /**< flag indicating if debugging of solution was disabled or not */
63  SCIP_Bool warningprinted; /**< flag indicating if a warning was already printed */
64 };
65 
66 
67 /** creates debug solution data */
69  SCIP_DEBUGSOLDATA** debugsoldata /**< pointer to debug solution data */
70  )
71 {
72  assert(debugsoldata != NULL);
73 
74  SCIP_ALLOC( BMSallocMemory(debugsoldata) );
75 
76  (*debugsoldata)->solnames = NULL;
77  (*debugsoldata)->solvals = NULL;
78  (*debugsoldata)->nsolvals = 0;
79  (*debugsoldata)->solsize = 0;
80  (*debugsoldata)->debugsol = NULL;
81  (*debugsoldata)->debugsolstage = SCIP_STAGE_INIT;
82  (*debugsoldata)->solinnode = NULL;
83  (*debugsoldata)->falseptr = FALSE;
84  (*debugsoldata)->trueptr = TRUE;
85  (*debugsoldata)->solisachieved = FALSE;
86  (*debugsoldata)->debugsolval = 0.0;
87  (*debugsoldata)->debugsoldisabled = TRUE;
88  (*debugsoldata)->warningprinted = FALSE;
89 
90  return SCIP_OKAY;
91 }
92 
93 #ifdef SCIP_MORE_DEBUG
94 /** comparison method for sorting variables w.r.t. to their name */
95 static
96 SCIP_DECL_SORTPTRCOMP(sortVarsAfterNames)
97 {
98  return strcmp(SCIPvarGetName((SCIP_VAR*)elem1), SCIPvarGetName((SCIP_VAR*)elem2));
99 }
100 #endif
101 
102 /* checks whether the parameter is specified */
103 static
104 SCIP_Bool debugSolutionAvailable(
105  SCIP_SET* set /**< global SCIP settings */
106  )
107 {
108  SCIP_DEBUGSOLDATA* debugsoldata;
109 
110  assert(set != NULL);
111 
112  debugsoldata = SCIPsetGetDebugSolData(set);
113 
114  /* check whether a debug solution is specified */
115  if( strcmp(set->misc_debugsol, "-") == 0 )
116  {
117  if( !debugsoldata->warningprinted )
118  {
119  SCIPmessagePrintWarning(SCIPgetMessagehdlr(set->scip), "SCIP is compiled with 'DEBUGSOL=true' but no debug solution is given:\n ");
120  SCIPmessagePrintWarning(SCIPgetMessagehdlr(set->scip), "*** Please set the parameter 'misc/debugsol' and reload the problem again to use the debugging-mechanism ***\n\n");
121  debugsoldata->warningprinted = TRUE;
122  }
123  return FALSE;
124  }
125  else
126  {
127  debugsoldata->warningprinted = FALSE;
128  return TRUE;
129  }
130 }
131 
132 /** reads solution from given file into given arrays */
133 static
134 SCIP_RETCODE readSolfile(
135  SCIP_SET* set, /**< global SCIP settings */
136  const char* solfilename, /**< solution filename to read */
137  SCIP_SOL** debugsolptr,
138  SCIP_Real* debugsolvalptr,
139  SCIP_STAGE* debugsolstageptr,
140  char*** names, /**< pointer to store the array of variable names */
141  SCIP_Real** vals, /**< pointer to store the array of solution values */
142  int* nvals, /**< pointer to store the number of non-zero elements */
143  int* valssize /**< pointer to store the length of the variable names and solution values arrays */
144  )
145 {
146  SCIP_VAR** vars;
147  SCIP_Real* solvalues;
148  SCIP_FILE* file;
149  SCIP_SOL* debugsol;
150  SCIP_Real debugsolval;
151  int nonvalues;
152  int nfound;
153  int i;
154  SCIP_Bool unknownvariablemessage;
155 
156  assert(set != NULL);
157  assert(solfilename != NULL);
158  assert(names != NULL);
159  assert(*names == NULL);
160  assert(vals != NULL);
161  assert(*vals == NULL);
162  assert(nvals != NULL);
163  assert(valssize != NULL);
164 
165  printf("***** debug: reading solution file <%s>\n", solfilename);
166 
167  /* open solution file */
168  file = SCIPfopen(solfilename, "r");
169  if( file == NULL )
170  {
171  SCIPerrorMessage("cannot open solution file <%s> specified in scip/debug.h\n", solfilename);
172  SCIPprintSysError(solfilename);
173  return SCIP_NOFILE;
174  }
175 
176  /* read data */
177  nonvalues = 0;
178  *valssize = 0;
179  unknownvariablemessage = FALSE;
180 
181  while( !SCIPfeof(file) )
182  {
183  char buf[SCIP_MAXSTRLEN];
184  char name[SCIP_MAXSTRLEN];
185  char objstring[SCIP_MAXSTRLEN];
186  char valuestring[SCIP_MAXSTRLEN];
187  SCIP_VAR* var;
188  SCIP_Real val;
189  int nread;
190 
191  if( SCIPfgets(buf, SCIP_MAXSTRLEN, file) == NULL )
192  {
193  if( SCIPfeof(file) )
194  break;
195  else
196  return SCIP_READERROR;
197  }
198 
199  /* there are some lines which may preceed the solution information */
200  if( strncasecmp(buf, "solution status:", 16) == 0 || strncasecmp(buf, "objective value:", 16) == 0 ||
201  strncasecmp(buf, "Log started", 11) == 0 || strncasecmp(buf, "Variable Name", 13) == 0 ||
202  strncasecmp(buf, "All other variables", 19) == 0 || strncasecmp(buf, "\n", 1) == 0 ||
203  strncasecmp(buf, "NAME", 4) == 0 || strncasecmp(buf, "ENDATA", 6) == 0 ) /* allow parsing of SOL-format on the MIPLIB 2003 pages */
204  {
205  ++nonvalues;
206  continue;
207  }
208 
209  /* cppcheck-suppress invalidscanf */
210  nread = sscanf(buf, "%s %s %s\n", name, valuestring, objstring);
211  if( nread < 2 )
212  {
213  printf("invalid input line %d in solution file <%s>: <%s>\n", *nvals + nonvalues, solfilename, name);
214  SCIPfclose(file);
215  return SCIP_READERROR;
216  }
217 
218  /* find the variable */
219  var = SCIPfindVar(set->scip, name);
220  if( var == NULL )
221  {
222  if( !unknownvariablemessage )
223  {
224  SCIPverbMessage(set->scip, SCIP_VERBLEVEL_NORMAL, NULL, "unknown variable <%s> in line %d of solution file <%s>\n",
225  name, *nvals + nonvalues, solfilename);
226  SCIPverbMessage(set->scip, SCIP_VERBLEVEL_NORMAL, NULL, " (further unknown variables are ignored)\n");
227  unknownvariablemessage = TRUE;
228  }
229  continue;
230  }
231 
232  /* cast the value, check first for inv(alid) or inf(inite) ones that need special treatment */
233  if( strncasecmp(valuestring, "inv", 3) == 0 )
234  continue;
235  else if( strncasecmp(valuestring, "+inf", 4) == 0 || strncasecmp(valuestring, "inf", 3) == 0 )
236  val = SCIPsetInfinity(set);
237  else if( strncasecmp(valuestring, "-inf", 4) == 0 )
238  val = -SCIPsetInfinity(set);
239  else
240  {
241  /* cppcheck-suppress invalidscanf */
242  nread = sscanf(valuestring, "%lf", &val);
243  if( nread != 1 )
244  {
245  SCIPerrorMessage("Invalid solution value <%s> for variable <%s> in line %d of solution file <%s>.\n",
246  valuestring, name, *nvals + nonvalues, solfilename);
247  SCIPfclose(file);
248  return SCIP_READERROR;
249  }
250  }
251 
252  /* allocate memory */
253  if( *nvals >= *valssize )
254  {
255  *valssize = MAX(2 * *valssize, (*nvals)+1);
256  SCIP_ALLOC( BMSreallocMemoryArray(names, *valssize) );
257  SCIP_ALLOC( BMSreallocMemoryArray(vals, *valssize) );
258  }
259  assert(*nvals < *valssize);
260 
261  /* store solution value in sorted list */
262  for( i = *nvals; i > 0 && strcmp(name, (*names)[i-1]) < 0; --i )
263  {
264  (*names)[i] = (*names)[i-1];
265  (*vals)[i] = (*vals)[i-1];
266  }
267  SCIP_ALLOC( BMSduplicateMemoryArray(&(*names)[i], name, strlen(name)+1) );
268  SCIPdebugMsg(set->scip, "found variable <%s>: value <%g>\n", (*names)[i], val);
269  (*vals)[i] = val;
270  (*nvals)++;
271  }
272 
273  /* get memory for SCIP solution */
274  SCIP_ALLOC( BMSallocMemoryArray(&vars, *valssize) );
275  SCIP_ALLOC( BMSallocMemoryArray(&solvalues, *valssize) );
276 
277  debugsolval = 0.0;
278  nfound = 0;
279 
280  /* get solution value */
281  for( i = 0; i < *nvals; ++i)
282  {
283  SCIP_VAR* var;
284  var = SCIPfindVar(set->scip, (*names)[i]);
285  if( var != NULL )
286  {
287  vars[nfound] = var;
288  solvalues[nfound] = (*vals)[i];
289  ++nfound;
290  debugsolval += (*vals)[i] * SCIPvarGetObj(var);
291  }
292  }
293  SCIPdebugMsg(set->scip, "Debug Solution value is %g.\n", debugsolval);
294 
295 #ifdef SCIP_MORE_DEBUG
296  SCIPsortPtrReal((void**)vars, solvalues, sortVarsAfterNames, nfound);
297 
298  for( i = 0; i < nfound - 1; ++i)
299  {
300  assert(strcmp(SCIPvarGetName(vars[i]), SCIPvarGetName(vars[i + 1])) != 0);
301  }
302 #endif
303 
304  if( debugsolptr != NULL )
305  {
306  /* create SCIP solution */
307  SCIP_CALL( SCIPcreateOrigSol(set->scip, &debugsol, NULL) );
308  *debugsolstageptr = SCIPgetStage(set->scip);
309 
310  /* set SCIP solution values */
311  SCIP_CALL( SCIPsetSolVals(set->scip, debugsol, nfound, vars, solvalues ) );
312  }
313 
314  BMSfreeMemoryArray(&vars);
315  BMSfreeMemoryArray(&solvalues);
316 
317  if( debugsolptr != NULL )
318  *debugsolptr = debugsol;
319 
320  if( debugsolvalptr != NULL )
321  *debugsolvalptr = debugsolval;
322 
323  /* close file */
324  SCIPfclose(file);
325 
326  printf("***** debug: read %d non-zero entries (%d variables found)\n", *nvals, nfound);
327 
328  return SCIP_OKAY;
329 }
330 
331 /** reads feasible solution to check from file */
332 static
333 SCIP_RETCODE readSolution(
334  SCIP_SET* set /**< global SCIP settings */
335  )
336 {
337  SCIP_DEBUGSOLDATA* debugsoldata;
338 
339  assert(set != NULL);
340 
341  debugsoldata = SCIPsetGetDebugSolData(set);
342 
343  /* check whether a debug solution is available */
344  if( !debugSolutionAvailable(set) )
345  return SCIP_OKAY;
346 
347  if( debugsoldata == NULL || debugsoldata->nsolvals > 0 )
348  return SCIP_OKAY;
349 
350  SCIP_CALL( readSolfile(set, set->misc_debugsol, &debugsoldata->debugsol, &debugsoldata->debugsolval,
351  &debugsoldata->debugsolstage, &(debugsoldata->solnames), &(debugsoldata->solvals), &(debugsoldata->nsolvals),
352  &(debugsoldata->solsize)) );
353 
354  return SCIP_OKAY;
355 }
356 
357 /** gets value of given variable in debugging solution */
358 static
359 SCIP_RETCODE getSolutionValue(
360  SCIP_SET* set, /**< global SCIP settings */
361  SCIP_VAR* var, /**< variable to get solution value for */
362  SCIP_Real* val /**< pointer to store solution value */
363  )
364 {
365  SCIP_VAR* solvar;
366  SCIP_DEBUGSOLDATA* debugsoldata;
367  SCIP_Real scalar;
368  SCIP_Real constant;
369  const char* name;
370  int left;
371  int right;
372  int middle;
373  int cmp;
374 
375  assert(set != NULL);
376  assert(var != NULL);
377  assert(val != NULL);
378 
379  /* check whether a debug solution is available */
380  if( !debugSolutionAvailable(set) )
381  return SCIP_OKAY;
382 
383  debugsoldata = SCIPsetGetDebugSolData(set);
384  assert(debugsoldata != NULL);
385 
386  /* allow retrieving solution values only if referring to the SCIP instance that is debugged */
387  if( !SCIPdebugSolIsEnabled(set->scip) )
388  {
389  *val = SCIP_UNKNOWN;
390  return SCIP_OKAY;
391  }
392 
393  SCIP_CALL( readSolution(set) );
394  SCIPsetDebugMsg(set, "Now handling variable <%s>, which has status %d, is of type %d, and was deleted: %d, negated: %d, transformed: %d\n",
396 
397  /* ignore deleted variables */
398  if( SCIPvarIsDeleted(var) )
399  {
400  SCIPsetDebugMsg(set, "**** unknown solution value for deleted variable <%s>\n", SCIPvarGetName(var));
401  *val = SCIP_UNKNOWN;
402  return SCIP_OKAY;
403  }
404 
405  /* retransform variable onto original variable space */
406  solvar = var;
407  scalar = 1.0;
408  constant = 0.0;
409  if( SCIPvarIsNegated(solvar) )
410  {
411  scalar = -1.0;
412  constant = SCIPvarGetNegationConstant(solvar);
413  solvar = SCIPvarGetNegationVar(solvar);
414  }
415 
416  if( SCIPvarIsTransformed(solvar) )
417  {
418  SCIP_CALL( SCIPvarGetOrigvarSum(&solvar, &scalar, &constant) );
419  if( solvar == NULL )
420  {
421  /* if no original counterpart, then maybe someone added a value for the transformed variable, so search for var (or its negation) */
422  SCIPsetDebugMsg(set, "variable <%s> has no original counterpart\n", SCIPvarGetName(var));
423  solvar = var;
424  scalar = 1.0;
425  constant = 0.0;
426  if( SCIPvarIsNegated(solvar) )
427  {
428  scalar = -1.0;
429  constant = SCIPvarGetNegationConstant(solvar);
430  solvar = SCIPvarGetNegationVar(solvar);
431  }
432  }
433  }
434 
435  /* perform a binary search for the variable */
436  name = SCIPvarGetName(solvar);
437  left = 0;
438  right = debugsoldata->nsolvals-1;
439  while( left <= right )
440  {
441  middle = (left+right)/2;
442  cmp = strcmp(name, debugsoldata->solnames[middle]);
443  if( cmp < 0 )
444  right = middle-1;
445  else if( cmp > 0 )
446  left = middle+1;
447  else
448  {
449  *val = scalar * debugsoldata->solvals[middle] + constant;
450 
451  if( SCIPsetIsFeasLT(set, *val, SCIPvarGetLbGlobal(var)) || SCIPsetIsFeasGT(set, *val, SCIPvarGetUbGlobal(var)) )
452  {
453  SCIPmessagePrintWarning(SCIPgetMessagehdlr(set->scip), "invalid solution value %.15g for variable <%s>[%.15g,%.15g]\n",
454  *val, SCIPvarGetName(var), SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var));
455  }
456 
457  return SCIP_OKAY;
458  }
459  }
460  *val = constant;
461 
462  if( SCIPsetIsFeasLT(set, *val, SCIPvarGetLbGlobal(var)) || SCIPsetIsFeasGT(set, *val, SCIPvarGetUbGlobal(var)) )
463  {
464  SCIPmessagePrintWarning(SCIPgetMessagehdlr(set->scip), "invalid solution value %.15g for variable <%s>[%.15g,%.15g]\n",
465  *val, SCIPvarGetName(var), SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var));
466  }
467 
468  return SCIP_OKAY;
469 }
470 
471 /** gets pointer to the debug solution */
472 SCIP_RETCODE SCIPdebugGetSol(
473  SCIP* scip, /**< SCIP data structure */
474  SCIP_SOL** sol /**< buffer to store pointer to the debug solution */
475  )
476 {
477  SCIP_DEBUGSOLDATA* debugsoldata;
478 
479  debugsoldata = SCIPsetGetDebugSolData(scip->set);
480  assert(scip != NULL);
481  assert(sol != NULL);
482 
483  *sol = NULL;
484 
485  /* check whether a debug solution is available */
486  if( !debugSolutionAvailable(scip->set) )
487  return SCIP_OKAY;
488 
489  SCIP_CALL( readSolution(scip->set) );
490 
491  if( debugsoldata->debugsol == NULL )
492  return SCIP_ERROR;
493 
494  *sol = debugsoldata->debugsol;
495 
496  return SCIP_OKAY;
497 }
498 
499 /** gets value for a variable in the debug solution
500  *
501  * if no value is stored for the variable, gives 0.0
502  */
504  SCIP* scip, /**< SCIP data structure */
505  SCIP_VAR* var, /**< variable for which to get the value */
506  SCIP_Real* val /**< buffer to store solution value */
507  )
508 {
509  SCIP_CALL( getSolutionValue(scip->set, var, val) );
510 
511  return SCIP_OKAY;
512 }
513 
514 /** returns whether the debug solution is worse than the best known solution or if the debug solution was found */
515 static
516 SCIP_Bool debugSolIsAchieved(
517  SCIP_SET* set /**< global SCIP settings */
518  )
519 {
520  SCIP_SOL* bestsol;
521  SCIP* scip;
522  SCIP_DEBUGSOLDATA* debugsoldata;
523 
524  /* check whether a debug solution is available */
525  if( !debugSolutionAvailable(set) )
526  return SCIP_OKAY;
527 
528  assert(set != NULL);
529  debugsoldata = SCIPsetGetDebugSolData(set);
530 
531  assert(debugsoldata != NULL);
532 
533  if( debugsoldata->solisachieved )
534  return TRUE;
535 
536  assert(set != NULL);
537 
538  scip = set->scip;
539  assert(scip != NULL);
540 
541  bestsol = SCIPgetBestSol(scip);
542 
543  if( bestsol != NULL )
544  {
545  SCIP_Real solvalue;
546 
547  /* don't check solution while in problem creation stage */
548  if( SCIPsetGetStage(set) == SCIP_STAGE_PROBLEM )
549  return TRUE;
550 
551  solvalue = SCIPgetSolOrigObj(scip, bestsol);
552 
553  /* make sure a debug solution has been read, so we do not compare against the initial debugsolval == 0 */
554  SCIP_CALL( readSolution(set) );
555 
556  if( (SCIPgetObjsense(scip) == SCIP_OBJSENSE_MINIMIZE && SCIPsetIsLE(set, solvalue, debugsoldata->debugsolval))
557  || (SCIPgetObjsense(scip) == SCIP_OBJSENSE_MAXIMIZE && SCIPsetIsGE(set, solvalue, debugsoldata->debugsolval)) )
558  debugsoldata->solisachieved = TRUE;
559  }
560 
561  return debugsoldata->solisachieved;
562 }
563 
564 /** returns whether the solution is contained in node's subproblem */
565 static
566 SCIP_RETCODE isSolutionInNode(
567  BMS_BLKMEM* blkmem, /**< block memory */
568  SCIP_SET* set, /**< global SCIP settings */
569  SCIP_NODE* node, /**< local node where this bound change was applied */
570  SCIP_Bool* solcontained /**< pointer to store whether the solution is contained in node's subproblem */
571  )
572 {
573  SCIP_Bool* boolptr;
574  SCIP_DEBUGSOLDATA* debugsoldata;
575 
576  assert(set != NULL);
577  assert(blkmem != NULL);
578  assert(node != NULL);
579  assert(solcontained != NULL);
580 
581  /* check whether a debug solution is available */
582  if( !debugSolutionAvailable(set) )
583  return SCIP_OKAY;
584 
585  debugsoldata = SCIPsetGetDebugSolData(set);
586  assert(debugsoldata != NULL);
587 
588  if( debugsoldata ->debugsoldisabled )
589  {
590  *solcontained = FALSE;
591  return SCIP_OKAY;
592  }
593 
594  /* generate the hashmap */
595  if( debugsoldata->solinnode == NULL )
596  {
597  SCIP_CALL( SCIPhashmapCreate(&debugsoldata->solinnode, blkmem, SCIP_HASHSIZE_DEBUG) );
598  }
599 
600  /* check, whether we know already whether the solution is contained in the given node */
601  boolptr = (SCIP_Bool*)SCIPhashmapGetImage(debugsoldata->solinnode, (void*)node);
602  if( boolptr != NULL )
603  {
604  if( boolptr != &debugsoldata->falseptr && boolptr != &debugsoldata->trueptr )
605  {
606  SCIPerrorMessage("wrong value in node hashmap\n");
607  SCIPABORT();
608  return SCIP_ERROR;
609  }
610  *solcontained = *boolptr;
611  return SCIP_OKAY;
612  }
613 
614  /* if the solution is not contained in the parent of the node, it cannot be contained in the current node */
615  *solcontained = TRUE;
616  if( node->parent != NULL )
617  {
618  SCIP_CALL( isSolutionInNode(blkmem, set, node->parent, solcontained) );
619  }
620 
621  if( *solcontained )
622  {
623  /* check whether the bound changes at the current node remove the debugging solution from the subproblem */
624  if( node->domchg != NULL )
625  {
626  SCIP_DOMCHGBOUND* domchgbound;
627  SCIP_BOUNDCHG* boundchgs;
628  int i;
629 
630  domchgbound = &node->domchg->domchgbound;
631  boundchgs = domchgbound->boundchgs;
632  for( i = 0; i < (int)domchgbound->nboundchgs && *solcontained; ++i )
633  {
634  SCIP_Real varsol;
635 
636  /* get solution value of variable */
637  SCIP_CALL( getSolutionValue(set, boundchgs[i].var, &varsol) );
638 
639  if( varsol != SCIP_UNKNOWN ) /*lint !e777*/
640  {
641  /* compare the bound change with the solution value */
642  if( SCIPboundchgGetBoundtype(&boundchgs[i]) == SCIP_BOUNDTYPE_LOWER )
643  *solcontained = SCIPsetIsFeasGE(set, varsol, boundchgs[i].newbound);
644  else
645  *solcontained = SCIPsetIsFeasLE(set, varsol, boundchgs[i].newbound);
646 
647  if( !(*solcontained) && SCIPboundchgGetBoundchgtype(&boundchgs[i]) != SCIP_BOUNDCHGTYPE_BRANCHING )
648  {
649  SCIPerrorMessage("debugging solution was cut off in local node %p at depth %d by inference <%s>[%.15g] %s %.15g\n",
650  (void*) node, SCIPnodeGetDepth(node), SCIPvarGetName(boundchgs[i].var), varsol,
651  SCIPboundchgGetBoundtype(&boundchgs[i]) == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", boundchgs[i].newbound);
652  SCIPABORT();
653  }
654  }
655  else if( SCIPboundchgGetBoundchgtype(&boundchgs[i]) == SCIP_BOUNDCHGTYPE_BRANCHING )
656  {
657  /* we branched on a variable were we don't know the solution: no debugging can be applied in this subtree */
658  *solcontained = FALSE;
659  }
660  }
661  }
662  }
663 
664  /* remember the status of the current node */
665  SCIP_CALL( SCIPhashmapSetImage(debugsoldata->solinnode, (void*)node, *solcontained ? (void*)(&debugsoldata->trueptr) : (void*)(&debugsoldata->falseptr)) );
666 
667  return SCIP_OKAY;
668 }
669 
670 /** frees the debug solution */
672  SCIP_SET* set
673  )
674 {
675  SCIP_DEBUGSOLDATA* debugsoldata;
676 
677  debugsoldata = SCIPsetGetDebugSolData(set);
678  assert(debugsoldata != NULL);
679 
680  if( debugsoldata->debugsol != NULL && ((SCIPgetStage(set->scip) > SCIP_STAGE_PROBLEM && debugsoldata->debugsolstage > SCIP_STAGE_PROBLEM)
681  || (SCIPgetStage(set->scip) <= SCIP_STAGE_PROBLEM && debugsoldata->debugsolstage <= SCIP_STAGE_PROBLEM)) )
682  {
683  SCIP_CALL( SCIPfreeSol(set->scip, &debugsoldata->debugsol) );
684  }
685 
686  return SCIP_OKAY;
687 }
688 
689 /** resets the data structure after restart */
691  SCIP_SET* set
692  )
693 {
694  SCIP_DEBUGSOLDATA* debugsoldata;
695 
696  assert(set != NULL);
697 
698  debugsoldata = SCIPsetGetDebugSolData(set);
699  assert(debugsoldata != NULL);
700 
701  if( debugsoldata->solinnode != NULL )
702  {
703  SCIP_CALL( SCIPhashmapRemoveAll(debugsoldata->solinnode) );
704  }
705 
706  return SCIP_OKAY;
707 }
708 
709 /** frees debugging data for the particular instance */
711  SCIP_SET* set /**< global SCIP settings */
712  )
713 {
714  int s;
715 
716  SCIP_DEBUGSOLDATA* debugsoldata;
717  assert(set != NULL);
718 
719  debugsoldata = SCIPsetGetDebugSolData(set);
720  assert(debugsoldata != NULL);
721 
722  for( s = debugsoldata->nsolvals - 1; s >= 0; --s )
723  BMSfreeMemoryArrayNull(&(debugsoldata->solnames[s]));
724 
725  BMSfreeMemoryArrayNull(&debugsoldata->solnames);
726  BMSfreeMemoryArrayNull(&debugsoldata->solvals);
727 
728  debugsoldata->nsolvals = 0;
729  debugsoldata->debugsolval= 0.0;
730  debugsoldata->solisachieved = FALSE;
731 
732  if( debugsoldata->solinnode != NULL)
733  SCIPhashmapFree(&debugsoldata->solinnode);
734 
735  /* free the debug solution */
736  SCIP_CALL( SCIPdebugFreeSol(set) );
737 
738  return SCIP_OKAY;
739 }
740 
741 /** frees all debugging data */
743  SCIP_SET* set /**< global SCIP settings */
744  )
745 {
746  SCIP_DEBUGSOLDATA* debugsoldata;
747 
748  assert(set != NULL);
749 
750  debugsoldata = SCIPsetGetDebugSolData(set);
751  assert(debugsoldata != NULL);
752 
754  BMSfreeMemoryNull(&debugsoldata);
755 
756  set->debugsoldata = NULL;
757 
758  return SCIP_OKAY;
759 }
760 
761 /** checks for validity of the debugging solution in given constraints */
763  SCIP* scip, /**< SCIP data structure */
764  SCIP_CONS** conss, /**< constraints to check for validity */
765  int nconss /**< number of given constraints */
766  )
767 {
768  SCIP_RESULT result;
769  int c;
770 
771  SCIP_DEBUGSOLDATA* debugsoldata;
772  assert(scip->set != NULL);
773 
774  /* check if we are in the original problem and not in a sub MIP */
775  if( !SCIPdebugSolIsEnabled(scip) )
776  return SCIP_OKAY;
777 
778  /* check whether a debug solution is available */
779  if( !debugSolutionAvailable(scip->set) )
780  return SCIP_OKAY;
781 
782  debugsoldata = SCIPsetGetDebugSolData(scip->set);
783 
784  assert(conss != NULL || nconss == 0);
785  assert(debugsoldata->debugsol != NULL);
786 
787  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug
788  * solution
789  */
790  if( debugSolIsAchieved(scip->set) )
791  return SCIP_OKAY;
792 
793  result = SCIP_FEASIBLE;
794 
795  /* checking each given constraint against the debugging solution */
796  for( c = nconss - 1; c >= 0; --c )
797  {
798  assert(conss[c] != NULL);
799 
800  if( !SCIPconsIsActive(conss[c]) )
801  continue;
802 
803  assert(SCIPconsGetActiveDepth(conss[c]) <= SCIPgetDepth(scip));
804 
805  /* if the cons is only locally valid, check whether the debugging solution is contained in the local subproblem */
806  if( SCIPconsIsLocal(conss[c]) )
807  {
808  SCIP_Bool solcontained;
809 
810  SCIP_CALL( isSolutionInNode(SCIPblkmem(scip), scip->set, SCIPgetCurrentNode(scip), &solcontained) );
811  if( !solcontained )
812  return SCIP_OKAY;
813  }
814 
815  SCIP_CALL( SCIPcheckCons(scip, conss[c], debugsoldata->debugsol, TRUE, TRUE, TRUE, &result) );
816 
817  SCIPdebugMsg(scip, " -> checking of constraint %s returned result <%d>\n", SCIPconsGetName(conss[c]), result);
818 
819  if( result != SCIP_FEASIBLE )
820  {
821  SCIPerrorMessage("constraint %s violates the debugging solution\n", SCIPconsGetName(conss[c]));
822  SCIPABORT();
823  }
824  }
825 
826  return SCIP_OKAY;
827 }
828 
829 /** checks whether given row is valid for the debugging solution */
831  SCIP_SET* set, /**< global SCIP settings */
832  SCIP_ROW* row /**< row to check for validity */
833  )
834 {
835  SCIP_COL** cols;
836  SCIP_Real* vals;
837  SCIP_Real lhs;
838  SCIP_Real rhs;
839  int nnonz;
840  int i;
841  SCIP_Real minactivity;
842  SCIP_Real maxactivity;
843  SCIP_Real solval;
844 
845  assert(set != NULL);
846  assert(row != NULL);
847 
848  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
849  if( !SCIPdebugSolIsEnabled(set->scip) )
850  return SCIP_OKAY;
851 
852  /* check whether a debug solution is available */
853  if( !debugSolutionAvailable(set) )
854  return SCIP_OKAY;
855 
856  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
857  if( debugSolIsAchieved(set) )
858  return SCIP_OKAY;
859 
860  /* if the row is only locally valid, check whether the debugging solution is contained in the local subproblem */
861  if( SCIProwIsLocal(row) )
862  {
863  SCIP_Bool solcontained;
864 
865  SCIP_CALL( isSolutionInNode(SCIPblkmem(set->scip), set, SCIPgetCurrentNode(set->scip), &solcontained) );
866  if( !solcontained )
867  return SCIP_OKAY;
868  }
869 
870  cols = SCIProwGetCols(row);
871  vals = SCIProwGetVals(row);
872  nnonz = SCIProwGetNNonz(row);
873  lhs = SCIProwGetLhs(row);
874  rhs = SCIProwGetRhs(row);
875 
876  /* calculate row's activity on debugging solution */
877  minactivity = SCIProwGetConstant(row);
878  maxactivity = minactivity;
879  for( i = 0; i < nnonz; ++i )
880  {
881  SCIP_VAR* var;
882 
883  /* get solution value of variable in debugging solution */
884  var = SCIPcolGetVar(cols[i]);
885  SCIP_CALL( getSolutionValue(set, var, &solval) );
886 
887  if( solval != SCIP_UNKNOWN ) /*lint !e777*/
888  {
889  minactivity += vals[i] * solval;
890  maxactivity += vals[i] * solval;
891  }
892  else if( vals[i] > 0.0 )
893  {
894  minactivity += vals[i] * SCIPvarGetLbGlobal(var);
895  maxactivity += vals[i] * SCIPvarGetUbGlobal(var);
896  }
897  else if( vals[i] < 0.0 )
898  {
899  minactivity += vals[i] * SCIPvarGetUbGlobal(var);
900  maxactivity += vals[i] * SCIPvarGetLbGlobal(var);
901  }
902  }
903  SCIPsetDebugMsg(set, "debugging solution on row <%s>: %g <= [%g,%g] <= %g\n",
904  SCIProwGetName(row), lhs, minactivity, maxactivity, rhs);
905 
906  /* check row for violation, using absolute LP feasibility tolerance (as LP solver should do) */
907  if( maxactivity + SCIPgetLPFeastol(set->scip) < lhs || minactivity - SCIPgetLPFeastol(set->scip) > rhs )
908  {
909  printf("***** debug: row <%s> violates debugging solution (lhs=%.15g, rhs=%.15g, activity=[%.15g,%.15g], local=%u, lpfeastol=%g)\n",
910  SCIProwGetName(row), lhs, rhs, minactivity, maxactivity, SCIProwIsLocal(row), SCIPgetLPFeastol(set->scip));
911  SCIProwPrint(row, SCIPgetMessagehdlr(set->scip), NULL);
912 
913  /* output row with solution values */
914  printf("\n\n");
915  printf("***** debug: violated row <%s>:\n", SCIProwGetName(row));
916  printf(" %.15g <= %.15g", lhs, SCIProwGetConstant(row));
917  for( i = 0; i < nnonz; ++i )
918  {
919  /* get solution value of variable in debugging solution */
920  SCIP_CALL( getSolutionValue(set, SCIPcolGetVar(cols[i]), &solval) );
921  printf(" %+.15g<%s>[%.15g]", vals[i], SCIPvarGetName(SCIPcolGetVar(cols[i])), solval);
922  }
923  printf(" <= %.15g\n", rhs);
924 
925  SCIPABORT();
926  }
927 
928  return SCIP_OKAY;
929 }
930 
931 /** checks whether given global lower bound is valid for the debugging solution */
933  SCIP* scip, /**< SCIP data structure */
934  SCIP_VAR* var, /**< problem variable */
935  SCIP_Real lb /**< lower bound */
936  )
937 {
938  SCIP_Real varsol;
939 
940  assert(scip != NULL);
941  assert(var != NULL);
942 
943  /* check if we are in the original problem and not in a sub MIP */
944  if( !SCIPdebugSolIsEnabled(scip) )
945  return SCIP_OKAY;
946 
947  /* check whether a debug solution is available */
948  if( !debugSolutionAvailable(scip->set) )
949  return SCIP_OKAY;
950 
951  if( SCIPgetStage(scip) == SCIP_STAGE_PROBLEM )
952  return SCIP_OKAY;
953 
954  /* skip unused relaxation-only variables
955  * Relaxation-only variables are not part of any constraints or the original problem and thus there is no need to check their solution value.
956  * However, for relaxation-only variables that are still in use for the current solve round and for which a debug solution value has been set,
957  * checking against the debug solution value is helpful. If they not in use anymore, they will be captured only by the transformed problem
958  * and they may get fixed to some arbitrary value, e.g., in dual fixing.
959  * Thus, we skip checking bound changes on unused relaxation-only variables.
960  */
961  if( SCIPvarIsRelaxationOnly(var) && SCIPvarGetNUses(var) == 1 )
962  return SCIP_OKAY;
963 
964  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
965  if( debugSolIsAchieved(scip->set) )
966  return SCIP_OKAY;
967 
968  /* get solution value of variable */
969  SCIP_CALL( getSolutionValue(scip->set, var, &varsol) );
970  SCIPdebugMsg(scip, "debugging solution on lower bound of <%s>[%g] >= %g\n", SCIPvarGetName(var), varsol, lb);
971 
972  /* check validity of debugging solution */
973  if( varsol != SCIP_UNKNOWN && SCIPisFeasLT(scip, varsol, lb) ) /*lint !e777*/
974  {
975  SCIPerrorMessage("invalid global lower bound: <%s>[%.15g] >= %.15g\n", SCIPvarGetName(var), varsol, lb);
976  SCIPABORT();
977  }
978 
979  return SCIP_OKAY;
980 }
981 
982 /** checks whether given global upper bound is valid for the debugging solution */
984  SCIP* scip, /**< SCIP data structure */
985  SCIP_VAR* var, /**< problem variable */
986  SCIP_Real ub /**< upper bound */
987  )
988 {
989  SCIP_Real varsol;
990 
991  assert(scip != NULL);
992  assert(var != NULL);
993 
994  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
995  if( !SCIPdebugSolIsEnabled(scip) )
996  return SCIP_OKAY;
997 
998  /* check whether a debug solution is available */
999  if( !debugSolutionAvailable(scip->set) )
1000  return SCIP_OKAY;
1001 
1002  if( SCIPgetStage(scip) == SCIP_STAGE_PROBLEM )
1003  return SCIP_OKAY;
1004 
1005  /* skip unused relaxation-only variables, see also comment in SCIPdebugCheckLbGlobal() */
1006  if( SCIPvarIsRelaxationOnly(var) && SCIPvarGetNUses(var) == 1 )
1007  return SCIP_OKAY;
1008 
1009  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1010  if( debugSolIsAchieved(scip->set) )
1011  return SCIP_OKAY;
1012 
1013  /* get solution value of variable */
1014  SCIP_CALL( getSolutionValue(scip->set, var, &varsol) );
1015  SCIPdebugMsg(scip, "debugging solution on upper bound of <%s>[%g] <= %g\n", SCIPvarGetName(var), varsol, ub);
1016 
1017  /* check validity of debugging solution */
1018  if( varsol != SCIP_UNKNOWN && SCIPisFeasGT(scip, varsol, ub) ) /*lint !e777*/
1019  {
1020  SCIPerrorMessage("invalid global upper bound: <%s>[%.15g] <= %.15g\n", SCIPvarGetName(var), varsol, ub);
1021  SCIPABORT();
1022  }
1023 
1024  return SCIP_OKAY;
1025 }
1026 
1027 /** checks whether given local bound implication is valid for the debugging solution */
1029  BMS_BLKMEM* blkmem, /**< block memory */
1030  SCIP_SET* set, /**< global SCIP settings */
1031  SCIP_NODE* node, /**< local node where this bound change was applied */
1032  SCIP_VAR* var, /**< problem variable */
1033  SCIP_Real newbound, /**< new value for bound */
1034  SCIP_BOUNDTYPE boundtype /**< type of bound: lower or upper bound */
1035  )
1036 {
1037  SCIP_Real varsol;
1038  SCIP_Bool solcontained;
1039 
1040  assert(set != NULL);
1041  assert(blkmem != NULL);
1042  assert(node != NULL);
1043  assert(var != NULL);
1044 
1045  /* in case we are in probing or diving we have to avoid checking the solution */
1046  if( SCIPlpDiving(set->scip->lp) || SCIPtreeProbing(set->scip->tree) )
1047  return SCIP_OKAY;
1048 
1049  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1050  if( !SCIPdebugSolIsEnabled(set->scip) )
1051  return SCIP_OKAY;
1052 
1053  /* check whether a debug solution is available */
1054  if( !debugSolutionAvailable(set) )
1055  return SCIP_OKAY;
1056 
1057  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1058  if( debugSolIsAchieved(set) )
1059  return SCIP_OKAY;
1060 
1061  /* check whether the debugging solution is contained in the local subproblem */
1062  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
1063  if( !solcontained )
1064  return SCIP_OKAY;
1065 
1066  /* get solution value of variable */
1067  SCIP_CALL( getSolutionValue(set, var, &varsol) );
1068 
1069  /* check validity of debugging solution */
1070  if( varsol != SCIP_UNKNOWN ) /*lint !e777*/
1071  {
1072  if( boundtype == SCIP_BOUNDTYPE_LOWER && SCIPsetIsFeasLT(set, varsol, newbound) )
1073  {
1074  SCIPerrorMessage("invalid local lower bound implication: <%s>[%.15g] >= %.15g\n", SCIPvarGetName(var), varsol, newbound);
1075  SCIPABORT();
1076  }
1077  if( boundtype == SCIP_BOUNDTYPE_UPPER && SCIPsetIsFeasGT(set, varsol, newbound) )
1078  {
1079  SCIPerrorMessage("invalid local upper bound implication: <%s>[%.15g] <= %.15g\n", SCIPvarGetName(var), varsol, newbound);
1080  SCIPABORT();
1081  }
1082  }
1083 
1084  return SCIP_OKAY;
1085 }
1086 
1087 /** informs solution debugger, that the given node will be freed */
1089  BMS_BLKMEM* blkmem, /**< block memory */
1090  SCIP_SET* set, /**< global SCIP settings */
1091  SCIP_NODE* node /**< node that will be freed */
1092  )
1093 {
1094  SCIP_DEBUGSOLDATA* debugsoldata;
1095 
1096  assert(set != NULL);
1097  assert(blkmem != NULL);
1098  assert(node != NULL);
1099 
1100  debugsoldata = SCIPsetGetDebugSolData(set);
1101  assert(debugsoldata != NULL);
1102 
1103  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1104  if( !SCIPdebugSolIsEnabled(set->scip) )
1105  return SCIP_OKAY;
1106 
1107  /* check whether a debug solution is available */
1108  if( !debugSolutionAvailable(set) )
1109  return SCIP_OKAY;
1110 
1111  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1112  if( debugSolIsAchieved(set) )
1113  return SCIP_OKAY;
1114 
1115  /* check if a solution will be cutoff in tree */
1118  {
1119  SCIP_Bool solisinnode;
1120 
1121  solisinnode = FALSE;
1122 
1123  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solisinnode) );
1124  /* wrong node will be cutoff */
1125  if( solisinnode )
1126  {
1127  SCIPerrorMessage("debugging solution was cut off in local node #%" SCIP_LONGINT_FORMAT " (%p) at depth %d\n",
1128  node->number, (void*) node, SCIPnodeGetDepth(node));
1129  SCIPABORT();
1130  }
1131  }
1132 
1133  /* remove node from the hash map */
1134  if( debugsoldata->solinnode != NULL )
1135  {
1136  SCIP_CALL( SCIPhashmapRemove(debugsoldata->solinnode, (void*)node) );
1137  }
1138 
1139  return SCIP_OKAY;
1140 }
1141 
1142 /** checks whether global lower bound does not exceed debuging solution value */
1144  BMS_BLKMEM* blkmem, /**< block memory */
1145  SCIP_SET* set /**< global SCIP settings */
1146  )
1147 {
1148  SCIP_DEBUGSOLDATA* debugsoldata;
1149  SCIP_Real treelowerbound;
1150 
1151  assert(set != NULL);
1152  assert(blkmem != NULL);
1153 
1154  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1155  if( !SCIPdebugSolIsEnabled(set->scip) )
1156  return SCIP_OKAY;
1157 
1158  /* check whether a debug solution is available */
1159  if( !debugSolutionAvailable(set) )
1160  return SCIP_OKAY;
1161 
1163  return SCIP_OKAY;
1164 
1166  return SCIP_OKAY;
1167 
1168  /* if there are no leaves then SCIPtreeGetLowerbound() will return infintiy */
1169  if( SCIPgetNLeaves(set->scip) <= 0 )
1170  return SCIP_OKAY;
1171 
1172  debugsoldata = SCIPsetGetDebugSolData(set);
1173  assert(debugsoldata != NULL);
1174 
1175  /* make sure a debug solution has been read */
1176  if( debugsoldata->debugsol == NULL )
1177  {
1178  SCIP_CALL( readSolution(set) );
1179  }
1180 
1181  /* get global lower bound of tree (do not use SCIPgetLowerbound() since this adjusts the value using the primal bound) */
1182  treelowerbound = SCIPtreeGetLowerbound(set->scip->tree, set);
1183  treelowerbound = SCIPprobExternObjval(set->scip->transprob, set->scip->origprob, set, treelowerbound);
1184 
1185  if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MINIMIZE && SCIPsetIsGT(set, treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
1186  {
1187  SCIPerrorMessage("global lower bound %g is larger than the value of the debugging solution %g.\n", treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol));
1188  SCIPABORT();
1189  }
1190  else if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MAXIMIZE && SCIPsetIsLT(set, treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
1191  {
1192  SCIPerrorMessage("global upper bound %g is smaller than the value of the debugging solution %g.\n", treelowerbound, SCIPsolGetOrigObj(debugsoldata->debugsol));
1193  SCIPABORT();
1194  }
1195 
1196  return SCIP_OKAY;
1197 }
1198 
1199 /** checks whether local lower bound does not exceed debuging solution value */
1201  BMS_BLKMEM* blkmem, /**< block memory */
1202  SCIP_SET* set, /**< global SCIP settings */
1203  SCIP_NODE* node /**< node that will be freed */
1204  )
1205 {
1206  SCIP_DEBUGSOLDATA* debugsoldata;
1207  SCIP_Bool solisinnode;
1208 
1209  assert(set != NULL);
1210  assert(blkmem != NULL);
1211 
1212  /* exit if we do not have a node to check */
1213  if( node == NULL )
1214  return SCIP_OKAY;
1215 
1216  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1217  if( !SCIPdebugSolIsEnabled(set->scip) )
1218  return SCIP_OKAY;
1219 
1220  /* check whether a debug solution is available */
1221  if( !debugSolutionAvailable(set) )
1222  return SCIP_OKAY;
1223 
1224  if( SCIPgetStage(set->scip) <= SCIP_STAGE_INITSOLVE )
1225  return SCIP_OKAY;
1226 
1228  return SCIP_OKAY;
1229 
1230  debugsoldata = SCIPsetGetDebugSolData(set);
1231  assert(debugsoldata != NULL);
1232 
1233  /* make sure a debug solution has been read */
1234  if( debugsoldata->debugsol == NULL )
1235  {
1236  SCIP_CALL( readSolution(set) );
1237  }
1238 
1239  /* check local lower bound */
1240  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solisinnode) );
1241 
1242  /* if we are in a node that contains the given debug solution, the lower bound should not exceed the solution's objective */
1243  if( solisinnode )
1244  {
1245  SCIP_Real localbound;
1246 
1247  localbound = SCIPnodeGetLowerbound(node);
1248  localbound = SCIPprobExternObjval(set->scip->transprob, set->scip->origprob, set, localbound);
1249 
1250  if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MINIMIZE && SCIPsetIsGT(set, localbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
1251  {
1252  SCIPerrorMessage("local lower bound %g of node #%" SCIP_LONGINT_FORMAT " at depth %d is larger than the value of the debugging solution %g contained in this node.\n",
1253  localbound, node->number, SCIPnodeGetDepth(node), SCIPsolGetOrigObj(debugsoldata->debugsol));
1254  SCIPABORT();
1255  }
1256  else if( SCIPgetObjsense(set->scip) == SCIP_OBJSENSE_MAXIMIZE && SCIPsetIsLT(set, localbound, SCIPsolGetOrigObj(debugsoldata->debugsol)) )
1257  {
1258  SCIPerrorMessage("local upper bound %g of node #%" SCIP_LONGINT_FORMAT " at depth %d is smaller than the value of the debugging solution %g contained in this node.\n",
1259  localbound, node->number, SCIPnodeGetDepth(node), SCIPsolGetOrigObj(debugsoldata->debugsol));
1260  SCIPABORT();
1261  }
1262  }
1263 
1264  return SCIP_OKAY;
1265 }
1266 
1267 /** checks whether given variable bound is valid for the debugging solution */
1269  SCIP_SET* set, /**< global SCIP settings */
1270  SCIP_VAR* var, /**< problem variable x in x <= b*z + d or x >= b*z + d */
1271  SCIP_BOUNDTYPE vbtype, /**< type of variable bound (LOWER or UPPER) */
1272  SCIP_VAR* vbvar, /**< variable z in x <= b*z + d or x >= b*z + d */
1273  SCIP_Real vbcoef, /**< coefficient b in x <= b*z + d or x >= b*z + d */
1274  SCIP_Real vbconstant /**< constant d in x <= b*z + d or x >= b*z + d */
1275  )
1276 {
1277  SCIP_Real varsol;
1278  SCIP_Real vbvarsol;
1279  SCIP_Real vb;
1280 
1281  assert(set != NULL);
1282  assert(var != NULL);
1283 
1284  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1285  if( !SCIPdebugSolIsEnabled(set->scip) )
1286  return SCIP_OKAY;
1287 
1288  /* check whether a debug solution is available */
1289  if( !debugSolutionAvailable(set) )
1290  return SCIP_OKAY;
1291 
1292  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1293  if( debugSolIsAchieved(set) )
1294  return SCIP_OKAY;
1295 
1296  /* get solution value of variables */
1297  SCIP_CALL( getSolutionValue(set, var, &varsol) );
1298  SCIP_CALL( getSolutionValue(set, vbvar, &vbvarsol) );
1299 
1300  /* check validity of debugging solution */
1301  if( varsol != SCIP_UNKNOWN && vbvarsol != SCIP_UNKNOWN ) /*lint !e777*/
1302  {
1303  vb = vbcoef * vbvarsol + vbconstant;
1304  if( (vbtype == SCIP_BOUNDTYPE_LOWER && SCIPsetIsFeasLT(set, varsol, vb))
1305  || (vbtype == SCIP_BOUNDTYPE_UPPER && SCIPsetIsFeasGT(set, varsol, vb)) )
1306  {
1307  SCIPerrorMessage("invalid variable bound: <%s>[%.15g] %s %.15g<%s>[%.15g] %+.15g\n",
1308  SCIPvarGetName(var), varsol, vbtype == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", vbcoef,
1309  SCIPvarGetName(vbvar), vbvarsol, vbconstant);
1310  SCIPABORT();
1311  }
1312  }
1313 
1314  return SCIP_OKAY;
1315 }
1316 
1317 /** checks whether given implication is valid for the debugging solution */
1319  SCIP_SET* set, /**< global SCIP settings */
1320  SCIP_VAR* var, /**< problem variable */
1321  SCIP_Bool varfixing, /**< FALSE if y should be added in implications for x == 0, TRUE for x == 1 */
1322  SCIP_VAR* implvar, /**< variable y in implication y <= b or y >= b */
1323  SCIP_BOUNDTYPE impltype, /**< type of implication y <= b (SCIP_BOUNDTYPE_UPPER) or y >= b (SCIP_BOUNDTYPE_LOWER) */
1324  SCIP_Real implbound /**< bound b in implication y <= b or y >= b */
1325  )
1326 {
1327  SCIP_Real solval;
1328 
1329  assert(set != NULL);
1330  assert(var != NULL);
1331  assert(SCIPvarGetType(var) == SCIP_VARTYPE_BINARY);
1332 
1333  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1334  if( !SCIPdebugSolIsEnabled(set->scip) )
1335  return SCIP_OKAY;
1336 
1337  /* check whether a debug solution is available */
1338  if( !debugSolutionAvailable(set) )
1339  return SCIP_OKAY;
1340 
1341  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1342  if( debugSolIsAchieved(set) )
1343  return SCIP_OKAY;
1344 
1345  /* get solution value of variable */
1346  SCIP_CALL( getSolutionValue(set, var, &solval) );
1347  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1348  return SCIP_OKAY;
1349  assert(SCIPsetIsFeasZero(set, solval) || SCIPsetIsFeasEQ(set, solval, 1.0));
1350 
1351  /* check, whether the implication applies for the debugging solution */
1352  if( (solval > 0.5) != varfixing )
1353  return SCIP_OKAY;
1354 
1355  /* get solution value of implied variable */
1356  SCIP_CALL( getSolutionValue(set, implvar, &solval) );
1357  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1358  return SCIP_OKAY;
1359 
1360  if( impltype == SCIP_BOUNDTYPE_LOWER )
1361  {
1362  if( SCIPsetIsFeasLT(set, solval, implbound) )
1363  {
1364  SCIPerrorMessage("invalid implication <%s> == %d -> <%s> >= %.15g (variable has value %.15g in solution)\n",
1365  SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
1366  SCIPABORT();
1367  }
1368  }
1369  else
1370  {
1371  if( SCIPsetIsFeasGT(set, solval, implbound) )
1372  {
1373  SCIPerrorMessage("invalid implication <%s> == %d -> <%s> <= %.15g (variable has value %.15g in solution)\n",
1374  SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
1375  SCIPABORT();
1376  }
1377  }
1378 
1379  return SCIP_OKAY;
1380 }
1381 
1382 /** checks whether given (multi)-aggregation is valid for the debugging solution */
1384  SCIP_SET* set, /**< global SCIP settings */
1385  SCIP_VAR* var, /**< problem variable */
1386  SCIP_VAR** aggrvars, /**< variables y_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
1387  SCIP_Real* scalars, /**< multipliers a_i in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
1388  SCIP_Real constant, /**< constant shift c in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
1389  int naggrvars /**< number n of variables in aggregation x = a_1*y_1 + ... + a_n*y_n + c */
1390  )
1391 {
1392  SCIP_Real solval;
1393  SCIP_Real val;
1394  int i;
1395 
1396  assert(set != NULL);
1397  assert(var != NULL);
1398  assert(aggrvars != NULL);
1399  assert(scalars != NULL);
1400  assert(naggrvars >= 1);
1401 
1402  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1403  if( !SCIPdebugSolIsEnabled(set->scip) )
1404  return SCIP_OKAY;
1405 
1406  /* check whether a debug solution is available */
1407  if( !debugSolutionAvailable(set) )
1408  return SCIP_OKAY;
1409 
1410  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1411  if( debugSolIsAchieved(set) )
1412  return SCIP_OKAY;
1413 
1414  /* get solution value of x variable */
1415  SCIP_CALL( getSolutionValue(set, var, &solval) );
1416 
1417  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1418  return SCIP_OKAY;
1419 
1420  val = constant;
1421 
1422  for( i = 0; i < naggrvars; i++ )
1423  {
1424  SCIP_Real aggrsolval;
1425 
1426  /* get solution value of y variable */
1427  SCIP_CALL( getSolutionValue(set, aggrvars[i], &aggrsolval) );
1428 
1429  if( aggrsolval == SCIP_UNKNOWN ) /*lint !e777*/
1430  return SCIP_OKAY;
1431 
1432  val += scalars[i] * aggrsolval;
1433  }
1434 
1435  /* print debug message if the aggregation violates the debugging solution */
1436  if( !SCIPsetIsRelEQ(set, solval, val) )
1437  {
1438  if( naggrvars == 1 )
1439  {
1440  SCIP_Real aggrsolval;
1441 
1442  /* get solution value of y variable */
1443  SCIP_CALL( getSolutionValue(set, aggrvars[0], &aggrsolval) );
1444 
1445  SCIPerrorMessage("aggregation <%s>[%g] = %g<%s>[%g] + %g violates debugging solution (expected %g)\n",
1446  SCIPvarGetName(var), solval, scalars[0], SCIPvarGetName(aggrvars[0]), aggrsolval, constant, val);
1447  }
1448  else
1449  {
1450  SCIPerrorMessage("multi-aggregation <%s>[%g] = ... %d vars ... + %g violates debugging solution (expected %g)\n",
1451  SCIPvarGetName(var), solval, naggrvars, constant, val);
1452  }
1453  SCIPABORT();
1454  }
1455 
1456  return SCIP_OKAY;
1457 }
1458 
1459 /** check whether given clique is valid for the debugging solution */
1461  SCIP_SET* set, /**< global SCIP settings */
1462  SCIP_VAR** vars, /**< binary variables in the clique: at most one can be set to the given value */
1463  SCIP_Bool* values, /**< values of the variables in the clique; NULL to use TRUE for all vars */
1464  int nvars /**< number of variables in the clique */
1465  )
1466 {
1467  SCIP_Real solval;
1468  int pos1;
1469  int pos2;
1470  int v;
1471 
1472  assert(set != NULL);
1473  assert(vars != NULL);
1474 
1475  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1476  if( !SCIPdebugSolIsEnabled(set->scip) )
1477  return SCIP_OKAY;
1478 
1479  /* check whether a debug solution is available */
1480  if( !debugSolutionAvailable(set) )
1481  return SCIP_OKAY;
1482 
1483  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1484  if( debugSolIsAchieved(set) )
1485  return SCIP_OKAY;
1486 
1487  pos1 = -1;
1488  pos2 = -1;
1489 
1490  for( v = 0; v < nvars; ++v )
1491  {
1492  assert(vars[v] != NULL);
1493  assert(SCIPvarIsBinary(vars[v]));
1494 
1495  /* get solution value of variable */
1496  SCIP_CALL( getSolutionValue(set, vars[v], &solval) );
1497 
1498  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1499  continue;
1500 
1501  assert(SCIPsetIsFeasZero(set, solval) || SCIPsetIsFeasEQ(set, solval, 1.0));
1502 
1503  /* negated solution value if negated variable is in clique */
1504  if( values != NULL && values[v] == 0 )
1505  solval = 1.0 - solval;
1506 
1507  if( SCIPsetIsFeasEQ(set, solval, 1.0) )
1508  {
1509  if( pos1 == -1 )
1510  pos1 = v;
1511  else
1512  {
1513  assert(pos2 == -1);
1514  pos2 = v;
1515  break;
1516  }
1517  }
1518  }
1519 
1520  /* print debug message if the clique violates the debugging solution */
1521  if( pos2 != -1 )
1522  {
1523  assert(pos1 != -1);
1524  SCIPerrorMessage("clique violates debugging solution, (at least) variable <%s%s> and variable <%s%s> are both one in the debugging solution\n",
1525  (values == NULL || values[pos1]) ? "" : "~", SCIPvarGetName(vars[pos1]), (values == NULL || values[pos2]) ? "" : "~", SCIPvarGetName(vars[pos2]));
1526  SCIPABORT();
1527  }
1528 
1529  return SCIP_OKAY;
1530 }
1531 
1532 /** check, whether at least one literals is TRUE in the debugging solution */
1533 static
1534 SCIP_Bool debugCheckBdchginfos(
1535  SCIP_SET* set, /**< global SCIP settings */
1536  SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
1537  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
1538  int nbdchginfos /**< number of bound changes in the conflict set */
1539  )
1540 {
1541  SCIP_Real solval;
1542  int i;
1543 
1544  /* check whether a debug solution is available */
1545  if( !debugSolutionAvailable(set) )
1546  return SCIP_OKAY;
1547 
1548  assert(SCIPdebugSolIsEnabled(set->scip));
1549 
1550  solval = 0.0;
1551  /* check, whether at least one literals is TRUE in the debugging solution */
1552  for( i = 0; i < nbdchginfos; ++i )
1553  {
1554  SCIP_BDCHGINFO* bdchginfo;
1555  SCIP_VAR* var;
1556  SCIP_Real newbound;
1557 
1558  bdchginfo = bdchginfos[i];
1559  assert(bdchginfo != NULL);
1560 
1561  var = SCIPbdchginfoGetVar(bdchginfo);
1562  assert(var != NULL);
1563 
1564  if( relaxedbds != NULL )
1565  newbound = relaxedbds[i];
1566  else
1567  newbound = SCIPbdchginfoGetNewbound(bdchginfo);
1568 
1569  SCIP_CALL( getSolutionValue(set, var, &solval) );
1570 
1571  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1572  return TRUE;
1573 
1575  {
1576  assert(SCIPsetIsLE(set, newbound, SCIPbdchginfoGetNewbound(bdchginfo)));
1577 
1579  {
1580  if( SCIPsetIsLE(set, solval, newbound) )
1581  return TRUE;
1582  }
1583  else
1584  {
1585  if( SCIPsetIsLT(set, solval, newbound) )
1586  return TRUE;
1587  }
1588  }
1589  else
1590  {
1591  assert(SCIPsetIsGE(set, newbound, SCIPbdchginfoGetNewbound(bdchginfo)));
1592 
1594  {
1595  if( SCIPsetIsGE(set, solval, newbound) )
1596  return TRUE;
1597  }
1598  else
1599  {
1600  if( SCIPsetIsGT(set, solval, newbound) )
1601  return TRUE;
1602  }
1603  }
1604  }
1605 
1606  return FALSE;
1607 }
1608 
1609 /** print bound change information */
1610 static
1611 SCIP_RETCODE printBdchginfo(
1612  SCIP_SET* set, /**< global SCIP settings */
1613  SCIP_BDCHGINFO * bdchginfo, /**< bound change information */
1614  SCIP_Real relaxedbd /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
1615  )
1616 {
1617  SCIP_Real solval;
1618 
1619  /* check whether a debug solution is available */
1620  if( !debugSolutionAvailable(set) )
1621  return SCIP_OKAY;
1622 
1623  /* get solution value within the debug solution */
1624  SCIP_CALL( getSolutionValue(set, SCIPbdchginfoGetVar(bdchginfo), &solval) );
1625 
1626  printf(" <%s>[%.15g] %s %g(%g)", SCIPvarGetName(SCIPbdchginfoGetVar(bdchginfo)), solval,
1627  SCIPbdchginfoGetBoundtype(bdchginfo) == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=",
1628  SCIPbdchginfoGetNewbound(bdchginfo), relaxedbd);
1629 
1630  return SCIP_OKAY;
1631 }
1632 
1633 
1634 /** print bound change information */
1635 static
1636 SCIP_RETCODE printBdchginfos(
1637  SCIP_SET* set, /**< global SCIP settings */
1638  SCIP_BDCHGINFO** bdchginfos, /**< bound change information array */
1639  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
1640  int nbdchginfos /**< number of bound changes in the conflict set */
1641  )
1642 {
1643  int i;
1644 
1645  /* check whether a debug solution is available */
1646  if( !debugSolutionAvailable(set) )
1647  return SCIP_OKAY;
1648 
1649  for( i = 0; i < nbdchginfos; ++i )
1650  {
1651  SCIP_BDCHGINFO* bdchginfo;
1652 
1653  bdchginfo = bdchginfos[i];
1654  assert(bdchginfo != NULL);
1655 
1656  printBdchginfo(set, bdchginfo, relaxedbds != NULL ? relaxedbds[i] : SCIPbdchginfoGetNewbound(bdchginfo));
1657  }
1658 
1659  return SCIP_OKAY;
1660 }
1661 
1662 /** checks whether given conflict is valid for the debugging solution */
1664  BMS_BLKMEM* blkmem, /**< block memory */
1665  SCIP_SET* set, /**< global SCIP settings */
1666  SCIP_NODE* node, /**< node where the conflict clause is added */
1667  SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
1668  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict */
1669  int nbdchginfos /**< number of bound changes in the conflict set */
1670  )
1671 {
1672  SCIP_Bool solcontained;
1673 
1674  assert(set != NULL);
1675  assert(blkmem != NULL);
1676  assert(node != NULL);
1677  assert(nbdchginfos == 0 || bdchginfos != NULL);
1678 
1679  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1680  if( !SCIPdebugSolIsEnabled(set->scip) )
1681  return SCIP_OKAY;
1682 
1683  /* check whether a debug solution is available */
1684  if( !debugSolutionAvailable(set) )
1685  return SCIP_OKAY;
1686 
1687  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1688  if( debugSolIsAchieved(set) )
1689  return SCIP_OKAY;
1690 
1691  /* check whether the debugging solution is contained in the local subproblem */
1692  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
1693  if( !solcontained )
1694  return SCIP_OKAY;
1695 
1696  /* check, whether at least one literals is TRUE in the debugging solution */
1697  if( debugCheckBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) )
1698  return SCIP_OKAY;
1699 
1700  SCIPerrorMessage("invalid conflict set:");
1701 
1702  /* print bound changes which are already part of the conflict set */
1703  SCIP_CALL( printBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) );
1704 
1705  printf("\n");
1706  SCIPABORT();
1707 
1708  return SCIP_OKAY; /*lint !e527*/
1709 }
1710 
1711 /** checks whether given conflict graph frontier is valid for the debugging solution */
1713  BMS_BLKMEM* blkmem, /**< block memory */
1714  SCIP_SET* set, /**< global SCIP settings */
1715  SCIP_NODE* node, /**< node where the conflict clause is added */
1716  SCIP_BDCHGINFO* bdchginfo, /**< bound change info which got resolved, or NULL */
1717  SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
1718  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict */
1719  int nbdchginfos, /**< number of bound changes in the conflict set */
1720  SCIP_PQUEUE* bdchgqueue, /**< unprocessed conflict bound changes */
1721  SCIP_PQUEUE* forcedbdchgqueue /**< unprocessed conflict bound changes that must be resolved */
1722  )
1723 {
1724  SCIP_BDCHGINFO** bdchgqueued;
1725  SCIP_BDCHGINFO** forcedbdchgqueued;
1726  SCIP_Bool solcontained;
1727  int nbdchgqueued;
1728  int nforcedbdchgqueued;
1729 
1730  assert(set != NULL);
1731  assert(blkmem != NULL);
1732  assert(node != NULL);
1733  assert(nbdchginfos == 0 || bdchginfos != NULL);
1734 
1735  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1736  if( !SCIPdebugSolIsEnabled(set->scip) )
1737  return SCIP_OKAY;
1738 
1739  /* check whether a debug solution is available */
1740  if( !debugSolutionAvailable(set) )
1741  return SCIP_OKAY;
1742 
1743  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1744  if( debugSolIsAchieved(set) )
1745  return SCIP_OKAY;
1746 
1747  /* check whether the debugging solution is contained in the local subproblem */
1748  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
1749  if( !solcontained )
1750  return SCIP_OKAY;
1751 
1752  /* check, whether one literals is TRUE in the debugging solution */
1753  if( debugCheckBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) )
1754  return SCIP_OKAY;
1755 
1756  /* get the elements of the bound change queue */
1757  bdchgqueued = (SCIP_BDCHGINFO**)SCIPpqueueElems(bdchgqueue);
1758  nbdchgqueued = SCIPpqueueNElems(bdchgqueue);
1759 
1760  /* check, whether one literals is TRUE in the debugging solution */
1761  if( debugCheckBdchginfos(set, bdchgqueued, NULL, nbdchgqueued) )
1762  return SCIP_OKAY;
1763 
1764  /* get the elements of the bound change queue */
1765  forcedbdchgqueued = (SCIP_BDCHGINFO**)SCIPpqueueElems(forcedbdchgqueue);
1766  nforcedbdchgqueued = SCIPpqueueNElems(forcedbdchgqueue);
1767 
1768  /* check, whether one literals is TRUE in the debugging solution */
1769  if( debugCheckBdchginfos(set, forcedbdchgqueued, NULL, nforcedbdchgqueued) )
1770  return SCIP_OKAY;
1771 
1772  SCIPerrorMessage("invalid conflict frontier");
1773 
1774  if( bdchginfo != NULL )
1775  {
1776  printf(" (after resolving bound change ");
1777  printBdchginfo(set, bdchginfo, SCIPbdchginfoGetNewbound(bdchginfo));
1778  printf(")");
1779  }
1780  printf(":");
1781 
1782  /* print bound changes which are already part of the conflict set */
1783  SCIP_CALL( printBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) );
1784 
1785  /* print bound changes which are queued */
1786  SCIP_CALL( printBdchginfos(set, bdchgqueued, NULL, nbdchgqueued) );
1787 
1788  /* print bound changes which are queued in the force queue */
1789  SCIP_CALL( printBdchginfos(set, forcedbdchgqueued, NULL, nforcedbdchgqueued) );
1790 
1791  printf("\n");
1792  SCIPABORT();
1793 
1794  return SCIP_OKAY; /*lint !e527*/
1795 }
1796 
1797 /** check whether the debugging solution is valid in the current node */
1799  SCIP* scip, /**< SCIP data structure */
1800  SCIP_Bool* isvalidinsubtree /**< pointer to store whether the solution is valid in the current
1801  * subtree */
1802  )
1803 {
1804  SCIP_Bool solcontained;
1805 
1806  *isvalidinsubtree = FALSE;
1807 
1808  assert(scip->set != NULL);
1809 
1810  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1811  if( !SCIPdebugSolIsEnabled(scip) )
1812  return SCIP_OKAY;
1813 
1814  /* check whether a debug solution is available */
1815  if( !debugSolutionAvailable(scip->set) )
1816  return SCIP_OKAY;
1817 
1818  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1819  if( debugSolIsAchieved(scip->set) )
1820  return SCIP_OKAY;
1821 
1822  /* check whether the debugging solution is contained in the local subproblem */
1823  SCIP_CALL( isSolutionInNode(SCIPblkmem(scip), scip->set, SCIPgetCurrentNode(scip), &solcontained) );
1824 
1825  if( solcontained )
1826  *isvalidinsubtree = TRUE;
1827 
1828  return SCIP_OKAY;
1829 }
1830 
1831 /** checks whether SCIP data structure is the main SCIP (the one for which debugging is enabled) */
1832 SCIP_Bool SCIPdebugIsMainscip(
1833  SCIP* scip /**< SCIP data structure */
1834  )
1835 {
1836  assert(scip != NULL);
1837 
1838  return SCIPdebugSolIsEnabled(scip);
1839 }
1840 
1841 /** enabling solution debugging mechanism */
1842 void SCIPdebugSolEnable(
1843  SCIP* scip /**< SCIP data structure */
1844  )
1845 {
1846  SCIP_DEBUGSOLDATA* debugsoldata;
1847  assert(scip != NULL);
1848  assert(scip->set != NULL);
1849 
1850  debugsoldata = SCIPsetGetDebugSolData(scip->set);
1851  assert(debugsoldata != NULL);
1852 
1853  debugsoldata->debugsoldisabled = FALSE;
1854 }
1855 
1856 /** disabling solution debugging mechanism */
1857 void SCIPdebugSolDisable(
1858  SCIP* scip /**< SCIP data structure */
1859  )
1860 {
1861  SCIP_DEBUGSOLDATA* debugsoldata;
1862  assert(scip != NULL);
1863  assert(scip->set != NULL);
1864 
1865  debugsoldata = SCIPsetGetDebugSolData(scip->set);
1866  assert(debugsoldata != NULL);
1867 
1868  debugsoldata->debugsoldisabled = TRUE;
1869 }
1870 
1871 /** check if solution debugging mechanism is enabled */
1873  SCIP* scip /**< SCIP data structure */
1874  )
1875 {
1876  SCIP_DEBUGSOLDATA* debugsoldata;
1877  assert(scip != NULL);
1878  assert(scip->set != NULL);
1879 
1880  debugsoldata = SCIPsetGetDebugSolData(scip->set);
1881  assert(debugsoldata != NULL);
1882 
1883  return (!debugsoldata->debugsoldisabled);
1884 }
1885 
1886 /** check if SCIP is compiled with WITH_DEBUG_SOLUTION */
1888 {
1889 #ifdef WITH_DEBUG_SOLUTION
1890  return TRUE;
1891 #else
1892  return FALSE;
1893 #endif
1894 }
1895 
1896 
1897 /** propagator to force finding the debugging solution */
1898 static
1899 SCIP_DECL_PROPEXEC(propExecDebug)
1900 { /*lint --e{715}*/
1901  SCIP_VAR** vars;
1902  int nvars;
1903  int i;
1904 
1905  assert(scip != NULL);
1906  assert(result != NULL);
1907 
1908  *result = SCIP_DIDNOTFIND;
1909 
1910  /* check if we are in the original problem and not in a sub MIP */
1911  if( !SCIPdebugIsMainscip(scip) )
1912  return SCIP_OKAY;
1913 
1914  if( SCIPgetStage(scip) != SCIP_STAGE_SOLVING )
1915  return SCIP_OKAY;
1916 
1917  /* check whether a debug solution is available */
1918  if( !debugSolutionAvailable(scip->set) )
1919  return SCIP_OKAY;
1920 
1921  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1922  if( debugSolIsAchieved(scip->set) )
1923  return SCIP_OKAY;
1924 
1925 #if 1
1926  /* solve at least one LP */
1927  if( SCIPgetNLPIterations(scip) == 0 )
1928  return SCIP_OKAY;
1929 #endif
1930 
1931  vars = SCIPgetOrigVars(scip);
1932  nvars = SCIPgetNOrigVars(scip);
1933  for( i = 0; i < nvars; ++i )
1934  {
1935  SCIP_Real solval;
1936  SCIP_Real lb;
1937  SCIP_Real ub;
1938  SCIP_Bool infeasible;
1939  SCIP_Bool fixed;
1940 
1941  SCIP_CALL( getSolutionValue(scip->set, vars[i], &solval) );
1942  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1943  {
1944  SCIPerrorMessage("original variable without debugging solution value\n");
1945  SCIPABORT();
1946  }
1947 
1948  lb = SCIPvarGetLbGlobal(vars[i]);
1949  ub = SCIPvarGetUbGlobal(vars[i]);
1950  if( SCIPisLT(scip, solval, lb) || SCIPisGT(scip, solval, ub) )
1951  {
1952  SCIPerrorMessage("solution value %.15g of <%s> outside bounds loc=[%.15g,%.15g], glb=[%.15g,%.15g]\n",
1953  solval, SCIPvarGetName(vars[i]), lb, ub, SCIPvarGetLbGlobal(vars[i]), SCIPvarGetUbGlobal(vars[i]));
1954  SCIPABORT();
1955  }
1956 
1957  SCIP_CALL( SCIPfixVar(scip, vars[i], solval, &infeasible, &fixed) );
1958  if( infeasible )
1959  *result = SCIP_CUTOFF;
1960  else if( fixed )
1961  *result = SCIP_REDUCEDDOM;
1962  }
1963 
1964  return SCIP_OKAY;
1965 }
1966 
1967 /** creates the debugging propagator and includes it in SCIP */
1969  SCIP* scip /**< SCIP data structure */
1970  )
1971 {
1972  assert(scip != NULL);
1973 
1974  /* include propagator */
1975  SCIP_CALL( SCIPincludeProp(scip, "debug", "debugging propagator", 99999999, -1, FALSE,
1977  NULL, propExecDebug, NULL, NULL) );
1978 
1979  return SCIP_OKAY;
1980 }
1981 
1982 /** adds a solution value for a new variable in the transformed problem that has no original counterpart
1983  * a value can only be set if no value has been set for this variable before
1984  */
1986  SCIP* scip, /**< SCIP data structure */
1987  SCIP_VAR* var, /**< variable for which to add a value */
1988  SCIP_Real val /**< solution value for variable */
1989  )
1990 {
1991  SCIP_DEBUGSOLDATA* debugsoldata;
1992  SCIP_Real testval;
1993  const char* varname;
1994  int i;
1995 
1996  assert(scip != NULL);
1997  assert(var != NULL);
1998  assert(scip->set != NULL);
1999 
2000  debugsoldata = SCIPsetGetDebugSolData(scip->set);
2001  assert(debugsoldata != NULL);
2002 
2003  /* assert that we are in the SCIP instance that we are debugging and not some different (subSCIP,
2004  * auxiliary CIP, ...)
2005  */
2006  if( !SCIPdebugSolIsEnabled(scip) )
2007  return SCIP_OKAY;
2008 
2009  /* check whether a debug solution is available */
2010  if( !debugSolutionAvailable(scip->set) )
2011  return SCIP_OKAY;
2012 
2013  if( debugsoldata->debugsol == NULL )
2014  {
2015  /* make sure a debug solution has been read, so we do not compare against the initial debugsolval == 0 */
2016  SCIP_CALL( readSolution(scip->set) );
2017  }
2018 
2019  /* allocate memory */
2020  if( debugsoldata->nsolvals >= debugsoldata->solsize )
2021  {
2022  debugsoldata->solsize = MAX(2*debugsoldata->solsize, debugsoldata->nsolvals+1);
2023  SCIP_ALLOC( BMSreallocMemoryArray(&debugsoldata->solnames, debugsoldata->solsize) );
2024  SCIP_ALLOC( BMSreallocMemoryArray(&debugsoldata->solvals, debugsoldata->solsize) );
2025  }
2026  assert(debugsoldata->nsolvals < debugsoldata->solsize);
2027 
2028  /* store solution value in sorted list */
2029  varname = SCIPvarGetName(var);
2030  for( i = debugsoldata->nsolvals; i > 0 && strcmp(varname, debugsoldata->solnames[i-1]) < 0; --i )
2031  {
2032  debugsoldata->solnames[i] = debugsoldata->solnames[i-1];
2033  debugsoldata->solvals[i] = debugsoldata->solvals[i-1];
2034  }
2035  if( i > 0 && strcmp(varname, debugsoldata->solnames[i-1]) == 0 )
2036  {
2037  if( REALABS(debugsoldata->solvals[i-1] - val) > 1e-9 )
2038  {
2039  SCIPerrorMessage("already have stored different debugging solution value (%g) for variable <%s>, cannot store %g\n", debugsoldata->solvals[i-1], varname, val);
2040  return SCIP_ERROR;
2041  }
2042  else
2043  {
2044  SCIPdebugMsg(scip, "already have stored debugging solution value %g for variable <%s>, do not store same value again\n", val, varname);
2045  for( ; i < debugsoldata->nsolvals; ++i )
2046  {
2047  debugsoldata->solnames[i] = debugsoldata->solnames[i+1];
2048  debugsoldata->solvals[i] = debugsoldata->solvals[i+1];
2049  }
2050  return SCIP_OKAY;
2051  }
2052  }
2053 
2054  /* insert new solution value */
2055  SCIP_ALLOC( BMSduplicateMemoryArray(&(debugsoldata->solnames[i]), varname, strlen(varname)+1) );
2056  SCIPdebugMsg(scip, "add variable <%s>: value <%g>\n", debugsoldata->solnames[i], val);
2057  debugsoldata->solvals[i] = val;
2058  debugsoldata->nsolvals++;
2059 
2060  /* update objective function value of debug solution */
2061  debugsoldata->debugsolval += debugsoldata->solvals[i] * SCIPvarGetObj(var);
2062  SCIPdebugMsg(scip, "Debug Solution value is now %g.\n", debugsoldata->debugsolval);
2063 
2065  {
2066  /* add values to SCIP debug solution */
2067  SCIP_CALL( SCIPsetSolVal(scip, debugsoldata->debugsol, var, debugsoldata->solvals[i] ) );
2068  }
2069 
2070  /* get solution value once to produce warning if solution was cut off */
2071  SCIPdebugGetSolVal(scip, var, &testval);
2072 
2073  return SCIP_OKAY;
2074 }
2075 
2076 #else
2077 
2078 /** this is a dummy method to make the SunOS gcc linker happy */
2079 extern void SCIPdummyDebugMethodForSun(void);
2081 {
2082  return;
2083 }
2084 
2085 #endif
2086 
2087 
2088 /*
2089  * debug method for LP interface, to check if the LP interface works correct
2090  */
2091 #ifdef SCIP_DEBUG_LP_INTERFACE
2092 
2093 /* check whether coef is the r-th row of the inverse basis matrix B^-1; this is
2094  * the case if( coef * B ) is the r-th unit vector */
2096  SCIP* scip, /**< SCIP data structure */
2097  int r, /**< row number */
2098  SCIP_Real* coef /**< r-th row of the inverse basis matrix */
2099  )
2100 {
2101  SCIP_Real vecval;
2102  SCIP_Real matrixval;
2103  int* basisind;
2104  int nrows;
2105  int idx;
2106  int i;
2107  int k;
2108 
2109  assert(scip != NULL);
2110 
2111  nrows = SCIPgetNLPRows(scip);
2112 
2113  /* get basic indices for the basic matrix B */
2114  SCIP_CALL( SCIPallocBufferArray(scip, &basisind, nrows) );
2115  SCIP_CALL( SCIPgetLPBasisInd(scip, basisind) );
2116 
2117  /* loop over the columns of B */
2118  for( k = 0; k < nrows; ++k )
2119  {
2120  vecval = 0.0;
2121 
2122  /* indices of basic columns and rows:
2123  * - index i >= 0 corresponds to column i,
2124  * - index i < 0 to row -i-1
2125  */
2126  idx = basisind[k];
2127 
2128  /* check if we have a slack variable; this is the case if idx < 0 */
2129  if( idx >= 0 )
2130  {
2131  /* loop over the rows to compute the corresponding value in the unit vector */
2132  for( i = 0; i < nrows; ++i )
2133  {
2134  SCIP_CALL( SCIPlpiGetCoef(scip->lp->lpi, i, idx, &matrixval) );
2135  vecval += coef[i] * matrixval;
2136  }
2137  }
2138  else
2139  {
2140  assert( idx < 0 );
2141 
2142  /* retransform idx
2143  * - index i >= 0 corresponds to column i,
2144  * - index i < 0 to row -i-1
2145  */
2146  idx = -idx - 1;
2147  assert( idx >= 0 && idx < nrows );
2148 
2149  /* since idx < 0 we are in the case of a slack variable, i.e., the corresponding column
2150  is the idx-unit vector; note that some LP solver return a -idx-unit vector */
2151  /* vecval = REALABS(coef[idx]);*/
2152  vecval = coef[idx];
2153  }
2154 
2155  /* check if vecval fits to the r-th unit vector */
2156  if( k == r && !SCIPisFeasEQ(scip, vecval, 1.0) )
2157  {
2158  /* we expected a 1.0 and found something different */
2159  SCIPmessagePrintWarning(SCIPgetMessagehdlr(scip), "checked SCIPgetLPBInvRow() found value <%g> expected 1.0\n", vecval);
2160  }
2161  else if( k != r && !SCIPisFeasZero(scip, vecval) )
2162  {
2163  /* we expected a 0.0 and found something different */
2164  SCIPmessagePrintWarning(SCIPgetMessagehdlr(scip), "checked SCIPgetLPBInvRow() found value <%g> expected 0.0\n", vecval);
2165  }
2166  }
2167 
2168  SCIPfreeBufferArray(scip, &basisind);
2169 
2170  return SCIP_OKAY;
2171 }
2172 
2173 #endif
2174 
2175 /** checks, if SCIP is in one of the feasible stages */
2176 #ifndef NDEBUG
2178  SCIP* scip, /**< SCIP data structure */
2179  const char* method, /**< method that was called */
2180  SCIP_Bool init, /**< may method be called in the INIT stage? */
2181  SCIP_Bool problem, /**< may method be called in the PROBLEM stage? */
2182  SCIP_Bool transforming, /**< may method be called in the TRANSFORMING stage? */
2183  SCIP_Bool transformed, /**< may method be called in the TRANSFORMED stage? */
2184  SCIP_Bool initpresolve, /**< may method be called in the INITPRESOLVE stage? */
2185  SCIP_Bool presolving, /**< may method be called in the PRESOLVING stage? */
2186  SCIP_Bool exitpresolve, /**< may method be called in the EXITPRESOLE stage? */
2187  SCIP_Bool presolved, /**< may method be called in the PRESOLVED stage? */
2188  SCIP_Bool initsolve, /**< may method be called in the INITSOLVE stage? */
2189  SCIP_Bool solving, /**< may method be called in the SOLVING stage? */
2190  SCIP_Bool solved, /**< may method be called in the SOLVED stage? */
2191  SCIP_Bool exitsolve, /**< may method be called in the EXITSOLVE stage? */
2192  SCIP_Bool freetrans, /**< may method be called in the FREETRANS stage? */
2193  SCIP_Bool freescip /**< may method be called in the FREE stage? */
2194  )
2195 {
2196  assert(scip != NULL);
2197  assert(method != NULL);
2198 
2199  /*SCIPdebugMsg(scip, "called method <%s> at stage %d ------------------------------------------------\n",
2200  method, scip->set->stage);*/
2201 
2202  assert(scip->mem != NULL);
2203  assert(scip->set != NULL);
2204  assert(scip->interrupt != NULL);
2205  assert(scip->dialoghdlr != NULL);
2206  assert(scip->totaltime != NULL);
2207 
2208  switch( scip->set->stage )
2209  {
2210  case SCIP_STAGE_INIT:
2211  assert(scip->stat == NULL);
2212  assert(scip->origprob == NULL);
2213  assert(scip->eventfilter == NULL);
2214  assert(scip->eventqueue == NULL);
2215  assert(scip->branchcand == NULL);
2216  assert(scip->lp == NULL);
2217  assert(scip->nlp == NULL);
2218  assert(scip->primal == NULL);
2219  assert(scip->tree == NULL);
2220  assert(scip->conflict == NULL);
2221  assert(scip->transprob == NULL);
2222  assert(scip->pricestore == NULL);
2223  assert(scip->sepastore == NULL);
2224  assert(scip->cutpool == NULL);
2225  assert(scip->delayedcutpool == NULL);
2226 
2227  if( !init )
2228  {
2229  SCIPerrorMessage("cannot call method <%s> in initialization stage\n", method);
2230  return SCIP_INVALIDCALL;
2231  }
2232  return SCIP_OKAY;
2233 
2234  case SCIP_STAGE_PROBLEM:
2235  assert(scip->stat != NULL);
2236  assert(scip->origprob != NULL);
2237  assert(scip->eventfilter == NULL);
2238  assert(scip->eventqueue == NULL);
2239  assert(scip->branchcand == NULL);
2240  assert(scip->lp == NULL);
2241  assert(scip->nlp == NULL);
2242  assert(scip->primal == NULL);
2243  assert(scip->tree == NULL);
2244  assert(scip->conflict == NULL);
2245  assert(scip->transprob == NULL);
2246  assert(scip->pricestore == NULL);
2247  assert(scip->sepastore == NULL);
2248  assert(scip->cutpool == NULL);
2249  assert(scip->delayedcutpool == NULL);
2250 
2251  if( !problem )
2252  {
2253  SCIPerrorMessage("cannot call method <%s> in problem creation stage\n", method);
2254  return SCIP_INVALIDCALL;
2255  }
2256  return SCIP_OKAY;
2257 
2259  assert(scip->stat != NULL);
2260  assert(scip->origprob != NULL);
2261  assert(scip->eventfilter != NULL);
2262  assert(scip->eventqueue != NULL);
2263  assert(scip->branchcand != NULL);
2264  assert(scip->lp != NULL);
2265  assert(scip->primal != NULL);
2266  assert(scip->tree != NULL);
2267  assert(scip->conflict != NULL);
2268  assert(scip->transprob != NULL);
2269  assert(scip->pricestore == NULL);
2270  assert(scip->sepastore == NULL);
2271  assert(scip->cutpool == NULL);
2272  assert(scip->delayedcutpool == NULL);
2273 
2274  if( !transforming )
2275  {
2276  SCIPerrorMessage("cannot call method <%s> in problem transformation stage\n", method);
2277  return SCIP_INVALIDCALL;
2278  }
2279  return SCIP_OKAY;
2280 
2282  assert(scip->stat != NULL);
2283  assert(scip->origprob != NULL);
2284  assert(scip->eventfilter != NULL);
2285  assert(scip->eventqueue != NULL);
2286  assert(scip->branchcand != NULL);
2287  assert(scip->lp != NULL);
2288  assert(scip->primal != NULL);
2289  assert(scip->tree != NULL);
2290  assert(scip->conflict != NULL);
2291  assert(scip->transprob != NULL);
2292  assert(scip->pricestore == NULL);
2293  assert(scip->sepastore == NULL);
2294  assert(scip->cutpool == NULL);
2295  assert(scip->delayedcutpool == NULL);
2296 
2297  if( !transformed )
2298  {
2299  SCIPerrorMessage("cannot call method <%s> in problem transformed stage\n", method);
2300  return SCIP_INVALIDCALL;
2301  }
2302  return SCIP_OKAY;
2303 
2305  assert(scip->stat != NULL);
2306  assert(scip->origprob != NULL);
2307  assert(scip->eventfilter != NULL);
2308  assert(scip->eventqueue != NULL);
2309  assert(scip->branchcand != NULL);
2310  assert(scip->lp != NULL);
2311  assert(scip->primal != NULL);
2312  assert(scip->tree != NULL);
2313  assert(scip->conflict != NULL);
2314  assert(scip->transprob != NULL);
2315  assert(scip->pricestore == NULL);
2316  assert(scip->sepastore == NULL);
2317  assert(scip->cutpool == NULL);
2318  assert(scip->delayedcutpool == NULL);
2319 
2320  if( !initpresolve )
2321  {
2322  SCIPerrorMessage("cannot call method <%s> in init presolving stage\n", method);
2323  return SCIP_INVALIDCALL;
2324  }
2325  return SCIP_OKAY;
2326 
2327  case SCIP_STAGE_PRESOLVING:
2328  assert(scip->stat != NULL);
2329  assert(scip->origprob != NULL);
2330  assert(scip->eventfilter != NULL);
2331  assert(scip->eventqueue != NULL);
2332  assert(scip->branchcand != NULL);
2333  assert(scip->lp != NULL);
2334  assert(scip->primal != NULL);
2335  assert(scip->tree != NULL);
2336  assert(scip->conflict != NULL);
2337  assert(scip->transprob != NULL);
2338  assert(scip->pricestore == NULL);
2339  assert(scip->sepastore == NULL);
2340  assert(scip->cutpool == NULL);
2341  assert(scip->delayedcutpool == NULL);
2342 
2343  if( !presolving )
2344  {
2345  SCIPerrorMessage("cannot call method <%s> in presolving stage\n", method);
2346  return SCIP_INVALIDCALL;
2347  }
2348  return SCIP_OKAY;
2349 
2351  assert(scip->stat != NULL);
2352  assert(scip->origprob != NULL);
2353  assert(scip->eventfilter != NULL);
2354  assert(scip->eventqueue != NULL);
2355  assert(scip->branchcand != NULL);
2356  assert(scip->lp != NULL);
2357  assert(scip->primal != NULL);
2358  assert(scip->tree != NULL);
2359  assert(scip->conflict != NULL);
2360  assert(scip->transprob != NULL);
2361  assert(scip->pricestore == NULL);
2362  assert(scip->sepastore == NULL);
2363  assert(scip->cutpool == NULL);
2364  assert(scip->delayedcutpool == NULL);
2365 
2366  if( !exitpresolve )
2367  {
2368  SCIPerrorMessage("cannot call method <%s> in exit presolving stage\n", method);
2369  return SCIP_INVALIDCALL;
2370  }
2371  return SCIP_OKAY;
2372 
2373  case SCIP_STAGE_PRESOLVED:
2374  assert(scip->stat != NULL);
2375  assert(scip->origprob != NULL);
2376  assert(scip->eventfilter != NULL);
2377  assert(scip->eventqueue != NULL);
2378  assert(scip->branchcand != NULL);
2379  assert(scip->lp != NULL);
2380  assert(scip->primal != NULL);
2381  assert(scip->tree != NULL);
2382  assert(scip->conflict != NULL);
2383  assert(scip->transprob != NULL);
2384  assert(scip->pricestore == NULL);
2385  assert(scip->sepastore == NULL);
2386  assert(scip->cutpool == NULL);
2387  assert(scip->delayedcutpool == NULL);
2388 
2389  if( !presolved )
2390  {
2391  SCIPerrorMessage("cannot call method <%s> in problem presolved stage\n", method);
2392  return SCIP_INVALIDCALL;
2393  }
2394  return SCIP_OKAY;
2395 
2396  case SCIP_STAGE_INITSOLVE:
2397  assert(scip->stat != NULL);
2398  assert(scip->origprob != NULL);
2399  assert(scip->eventfilter != NULL);
2400  assert(scip->eventqueue != NULL);
2401  assert(scip->branchcand != NULL);
2402  assert(scip->lp != NULL);
2403  assert(scip->primal != NULL);
2404  assert(scip->tree != NULL);
2405  assert(scip->transprob != NULL);
2406 
2407  if( !initsolve )
2408  {
2409  SCIPerrorMessage("cannot call method <%s> in init solve stage\n", method);
2410  return SCIP_INVALIDCALL;
2411  }
2412  return SCIP_OKAY;
2413 
2414  case SCIP_STAGE_SOLVING:
2415  assert(scip->stat != NULL);
2416  assert(scip->origprob != NULL);
2417  assert(scip->eventfilter != NULL);
2418  assert(scip->eventqueue != NULL);
2419  assert(scip->branchcand != NULL);
2420  assert(scip->lp != NULL);
2421  assert(scip->primal != NULL);
2422  assert(scip->tree != NULL);
2423  assert(scip->conflict != NULL);
2424  assert(scip->transprob != NULL);
2425  assert(scip->pricestore != NULL);
2426  assert(scip->sepastore != NULL);
2427  assert(scip->cutpool != NULL);
2428  assert(scip->delayedcutpool != NULL);
2429 
2430  if( !solving )
2431  {
2432  SCIPerrorMessage("cannot call method <%s> in solving stage\n", method);
2433  return SCIP_INVALIDCALL;
2434  }
2435  return SCIP_OKAY;
2436 
2437  case SCIP_STAGE_SOLVED:
2438  assert(scip->stat != NULL);
2439  assert(scip->origprob != NULL);
2440  assert(scip->eventfilter != NULL);
2441  assert(scip->eventqueue != NULL);
2442  assert(scip->branchcand != NULL);
2443  assert(scip->lp != NULL);
2444  assert(scip->primal != NULL);
2445  assert(scip->tree != NULL);
2446  assert(scip->conflict != NULL);
2447  assert(scip->transprob != NULL);
2448  assert(scip->pricestore != NULL);
2449  assert(scip->sepastore != NULL);
2450  assert(scip->cutpool != NULL);
2451  assert(scip->delayedcutpool != NULL);
2452 
2453  if( !solved )
2454  {
2455  SCIPerrorMessage("cannot call method <%s> in problem solved stage\n", method);
2456  return SCIP_INVALIDCALL;
2457  }
2458  return SCIP_OKAY;
2459 
2460  case SCIP_STAGE_EXITSOLVE:
2461  assert(scip->stat != NULL);
2462  assert(scip->origprob != NULL);
2463  assert(scip->eventfilter != NULL);
2464  assert(scip->eventqueue != NULL);
2465  assert(scip->branchcand != NULL);
2466  assert(scip->lp != NULL);
2467  assert(scip->primal != NULL);
2468  assert(scip->tree != NULL);
2469  assert(scip->transprob != NULL);
2470 
2471  if( !exitsolve )
2472  {
2473  SCIPerrorMessage("cannot call method <%s> in solve deinitialization stage\n", method);
2474  return SCIP_INVALIDCALL;
2475  }
2476  return SCIP_OKAY;
2477 
2478  case SCIP_STAGE_FREETRANS:
2479  assert(scip->stat != NULL);
2480  assert(scip->origprob != NULL);
2481  assert(scip->pricestore == NULL);
2482  assert(scip->sepastore == NULL);
2483  assert(scip->cutpool == NULL);
2484  assert(scip->delayedcutpool == NULL);
2485 
2486  if( !freetrans )
2487  {
2488  SCIPerrorMessage("cannot call method <%s> in free transformed problem stage\n", method);
2489  return SCIP_INVALIDCALL;
2490  }
2491  return SCIP_OKAY;
2492 
2493  case SCIP_STAGE_FREE:
2494  if( !freescip )
2495  {
2496  SCIPerrorMessage("cannot call method <%s> in free stage\n", method);
2497  return SCIP_INVALIDCALL;
2498  }
2499  return SCIP_OKAY;
2500 
2501  default:
2502  /* note that this is in an internal SCIP error since all SCIP stages are covert in the switch above */
2503  SCIPerrorMessage("invalid SCIP stage <%d>\n", scip->set->stage);
2504  return SCIP_ERROR;
2505  }
2506 }
2507 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_STAT * stat
Definition: struct_scip.h:70
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1468
SCIP_Bool SCIPsetIsLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6258
SCIP_Bool SCIPsetIsFeasZero(SCIP_SET *set, SCIP_Real val)
Definition: set.c:6708
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPlpDiving(SCIP_LP *lp)
Definition: lp.c:17780
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip_tree.c:82
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:356
#define SCIPdebugRemoveNode(blkmem, set, node)
Definition: debug.h:270
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:141
internal methods for branch and bound tree
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
SCIP_CONFLICT * conflict
Definition: struct_scip.h:87
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPdebugFreeDebugData(set)
Definition: debug.h:263
SCIP_Bool SCIPsetIsFeasEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6598
SCIP_VAR * SCIPbdchginfoGetVar(SCIP_BDCHGINFO *bdchginfo)
Definition: var.c:18512
SCIP_Real SCIPnodeGetLowerbound(SCIP_NODE *node)
Definition: tree.c:7452
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17910
#define SCIP_MAXSTRLEN
Definition: def.h:293
SCIP_BOUNDCHG * boundchgs
Definition: struct_var.h:125
int SCIProwGetNNonz(SCIP_ROW *row)
Definition: lp.c:17146
#define SCIPdebugCheckImplic(set, var, varfixing, implvar, impltype, implbound)
Definition: debug.h:274
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip_prob.c:2430
SCIP_EVENTQUEUE * eventqueue
Definition: struct_scip.h:80
int SCIPgetNLeaves(SCIP *scip)
Definition: scip_tree.c:263
SCIP_CLOCK * totaltime
Definition: struct_scip.h:67
#define SCIPdebugSolDataCreate(debugsoldata)
Definition: debug.h:260
SCIP_PRIMAL * primal
Definition: struct_scip.h:85
const char * SCIProwGetName(SCIP_ROW *row)
Definition: lp.c:17284
SCIP_CUTPOOL * delayedcutpool
Definition: struct_scip.h:97
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:17431
SCIP_Real SCIPsetInfinity(SCIP_SET *set)
Definition: set.c:6065
SCIP_BOUNDTYPE SCIPboundchgGetBoundtype(SCIP_BOUNDCHG *boundchg)
Definition: var.c:17178
unsigned int nboundchgs
Definition: struct_var.h:123
#define SCIPdebugCheckClique(set, vars, values, nvars)
Definition: debug.h:276
SCIP_BRANCHCAND * branchcand
Definition: struct_scip.h:81
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition: lp.c:17225
#define FALSE
Definition: def.h:87
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3014
SCIP_STAGE stage
Definition: struct_set.h:65
#define TRUE
Definition: def.h:86
#define SCIPdebugCheckRow(set, row)
Definition: debug.h:266
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_Real SCIPvarGetNegationConstant(SCIP_VAR *var)
Definition: var.c:17747
SCIP_Real SCIPgetLPFeastol(SCIP *scip)
Definition: scip_lp.c:419
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
Definition: scip_prob.c:2403
#define SCIPdebugCheckLocalLowerbound(blkmem, set, node)
Definition: debug.h:272
#define BMSallocMemoryArray(ptr, num)
Definition: memory.h:116
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
Definition: scip_message.c:79
SCIP_PROB * transprob
Definition: struct_scip.h:89
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3201
int SCIPnodeGetDepth(SCIP_NODE *node)
Definition: tree.c:7442
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:127
#define SCIP_DECL_PROPEXEC(x)
Definition: type_prop.h:208
#define SCIPdebugCheckVbound(set, var, vbtype, vbvar, vbcoef, vbconstant)
Definition: debug.h:273
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
Definition: var.c:17736
#define SCIPdebugMsg
Definition: scip_message.h:69
internal methods for LP management
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:8146
Definition: heur_padm.c:123
SCIP_PROB * origprob
Definition: struct_scip.h:71
SCIP_Longint number
Definition: struct_tree.h:134
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:556
#define SCIP_PRESOLTIMING_FAST
Definition: type_timing.h:43
SCIP_Real SCIPsolGetOrigObj(SCIP_SOL *sol)
Definition: sol.c:2541
SCIP_DIALOGHDLR * dialoghdlr
Definition: struct_scip.h:65
SCIP_Bool SCIPsetIsGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6294
#define SCIPdebugCheckConflict(blkmem, set, node, bdchginfos, relaxedbds, nliterals)
Definition: debug.h:277
SCIP_PRICESTORE * pricestore
Definition: struct_scip.h:92
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
Definition: scip_prob.c:2683
SCIP_FILE * SCIPfopen(const char *path, const char *mode)
Definition: fileio.c:144
struct SCIP_DebugSolData SCIP_DEBUGSOLDATA
Definition: debug.h:50
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17920
SCIP_Bool SCIPsetIsLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6240
SCIP_MEM * mem
Definition: struct_scip.h:62
SCIP_DOMCHG * domchg
Definition: struct_tree.h:150
SCIP_Bool SCIPtreeProbing(SCIP_TREE *tree)
Definition: tree.c:8274
#define SCIPdebugIncludeProp(scip)
Definition: debug.h:279
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:140
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:55
SCIP_EVENTFILTER * eventfilter
Definition: struct_scip.h:79
SCIP_INTERRUPT * interrupt
Definition: struct_scip.h:64
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPdebugCheckInference(blkmem, set, node, var, newbound, boundtype)
Definition: debug.h:269
SCIP_Bool SCIPsetIsRelEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:7077
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
Definition: lp.c:17334
SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
Definition: var.c:12860
SCIP_RETCODE SCIPcheckStage(SCIP *scip, const char *method, SCIP_Bool init, SCIP_Bool problem, SCIP_Bool transforming, SCIP_Bool transformed, SCIP_Bool initpresolve, SCIP_Bool presolving, SCIP_Bool exitpresolve, SCIP_Bool presolved, SCIP_Bool initsolve, SCIP_Bool solving, SCIP_Bool solved, SCIP_Bool exitsolve, SCIP_Bool freetrans, SCIP_Bool freescip)
Definition: debug.c:2177
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:474
int SCIPfeof(SCIP_FILE *stream)
Definition: fileio.c:218
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:48
SCIP_RETCODE SCIPcheckCons(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
Definition: scip_cons.c:2072
struct SCIP_File SCIP_FILE
Definition: pub_fileio.h:34
char * SCIPfgets(char *s, int size, SCIP_FILE *stream)
Definition: fileio.c:191
#define SCIPdebugCheckAggregation(set, var, aggrvars, scalars, constant, naggrvars)
Definition: debug.h:275
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:8085
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17251
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3048
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:418
#define NULL
Definition: lpi_spx1.cpp:155
#define REALABS(x)
Definition: def.h:201
#define SCIPdebugFree(set)
Definition: debug.h:264
#define SCIP_PROPTIMING_ALWAYS
Definition: type_timing.h:64
int SCIPgetNLPRows(SCIP *scip)
Definition: scip_lp.c:617
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:384
SCIP main data structure.
SCIP_Bool SCIPsetIsFeasGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6686
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPvarIsRelaxationOnly(SCIP_VAR *var)
Definition: var.c:17538
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition: lp.c:17235
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:216
void SCIPdummyDebugMethodForSun(void)
Definition: debug.c:2080
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
Definition: cons.c:8324
#define SCIPdebugCheckBInvRow(scip, r, coef)
Definition: debug.h:306
#define SCIPdebugCheckLbGlobal(scip, var, lb)
Definition: debug.h:267
SCIP_LPI * lpi
Definition: struct_lp.h:286
#define SCIPdebugGetSolVal(scip, var, val)
Definition: debug.h:281
void SCIProwPrint(SCIP_ROW *row, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: lp.c:5292
SCIP_Bool SCIPsetIsFeasLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6642
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
Definition: lp.c:17171
#define SCIPdebugCheckUbGlobal(scip, var, ub)
Definition: debug.h:268
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:136
SCIP_CUTPOOL * cutpool
Definition: struct_scip.h:96
#define SCIPdebugCheckConss(scip, conss, nconss)
Definition: debug.h:265
internal methods for problem variables
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:115
#define SCIP_UNKNOWN
Definition: def.h:198
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
Definition: scip_sol.c:1212
SCIP_SEPASTORE * sepastore
Definition: struct_scip.h:93
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
Definition: lp.c:17181
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:84
SCIP_BOUNDCHGTYPE SCIPboundchgGetBoundchgtype(SCIP_BOUNDCHG *boundchg)
Definition: var.c:17168
void SCIPprintSysError(const char *message)
Definition: misc.c:10664
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
Definition: misc.c:3573
int SCIPgetDepth(SCIP *scip)
Definition: scip_tree.c:661
#define SCIPdebugSolIsValidInSubtree(scip, isvalidinsubtree)
Definition: debug.h:282
#define SCIPdebugCheckGlobalLowerbound(blkmem, set)
Definition: debug.h:271
#define MAX(x, y)
Definition: tclique_def.h:83
#define SCIPdebugCheckConflictFrontier(blkmem, set, node, bdchginfo, bdchginfos, relaxedbds, nliterals, bdchgqueue, forcedbdchgqueue)
Definition: debug.h:278
methods for debugging
#define SCIPsetDebugMsg
Definition: set.h:1755
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
Definition: scip_sol.c:976
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17758
SCIP_Real SCIPbdchginfoGetNewbound(SCIP_BDCHGINFO *bdchginfo)
Definition: var.c:18502
void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1479
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
Definition: scip_var.c:8273
SCIP_RETCODE SCIPgetLPBasisInd(SCIP *scip, int *basisind)
Definition: scip_lp.c:677
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1435
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:12773
SCIP_Bool SCIPsetIsFeasLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6620
SCIP_Real * r
Definition: circlepacking.c:50
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
Definition: lp.c:17191
#define SCIPdebugReset(set)
Definition: debug.h:262
SCIP_DOMCHGBOUND domchgbound
Definition: struct_var.h:153
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3379
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip_sol.c:2304
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_NODE * parent
Definition: struct_tree.h:148
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
Definition: lp.c:16975
static const SCIP_Real scalars[]
Definition: lp.c:5736
#define SCIP_DECL_SORTPTRCOMP(x)
Definition: type_misc.h:179
#define BMSfreeMemoryNull(ptr)
Definition: memory.h:139
SCIP_SET * set
Definition: struct_scip.h:63
public methods for message output
SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6276
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3263
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:17370
#define SCIPdebugSolDisable(scip)
Definition: debug.h:284
SCIP_NODETYPE SCIPnodeGetType(SCIP_NODE *node)
Definition: tree.c:7422
#define SCIP_Real
Definition: def.h:177
enum SCIP_Stage SCIP_STAGE
Definition: type_set.h:50
SCIP_RETCODE SCIPincludeProp(SCIP *scip, const char *name, const char *desc, int priority, int freq, SCIP_Bool delay, SCIP_PROPTIMING timingmask, int presolpriority, int presolmaxrounds, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_PROPCOPY((*propcopy)), SCIP_DECL_PROPFREE((*propfree)), SCIP_DECL_PROPINIT((*propinit)), SCIP_DECL_PROPEXIT((*propexit)), SCIP_DECL_PROPINITPRE((*propinitpre)), SCIP_DECL_PROPEXITPRE((*propexitpre)), SCIP_DECL_PROPINITSOL((*propinitsol)), SCIP_DECL_PROPEXITSOL((*propexitsol)), SCIP_DECL_PROPPRESOL((*proppresol)), SCIP_DECL_PROPEXEC((*propexec)), SCIP_DECL_PROPRESPROP((*propresprop)), SCIP_PROPDATA *propdata)
Definition: scip_prop.c:53
SCIP_DEBUGSOLDATA * SCIPsetGetDebugSolData(SCIP_SET *set)
Definition: set.c:5957
SCIP_NLP * nlp
Definition: struct_scip.h:83
#define SCIPwithDebugSol(void)
Definition: debug.h:286
#define BMSallocMemory(ptr)
Definition: memory.h:111
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:120
void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
int SCIPvarGetNUses(SCIP_VAR *var)
Definition: var.c:17261
#define SCIPdebugAddSolVal(scip, var, val)
Definition: debug.h:280
SCIP_Bool SCIPsetIsFeasGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:6664
SCIP_TREE * tree
Definition: struct_scip.h:86
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:17416
SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
Definition: scip_prob.c:1223
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1254
#define SCIPdebugSolIsEnabled(scip)
Definition: debug.h:285
SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
Definition: set.c:2982
int SCIPconsGetActiveDepth(SCIP_CONS *cons)
Definition: cons.c:8135
SCIP_Real SCIPprobExternObjval(SCIP_PROB *transprob, SCIP_PROB *origprob, SCIP_SET *set, SCIP_Real objval)
Definition: prob.c:2107
SCIP_Real SCIPtreeGetLowerbound(SCIP_TREE *tree, SCIP_SET *set)
Definition: tree.c:7245
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
Definition: var.c:17393
SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
Definition: lpi_clp.cpp:1762
SCIP_BOUNDTYPE SCIPbdchginfoGetBoundtype(SCIP_BDCHGINFO *bdchginfo)
Definition: var.c:18532
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:430
int SCIPfclose(SCIP_FILE *fp)
Definition: fileio.c:223
SCIP_LP * lp
Definition: struct_scip.h:82
#define SCIP_ALLOC(x)
Definition: def.h:395
#define SCIPdebugSolEnable(scip)
Definition: debug.h:283
#define SCIPABORT()
Definition: def.h:356
SCIP_Bool SCIPvarIsDeleted(SCIP_VAR *var)
Definition: var.c:17472
SCIP_Bool SCIPisInRestart(SCIP *scip)
Definition: scip_solve.c:3677
#define SCIPdebugFreeSol(set)
Definition: debug.h:261
SCIP callable library.
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
Definition: var.c:17406
memory allocation routines