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