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