Scippy

SCIP

Solving Constraint Integer Programs

debug.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2015 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file debug.c
17  * @brief methods for debugging
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <stdio.h>
24 #include <string.h>
25 #include <assert.h>
26 
27 #include "scip/def.h"
28 #include "blockmemshell/memory.h"
29 #include "scip/set.h"
30 #include "scip/lp.h"
31 #include "scip/var.h"
32 #include "scip/prob.h"
33 #include "scip/tree.h"
34 #include "scip/scip.h"
35 #include "scip/debug.h"
36 #include "scip/pub_message.h"
37 #include "scip/pub_misc.h"
38 #include "scip/struct_scip.h"
39 
40 #ifdef SCIP_DEBUG_SOLUTION
41 
42 #define SCIP_HASHSIZE_DEBUG 131101 /**< minimum size of hash map for storing whether a solution is valid for the node */
43 
44 static char** solnames = NULL;
45 static SCIP_Real* solvals = NULL;
46 static int nsolvals = 0;
47 static int solsize = 0;
48 static SCIP_SET* mainscipset = NULL;
49 static SCIP_SOL* debugsol = NULL;
50 static SCIP_STAGE debugsolstage = SCIP_STAGE_INIT;
51 static SCIP_HASHMAP* solinnode = NULL; /**< maps nodes to bools, storing whether the solution is valid for the node */
52 static SCIP_Bool falseptr = FALSE;
53 static SCIP_Bool trueptr = TRUE;
54 static SCIP_Bool solisachieved = FALSE; /**< means if current best solution is better than the given debug solution */
55 static SCIP_Real debugsolval = 0.0; /**< objective value for debug solution */
56 static SCIP_Bool debugsoldisabled = FALSE; /**< flag indicating if debugging of solution was disabled or not */
57 
58 
59 #ifdef SCIP_MORE_DEBUG
60 /** comparison method for sorting variables w.r.t. to their name */
61 static
62 SCIP_DECL_SORTPTRCOMP(sortVarsAfterNames)
63 {
64  return strcmp(SCIPvarGetName((SCIP_VAR*)elem1), SCIPvarGetName((SCIP_VAR*)elem2));
65 }
66 #endif
67 
68 /** returns whether the settings are the one of the SCIP instance that is debugged */
69 static
70 SCIP_Bool isMainscipset(
71  SCIP_SET* set /**< global SCIP settings */
72  )
73 {
74  return (mainscipset == NULL || mainscipset == set);
75 }
76 
77 /** reads solution from given file into given arrays */
78 static
79 SCIP_RETCODE readSolfile(
80  SCIP_SET* set, /**< global SCIP settings */
81  const char* solfilename, /**< solution filename to read */
82  char*** names, /**< pointer to store the array of variable names */
83  SCIP_Real** vals, /**< pointer to store the array of solution values */
84  int* nvals, /**< pointer to store the number of non-zero elements */
85  int* valssize /**< pointer to store the length of the variable names and solution values arrays */
86  )
87 {
88  SCIP_VAR** vars;
89  SCIP_Real* solvalues;
90  FILE* file;
91  int nonvalues;
92  int nfound;
93  int i;
94 
95  assert(set != NULL);
96  assert(solfilename != NULL);
97  assert(names != NULL);
98  assert(*names == NULL);
99  assert(vals != NULL);
100  assert(*vals == NULL);
101  assert(nvals != NULL);
102  assert(valssize != NULL);
103 
104  printf("***** debug: reading solution file <%s>\n", solfilename);
105 
106  /* open solution file */
107  file = fopen(solfilename, "r");
108  if( file == NULL )
109  {
110  SCIPerrorMessage("cannot open solution file <%s> specified in scip/debug.h\n", solfilename);
111  SCIPprintSysError(solfilename);
112  return SCIP_NOFILE;
113  }
114 
115  /* read data */
116  nonvalues = 0;
117  *valssize = 0;
118 
119  while( !feof(file) )
120  {
121  char buf[SCIP_MAXSTRLEN];
122  char name[SCIP_MAXSTRLEN];
123  char objstring[SCIP_MAXSTRLEN];
124  SCIP_Real val;
125  int nread;
126 
127  if( fgets(buf, SCIP_MAXSTRLEN, file) == NULL )
128  {
129  if( feof(file) )
130  break;
131  else
132  return SCIP_READERROR;
133  }
134 
135  /* there are some lines which may preceed the solution information */
136  if( strncasecmp(buf, "solution status:", 16) == 0 || strncasecmp(buf, "objective value:", 16) == 0 ||
137  strncasecmp(buf, "Log started", 11) == 0 || strncasecmp(buf, "Variable Name", 13) == 0 ||
138  strncasecmp(buf, "All other variables", 19) == 0 || strncasecmp(buf, "\n", 1) == 0 ||
139  strncasecmp(buf, "NAME", 4) == 0 || strncasecmp(buf, "ENDATA", 6) == 0 ) /* allow parsing of SOL-format on the MIPLIB 2003 pages */
140  {
141  ++nonvalues;
142  continue;
143  }
144 
145  nread = sscanf(buf, "%s %lf %s\n", name, &val, objstring);
146  if( nread < 2 )
147  {
148  printf("invalid input line %d in solution file <%s>: <%s>\n", *nvals + nonvalues, SCIP_DEBUG_SOLUTION, name);
149  fclose(file);
150  return SCIP_READERROR;
151  }
152 
153  /* allocate memory */
154  if( *nvals >= *valssize )
155  {
156  *valssize = MAX(2 * *valssize, (*nvals)+1);
157  SCIP_ALLOC( BMSreallocMemoryArray(names, *valssize) );
158  SCIP_ALLOC( BMSreallocMemoryArray(vals, *valssize) );
159  }
160  assert(*nvals < *valssize);
161 
162  /* store solution value in sorted list */
163  for( i = *nvals; i > 0 && strcmp(name, (*names)[i-1]) < 0; --i )
164  {
165  (*names)[i] = (*names)[i-1];
166  (*vals)[i] = (*vals)[i-1];
167  }
168  SCIP_ALLOC( BMSduplicateMemoryArray(&(*names)[i], name, strlen(name)+1) );
169  SCIPdebugMessage("found variable <%s>: value <%g>\n", (*names)[i], val);
170  (*vals)[i] = val;
171  (*nvals)++;
172  }
173 
174  /* get memory for SCIP solution */
175  SCIP_ALLOC( BMSallocMemoryArray(&vars, *valssize) );
176  SCIP_ALLOC( BMSallocMemoryArray(&solvalues, *valssize) );
177 
178  debugsolval = 0.0;
179  nfound = 0;
180 
181  /* get solution value */
182  for( i = 0; i < *nvals; ++i)
183  {
184  SCIP_VAR* var;
185  var = SCIPfindVar(set->scip, (*names)[i]);
186  if( var != NULL )
187  {
188  vars[nfound] = var;
189  solvalues[nfound] = (*vals)[i];
190  ++nfound;
191  debugsolval += (*vals)[i] * SCIPvarGetObj(var);
192  }
193  }
194  SCIPdebugMessage("Debug Solution value is %g.\n", debugsolval);
195 
196 #ifdef SCIP_MORE_DEBUG
197  SCIPsortPtrReal((void**)vars, solvalues, sortVarsAfterNames, nfound);
198 
199  for( i = 0; i < nfound - 1; ++i)
200  {
201  assert(strcmp(SCIPvarGetName(vars[i]), SCIPvarGetName(vars[i + 1])) != 0);
202  }
203 #endif
204 
205  if( debugsol == NULL )
206  {
207  /* create SCIP solution */
208  SCIP_CALL( SCIPcreateOrigSol(set->scip, &debugsol, NULL) );
209  debugsolstage = SCIPgetStage(set->scip);
210 
211  /* set SCIP solution values */
212  SCIP_CALL( SCIPsetSolVals(set->scip, debugsol, nfound, vars, solvalues ) );
213  }
214 
215  BMSfreeMemoryArray(&vars);
216  BMSfreeMemoryArray(&solvalues);
217 
218  /* close file */
219  fclose(file);
220 
221  printf("***** debug: read %d non-zero entries (%d variables found)\n", *nvals, nfound);
222 
223  return SCIP_OKAY;
224 }
225 
226 /** reads feasible solution to check from file */
227 static
228 SCIP_RETCODE readSolution(
229  SCIP_SET* set /**< global SCIP settings */
230  )
231 {
232  assert(set != NULL);
233 
234  if( !isMainscipset(set) || nsolvals > 0 )
235  return SCIP_OKAY;
236 
237  SCIP_CALL( readSolfile(set, SCIP_DEBUG_SOLUTION, &solnames, &solvals, &nsolvals, &solsize) );
238 
239  return SCIP_OKAY;
240 }
241 
242 /** gets value of given variable in debugging solution */
243 static
244 SCIP_RETCODE getSolutionValue(
245  SCIP_SET* set, /**< global SCIP settings */
246  SCIP_VAR* var, /**< variable to get solution value for */
247  SCIP_Real* val /**< pointer to store solution value */
248  )
249 {
250  SCIP_VAR* solvar;
251  SCIP_Real scalar;
252  SCIP_Real constant;
253  const char* name;
254  int left;
255  int right;
256  int middle;
257  int cmp;
258 
259  assert(set != NULL);
260  assert(var != NULL);
261  assert(val != NULL);
262 
263  /* allow retrieving solution values only if referring to the SCIP instance that is debugged */
264  assert(isMainscipset(set));
265 
266  SCIP_CALL( readSolution(set) );
267  SCIPdebugMessage("Now handling variable <%s>, which has status %d, is of type %d, and was deleted: %d, negated: %d, transformed: %d\n",
269  /* ignore deleted variables */
270  if( SCIPvarIsDeleted(var) )
271  {
272  SCIPdebugMessage("**** unknown solution value for deleted variable <%s>\n", SCIPvarGetName(var));
273  *val = SCIP_UNKNOWN;
274  return SCIP_OKAY;
275  }
276  /* retransform variable onto original variable space */
277  solvar = var;
278  scalar = 1.0;
279  constant = 0.0;
280  if( SCIPvarIsNegated(solvar) )
281  {
282  scalar = -1.0;
283  constant = SCIPvarGetNegationConstant(solvar);
284  solvar = SCIPvarGetNegationVar(solvar);
285  }
286  if( SCIPvarIsTransformed(solvar) )
287  {
288  SCIP_CALL( SCIPvarGetOrigvarSum(&solvar, &scalar, &constant) );
289  if( solvar == NULL )
290  {
291  /* if no original counterpart, then maybe someone added a value for the transformed variable, so search for var (or its negation) */
292  SCIPdebugMessage("variable <%s> has no original counterpart\n", SCIPvarGetName(var));
293  solvar = var;
294  scalar = 1.0;
295  constant = 0.0;
296  if( SCIPvarIsNegated(solvar) )
297  {
298  scalar = -1.0;
299  constant = SCIPvarGetNegationConstant(solvar);
300  solvar = SCIPvarGetNegationVar(solvar);
301  }
302  }
303  }
304  /* perform a binary search for the variable */
305  name = SCIPvarGetName(solvar);
306  left = 0;
307  right = nsolvals-1;
308  while( left <= right )
309  {
310  middle = (left+right)/2;
311  cmp = strcmp(name, solnames[middle]);
312  if( cmp < 0 )
313  right = middle-1;
314  else if( cmp > 0 )
315  left = middle+1;
316  else
317  {
318  *val = scalar * solvals[middle] + constant;
319  return SCIP_OKAY;
320  }
321  }
322  *val = constant;
323 
324  if( *val < SCIPvarGetLbGlobal(var) - 1e-06 || *val > SCIPvarGetUbGlobal(var) + 1e-06 )
325  {
326  SCIPmessagePrintWarning(SCIPgetMessagehdlr(set->scip), "invalid solution value %.15g for variable <%s>[%.15g,%.15g]\n",
327  *val, SCIPvarGetName(var), SCIPvarGetLbGlobal(var), SCIPvarGetUbGlobal(var));
328  }
329 
330  return SCIP_OKAY;
331 }
332 
333 /** gets pointer to the debug solution */
334 SCIP_RETCODE SCIPdebugGetSol(
335  SCIP* scip, /**< SCIP data structure */
336  SCIP_SOL** sol /**< buffer to store pointer to the debug solution */
337  )
338 {
339  assert(scip != NULL);
340  assert(sol != NULL);
341 
342  SCIP_CALL( readSolution(scip->set) );
343  if( debugsol == NULL )
344  {
345  *sol = NULL;
346  return SCIP_ERROR;
347  }
348 
349  *sol = debugsol;
350  return SCIP_OKAY;
351 }
352 
353 /** gets value for a variable in the debug solution
354  *
355  * if no value is stored for the variable, gives 0.0
356  */
358  SCIP* scip, /**< SCIP data structure */
359  SCIP_VAR* var, /**< variable for which to get the value */
360  SCIP_Real* val /**< buffer to store solution value */
361  )
362 {
363  SCIP_CALL( getSolutionValue(scip->set, var, val) );
364 
365  return SCIP_OKAY;
366 }
367 
368 /** returns whether the debug solution is worse as the best known solution or if the debug solution was found */
369 static
370 SCIP_Bool debugSolIsAchieved(
371  SCIP_SET* set /**< global SCIP settings */
372  )
373 {
374  SCIP_SOL* bestsol;
375  SCIP* scip;
376 
377  if( solisachieved )
378  return TRUE;
379 
380  assert(set != NULL);
381 
382  scip = set->scip;
383  assert(scip != NULL);
384 
385  bestsol = SCIPgetBestSol(scip);
386 
387  if( bestsol != NULL )
388  {
389  SCIP_Real solvalue;
390 
391  /* don't check solution while in problem creation stage */
392  if( SCIPsetGetStage(set) == SCIP_STAGE_PROBLEM )
393  return TRUE;
394 
395  solvalue = SCIPgetSolOrigObj(scip, bestsol);
396 
397  /* make sure a debug solution has been read, so we do not compare against the initial debugsolval == 0 */
398  SCIP_CALL( readSolution(set) );
399 
400  if( (SCIPgetObjsense(scip) == SCIP_OBJSENSE_MINIMIZE && SCIPsetIsLE(set, solvalue, debugsolval)) || (SCIPgetObjsense(scip) == SCIP_OBJSENSE_MAXIMIZE && SCIPsetIsGE(set, solvalue, debugsolval)) )
401  solisachieved = TRUE;
402  }
403 
404  return solisachieved;
405 }
406 
407 /** returns whether the solution is contained in node's subproblem */
408 static
409 SCIP_RETCODE isSolutionInNode(
410  BMS_BLKMEM* blkmem, /**< block memory */
411  SCIP_SET* set, /**< global SCIP settings */
412  SCIP_NODE* node, /**< local node where this bound change was applied */
413  SCIP_Bool* solcontained /**< pointer to store whether the solution is contained in node's subproblem */
414  )
415 {
416  SCIP_Bool* boolptr;
417 
418  assert(set != NULL);
419  assert(blkmem != NULL);
420  assert(node != NULL);
421  assert(solcontained != NULL);
422 
423  /* check if we are in the original problem and not in a sub MIP */
424  if( !isMainscipset(set) )
425  {
426  *solcontained = FALSE;
427  return SCIP_OKAY;
428  }
429 
430  /* generate the hashmap */
431  if( solinnode == NULL )
432  {
433  SCIP_CALL( SCIPhashmapCreate(&solinnode, blkmem, SCIPcalcHashtableSize(SCIP_HASHSIZE_DEBUG)) );
434  }
435 
436  /* check, whether we know already whether the solution is contained in the given node */
437  boolptr = (SCIP_Bool*)SCIPhashmapGetImage(solinnode, (void*)node);
438  if( boolptr != NULL )
439  {
440  if( boolptr != &falseptr && boolptr != &trueptr )
441  {
442  SCIPerrorMessage("wrong value in node hashmap\n");
443  SCIPABORT();
444  return SCIP_ERROR;
445  }
446  *solcontained = *boolptr;
447  return SCIP_OKAY;
448  }
449 
450  /* if the solution is not contained in the parent of the node, it cannot be contained in the current node */
451  *solcontained = TRUE;
452  if( node->parent != NULL )
453  {
454  SCIP_CALL( isSolutionInNode(blkmem, set, node->parent, solcontained) );
455  }
456 
457  if( *solcontained )
458  {
459  /* check whether the bound changes at the current node remove the debugging solution from the subproblem */
460  if( node->domchg != NULL )
461  {
462  SCIP_DOMCHGBOUND* domchgbound;
463  SCIP_BOUNDCHG* boundchgs;
464  int i;
465 
466  domchgbound = &node->domchg->domchgbound;
467  boundchgs = domchgbound->boundchgs;
468  for( i = 0; i < (int)domchgbound->nboundchgs && *solcontained; ++i )
469  {
470  SCIP_Real varsol;
471 
472  /* get solution value of variable */
473  SCIP_CALL( getSolutionValue(set, boundchgs[i].var, &varsol) );
474 
475  if( varsol != SCIP_UNKNOWN ) /*lint !e777*/
476  {
477  /* compare the bound change with the solution value */
478  if( SCIPboundchgGetBoundtype(&boundchgs[i]) == SCIP_BOUNDTYPE_LOWER )
479  *solcontained = SCIPsetIsFeasGE(set, varsol, boundchgs[i].newbound);
480  else
481  *solcontained = SCIPsetIsFeasLE(set, varsol, boundchgs[i].newbound);
482 
483  if( !(*solcontained) && SCIPboundchgGetBoundchgtype(&boundchgs[i]) != SCIP_BOUNDCHGTYPE_BRANCHING )
484  {
485  SCIPerrorMessage("debugging solution was cut off in local node %p at depth %d by inference <%s>[%.15g] %s %.15g\n",
486  node, SCIPnodeGetDepth(node), SCIPvarGetName(boundchgs[i].var), varsol,
487  SCIPboundchgGetBoundtype(&boundchgs[i]) == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", boundchgs[i].newbound);
488  SCIPABORT();
489  }
490  }
491  else if( SCIPboundchgGetBoundchgtype(&boundchgs[i]) == SCIP_BOUNDCHGTYPE_BRANCHING )
492  {
493  /* we branched on a variable were we don't know the solution: no debugging can be applied in this subtree */
494  *solcontained = FALSE;
495  }
496  }
497  }
498  }
499 
500  /* remember the status of the current node */
501  SCIP_CALL( SCIPhashmapSetImage(solinnode, (void*)node, *solcontained ? (void*)(&trueptr) : (void*)(&falseptr)) );
502 
503  return SCIP_OKAY;
504 }
505 
506 /** frees all debugging solution data*/
508  SCIP_SET* set /**< global SCIP settings */
509  )
510 {
511  int s;
512 
513  assert(set != NULL);
514 
515  /* check if we are in the original problem and not in a sub MIP */
516  if( !isMainscipset(set) )
517  return SCIP_OKAY;
518 
519  for( s = nsolvals - 1; s >= 0; --s )
520  BMSfreeMemoryArrayNull(&solnames[s]);
521 
522  BMSfreeMemoryArrayNull(&solnames);
523  BMSfreeMemoryArrayNull(&solvals);
524 
525  nsolvals = 0;
526  debugsolval = 0.0;
527  mainscipset = NULL;
528  solisachieved = FALSE;
529 
530  if( solinnode != NULL)
531  SCIPhashmapFree(&solinnode);
532 
533  if( debugsol != NULL && ((SCIPgetStage(set->scip) > SCIP_STAGE_PROBLEM && debugsolstage > SCIP_STAGE_PROBLEM)
534  || (SCIPgetStage(set->scip) <= SCIP_STAGE_PROBLEM && debugsolstage <= SCIP_STAGE_PROBLEM)) )
535  {
536  SCIP_CALL( SCIPfreeSol(set->scip, &debugsol) );
537  }
538 
539  return SCIP_OKAY;
540 }
541 
542 /** checks for validity of the debugging solution in given constraints */
544  SCIP* scip, /**< SCIP data structure */
545  SCIP_CONS** conss, /**< constraints to check for validity */
546  int nconss /**< number of given constraints */
547  )
548 {
549  SCIP_RESULT result;
550  int c;
551 
552  assert(conss != NULL || nconss == 0);
553  assert(debugsol != NULL);
554 
555  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
556  if( debugsoldisabled )
557  return SCIP_OKAY;
558 
559  /* check if we are in the original problem and not in a sub MIP */
560  if( !isMainscipset(scip->set) )
561  return SCIP_OKAY;
562 
563  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug
564  * solution
565  */
566  if( debugSolIsAchieved(scip->set) )
567  return SCIP_OKAY;
568 
569  assert(scip->set == mainscipset);
570 
571  result = SCIP_FEASIBLE;
572 
573  /* checking each given constraint against the debugging solution */
574  for( c = nconss - 1; c >= 0; --c )
575  {
576  assert(conss[c] != NULL);
577 
578  if( !SCIPconsIsActive(conss[c]) )
579  continue;
580 
581  assert(SCIPconsGetActiveDepth(conss[c]) <= SCIPgetDepth(scip));
582 
583  /* if the cons is only locally valid, check whether the debugging solution is contained in the local subproblem */
584  if( SCIPconsIsLocal(conss[c]) )
585  {
586  SCIP_Bool solcontained;
587 
588  SCIP_CALL( isSolutionInNode(SCIPblkmem(scip), scip->set, SCIPgetCurrentNode(scip), &solcontained) );
589  if( !solcontained )
590  return SCIP_OKAY;
591  }
592 
593  SCIP_CALL( SCIPcheckCons(scip, conss[c], debugsol, TRUE, TRUE, TRUE, &result) );
594 
595  SCIPdebugMessage(" -> checking of constraint %s returned result <%d>\n", SCIPconsGetName(conss[c]), result);
596 
597  if( result != SCIP_FEASIBLE )
598  {
599  SCIPerrorMessage("constraint %s violates the debugging solution\n", SCIPconsGetName(conss[c]));
600  SCIPABORT();
601  }
602  }
603 
604  return SCIP_OKAY;
605 }
606 
607 /** checks whether given row is valid for the debugging solution */
609  SCIP_SET* set, /**< global SCIP settings */
610  SCIP_ROW* row /**< row to check for validity */
611  )
612 {
613  SCIP_COL** cols;
614  SCIP_Real* vals;
615  SCIP_Real lhs;
616  SCIP_Real rhs;
617  int nnonz;
618  int i;
619  SCIP_Real minactivity;
620  SCIP_Real maxactivity;
621  SCIP_Real solval;
622 
623  assert(set != NULL);
624  assert(row != NULL);
625 
626  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
627  if( debugsoldisabled )
628  return SCIP_OKAY;
629 
630  /* check if we are in the original problem and not in a sub MIP */
631  if( !isMainscipset(set) )
632  return SCIP_OKAY;
633 
634  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
635  if( debugSolIsAchieved(set) )
636  return SCIP_OKAY;
637 
638  /* if the row is only locally valid, check whether the debugging solution is contained in the local subproblem */
639  if( SCIProwIsLocal(row) )
640  {
641  SCIP_Bool solcontained;
642 
643  SCIP_CALL( isSolutionInNode(SCIPblkmem(set->scip), set, SCIPgetCurrentNode(set->scip), &solcontained) );
644  if( !solcontained )
645  return SCIP_OKAY;
646  }
647 
648  cols = SCIProwGetCols(row);
649  vals = SCIProwGetVals(row);
650  nnonz = SCIProwGetNNonz(row);
651  lhs = SCIProwGetLhs(row);
652  rhs = SCIProwGetRhs(row);
653 
654  /* calculate row's activity on debugging solution */
655  minactivity = SCIProwGetConstant(row);
656  maxactivity = minactivity;
657  for( i = 0; i < nnonz; ++i )
658  {
659  SCIP_VAR* var;
660 
661  /* get solution value of variable in debugging solution */
662  var = SCIPcolGetVar(cols[i]);
663  SCIP_CALL( getSolutionValue(set, var, &solval) );
664 
665  if( solval != SCIP_UNKNOWN ) /*lint !e777*/
666  {
667  minactivity += vals[i] * solval;
668  maxactivity += vals[i] * solval;
669  }
670  else if( vals[i] > 0.0 )
671  {
672  minactivity += vals[i] * SCIPvarGetLbGlobal(var);
673  maxactivity += vals[i] * SCIPvarGetUbGlobal(var);
674  }
675  else if( vals[i] < 0.0 )
676  {
677  minactivity += vals[i] * SCIPvarGetUbGlobal(var);
678  maxactivity += vals[i] * SCIPvarGetLbGlobal(var);
679  }
680  }
681  SCIPdebugMessage("debugging solution on row <%s>: %g <= [%g,%g] <= %g\n",
682  SCIProwGetName(row), lhs, minactivity, maxactivity, rhs);
683 
684  /* check row for violation */
685  if( SCIPsetIsFeasLT(set, maxactivity, lhs) || SCIPsetIsFeasGT(set, minactivity, rhs) )
686  {
687  printf("***** debug: row <%s> violates debugging solution (lhs=%.15g, rhs=%.15g, activity=[%.15g,%.15g], local=%d)\n",
688  SCIProwGetName(row), lhs, rhs, minactivity, maxactivity, SCIProwIsLocal(row));
690 
691  /* output row with solution values */
692  printf("\n\n");
693  printf("***** debug: violated row <%s>:\n", SCIProwGetName(row));
694  printf(" %.15g <= %.15g", lhs, SCIProwGetConstant(row));
695  for( i = 0; i < nnonz; ++i )
696  {
697  /* get solution value of variable in debugging solution */
698  SCIP_CALL( getSolutionValue(set, SCIPcolGetVar(cols[i]), &solval) );
699  printf(" %+.15g<%s>[%.15g]", vals[i], SCIPvarGetName(SCIPcolGetVar(cols[i])), solval);
700  }
701  printf(" <= %.15g\n", rhs);
702 
703  SCIPABORT();
704  }
705 
706  return SCIP_OKAY;
707 }
708 
709 /** checks whether given global lower bound is valid for the debugging solution */
711  SCIP* scip, /**< SCIP data structure */
712  SCIP_VAR* var, /**< problem variable */
713  SCIP_Real lb /**< lower bound */
714  )
715 {
716  SCIP_Real varsol;
717 
718  assert(scip != NULL);
719  assert(var != NULL);
720 
721  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
722  if( debugsoldisabled )
723  return SCIP_OKAY;
724 
725  /* check if we are in the original problem and not in a sub MIP */
726  if( !isMainscipset(scip->set) )
727  return SCIP_OKAY;
728 
729  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
730  if( debugSolIsAchieved(scip->set) )
731  return SCIP_OKAY;
732 
733  /* get solution value of variable */
734  SCIP_CALL( getSolutionValue(scip->set, var, &varsol) );
735  SCIPdebugMessage("debugging solution on lower bound of <%s>[%g] >= %g\n", SCIPvarGetName(var), varsol, lb);
736 
737  /* check validity of debugging solution */
738  if( varsol != SCIP_UNKNOWN && SCIPisFeasLT(scip, varsol, lb) ) /*lint !e777*/
739  {
740  SCIPerrorMessage("invalid global lower bound: <%s>[%.15g] >= %.15g\n", SCIPvarGetName(var), varsol, lb);
741  SCIPABORT();
742  }
743 
744  return SCIP_OKAY;
745 }
746 
747 /** checks whether given global upper bound is valid for the debugging solution */
749  SCIP* scip, /**< SCIP data structure */
750  SCIP_VAR* var, /**< problem variable */
751  SCIP_Real ub /**< upper bound */
752  )
753 {
754  SCIP_Real varsol;
755 
756  assert(scip != NULL);
757  assert(var != NULL);
758 
759  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
760  if( debugsoldisabled )
761  return SCIP_OKAY;
762 
763  /* check if we are in the original problem and not in a sub MIP */
764  if( !isMainscipset(scip->set) )
765  return SCIP_OKAY;
766 
767  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
768  if( debugSolIsAchieved(scip->set) )
769  return SCIP_OKAY;
770 
771  /* get solution value of variable */
772  SCIP_CALL( getSolutionValue(scip->set, var, &varsol) );
773  SCIPdebugMessage("debugging solution on upper bound of <%s>[%g] <= %g\n", SCIPvarGetName(var), varsol, ub);
774 
775  /* check validity of debugging solution */
776  if( varsol != SCIP_UNKNOWN && SCIPisFeasGT(scip, varsol, ub) ) /*lint !e777*/
777  {
778  SCIPerrorMessage("invalid global upper bound: <%s>[%.15g] <= %.15g\n", SCIPvarGetName(var), varsol, ub);
779  SCIPABORT();
780  }
781 
782  return SCIP_OKAY;
783 }
784 
785 /** checks whether given local bound implication is valid for the debugging solution */
787  BMS_BLKMEM* blkmem, /**< block memory */
788  SCIP_SET* set, /**< global SCIP settings */
789  SCIP_NODE* node, /**< local node where this bound change was applied */
790  SCIP_VAR* var, /**< problem variable */
791  SCIP_Real newbound, /**< new value for bound */
792  SCIP_BOUNDTYPE boundtype /**< type of bound: lower or upper bound */
793  )
794 {
795  SCIP_Real varsol;
796  SCIP_Bool solcontained;
797 
798  assert(set != NULL);
799  assert(blkmem != NULL);
800  assert(node != NULL);
801  assert(var != NULL);
802 
803  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
804  if( debugsoldisabled )
805  return SCIP_OKAY;
806 
807  /* in case we are in probing or diving we have to avoid checking the solution */
808  if( SCIPlpDiving(set->scip->lp) || SCIPtreeProbing(set->scip->tree) )
809  return SCIP_OKAY;
810 
811  /* check if we are in the original problem and not in a sub MIP */
812  if( !isMainscipset(set) )
813  return SCIP_OKAY;
814 
815  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
816  if( debugSolIsAchieved(set) )
817  return SCIP_OKAY;
818 
819  /* check whether the debugging solution is contained in the local subproblem */
820  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
821  if( !solcontained )
822  return SCIP_OKAY;
823 
824  /* get solution value of variable */
825  SCIP_CALL( getSolutionValue(set, var, &varsol) );
826 
827  /* check validity of debugging solution */
828  if( varsol != SCIP_UNKNOWN ) /*lint !e777*/
829  {
830  if( boundtype == SCIP_BOUNDTYPE_LOWER && SCIPsetIsFeasLT(set, varsol, newbound) )
831  {
832  SCIPerrorMessage("invalid local lower bound implication: <%s>[%.15g] >= %.15g\n", SCIPvarGetName(var), varsol, newbound);
833  SCIPABORT();
834  }
835  if( boundtype == SCIP_BOUNDTYPE_UPPER && SCIPsetIsFeasGT(set, varsol, newbound) )
836  {
837  SCIPerrorMessage("invalid local upper bound implication: <%s>[%.15g] <= %.15g\n", SCIPvarGetName(var), varsol, newbound);
838  SCIPABORT();
839  }
840  }
841 
842  return SCIP_OKAY;
843 }
844 
845 /** informs solution debugger, that the given node will be freed */
847  BMS_BLKMEM* blkmem, /**< block memory */
848  SCIP_SET* set, /**< global SCIP settings */
849  SCIP_NODE* node /**< node that will be freed */
850  )
851 {
852  assert(set != NULL);
853  assert(blkmem != NULL);
854  assert(node != NULL);
855 
856  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
857  if( debugsoldisabled )
858  return SCIP_OKAY;
859 
860  /* check if we are in the original problem and not in a sub MIP */
861  if( !isMainscipset(set) )
862  return SCIP_OKAY;
863 
864  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
865  if( debugSolIsAchieved(set) )
866  return SCIP_OKAY;
867 
868  /* check if a solution will be cutoff in tree */
870  {
871  SCIP_Bool solisinnode;
872 
873  solisinnode = FALSE;
874 
875  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solisinnode) );
876  /* wrong node will be cutoff */
877  if( solisinnode )
878  {
879  SCIPerrorMessage("debugging solution was cut off in local node #%" SCIP_LONGINT_FORMAT " (%p) at depth %d\n",
880  node->number, node, SCIPnodeGetDepth(node));
881  SCIPABORT();
882  }
883  }
884 
885  /* remove node from the hash map */
886  if( solinnode != NULL )
887  {
888  SCIP_CALL( SCIPhashmapRemove(solinnode, (void*)node) );
889  }
890 
891  return SCIP_OKAY;
892 }
893 
894 /** checks whether given variable bound is valid for the debugging solution */
896  SCIP_SET* set, /**< global SCIP settings */
897  SCIP_VAR* var, /**< problem variable x in x <= b*z + d or x >= b*z + d */
898  SCIP_BOUNDTYPE vbtype, /**< type of variable bound (LOWER or UPPER) */
899  SCIP_VAR* vbvar, /**< variable z in x <= b*z + d or x >= b*z + d */
900  SCIP_Real vbcoef, /**< coefficient b in x <= b*z + d or x >= b*z + d */
901  SCIP_Real vbconstant /**< constant d in x <= b*z + d or x >= b*z + d */
902  )
903 {
904  SCIP_Real varsol;
905  SCIP_Real vbvarsol;
906  SCIP_Real vb;
907 
908  assert(set != NULL);
909  assert(var != NULL);
910 
911  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
912  if( debugsoldisabled )
913  return SCIP_OKAY;
914 
915  /* check if we are in the original problem and not in a sub MIP */
916  if( !isMainscipset(set) )
917  return SCIP_OKAY;
918 
919  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
920  if( debugSolIsAchieved(set) )
921  return SCIP_OKAY;
922 
923  /* get solution value of variables */
924  SCIP_CALL( getSolutionValue(set, var, &varsol) );
925  SCIP_CALL( getSolutionValue(set, vbvar, &vbvarsol) );
926 
927  /* check validity of debugging solution */
928  if( varsol != SCIP_UNKNOWN && vbvarsol != SCIP_UNKNOWN ) /*lint !e777*/
929  {
930  vb = vbcoef * vbvarsol + vbconstant;
931  if( (vbtype == SCIP_BOUNDTYPE_LOWER && SCIPsetIsFeasLT(set, varsol, vb))
932  || (vbtype == SCIP_BOUNDTYPE_UPPER && SCIPsetIsFeasGT(set, varsol, vb)) )
933  {
934  SCIPerrorMessage("invalid variable bound: <%s>[%.15g] %s %.15g<%s>[%.15g] %+.15g\n",
935  SCIPvarGetName(var), varsol, vbtype == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=", vbcoef,
936  SCIPvarGetName(vbvar), vbvarsol, vbconstant);
937  SCIPABORT();
938  }
939  }
940 
941  return SCIP_OKAY;
942 }
943 
944 /** checks whether given implication is valid for the debugging solution */
946  SCIP_SET* set, /**< global SCIP settings */
947  SCIP_VAR* var, /**< problem variable */
948  SCIP_Bool varfixing, /**< FALSE if y should be added in implications for x == 0, TRUE for x == 1 */
949  SCIP_VAR* implvar, /**< variable y in implication y <= b or y >= b */
950  SCIP_BOUNDTYPE impltype, /**< type of implication y <= b (SCIP_BOUNDTYPE_UPPER) or y >= b (SCIP_BOUNDTYPE_LOWER) */
951  SCIP_Real implbound /**< bound b in implication y <= b or y >= b */
952  )
953 {
954  SCIP_Real solval;
955 
956  assert(set != NULL);
957  assert(var != NULL);
958  assert(SCIPvarGetType(var) == SCIP_VARTYPE_BINARY);
959 
960  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
961  if( debugsoldisabled )
962  return SCIP_OKAY;
963 
964  /* check if we are in the original problem and not in a sub MIP */
965  if( !isMainscipset(set) )
966  return SCIP_OKAY;
967 
968  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
969  if( debugSolIsAchieved(set) )
970  return SCIP_OKAY;
971 
972  /* get solution value of variable */
973  SCIP_CALL( getSolutionValue(set, var, &solval) );
974  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
975  return SCIP_OKAY;
976  assert(SCIPsetIsFeasZero(set, solval) || SCIPsetIsFeasEQ(set, solval, 1.0));
977 
978  /* check, whether the implication applies for the debugging solution */
979  if( (solval > 0.5) != varfixing )
980  return SCIP_OKAY;
981 
982  /* get solution value of implied variable */
983  SCIP_CALL( getSolutionValue(set, implvar, &solval) );
984  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
985  return SCIP_OKAY;
986 
987  if( impltype == SCIP_BOUNDTYPE_LOWER )
988  {
989  if( SCIPsetIsFeasLT(set, solval, implbound) )
990  {
991  SCIPerrorMessage("invalid implication <%s> == %d -> <%s> >= %.15g (variable has value %.15g in solution)\n",
992  SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
993  SCIPABORT();
994  }
995  }
996  else
997  {
998  if( SCIPsetIsFeasGT(set, solval, implbound) )
999  {
1000  SCIPerrorMessage("invalid implication <%s> == %d -> <%s> <= %.15g (variable has value %.15g in solution)\n",
1001  SCIPvarGetName(var), varfixing, SCIPvarGetName(implvar), implbound, solval);
1002  SCIPABORT();
1003  }
1004  }
1005 
1006  return SCIP_OKAY;
1007 }
1008 
1009 /** check whether given clique is valid for the debugging solution */
1011  SCIP_SET* set, /**< global SCIP settings */
1012  SCIP_VAR** vars, /**< binary variables in the clique: at most one can be set to the given value */
1013  SCIP_Bool* values, /**< values of the variables in the clique; NULL to use TRUE for all vars */
1014  int nvars /**< number of variables in the clique */
1015  )
1016 {
1017  SCIP_Real solval;
1018  int pos1;
1019  int pos2;
1020  int v;
1021 
1022  assert(set != NULL);
1023  assert(vars != NULL);
1024 
1025  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1026  if( debugsoldisabled )
1027  return SCIP_OKAY;
1028 
1029  /* check if we are in the original problem and not in a sub MIP */
1030  if( !isMainscipset(set) )
1031  return SCIP_OKAY;
1032 
1033  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1034  if( debugSolIsAchieved(set) )
1035  return SCIP_OKAY;
1036 
1037  pos1 = -1;
1038  pos2 = -1;
1039 
1040  for( v = 0; v < nvars; ++v )
1041  {
1042  assert(vars[v] != NULL);
1043  assert(SCIPvarIsBinary(vars[v]));
1044 
1045  /* get solution value of variable */
1046  SCIP_CALL( getSolutionValue(set, vars[v], &solval) );
1047 
1048  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1049  continue;
1050 
1051  assert(SCIPsetIsFeasZero(set, solval) || SCIPsetIsFeasEQ(set, solval, 1.0));
1052 
1053  /* negated solution value if negated variable is in clique */
1054  if( values != NULL && values[v] == 0 )
1055  solval = 1.0 - solval;
1056 
1057  if( SCIPsetIsFeasEQ(set, solval, 1.0) )
1058  {
1059  if( pos1 == -1 )
1060  pos1 = v;
1061  else
1062  {
1063  assert(pos2 == -1);
1064  pos2 = v;
1065  break;
1066  }
1067  }
1068  }
1069 
1070  /* print debug message if the clique violates the debugging solution */
1071  if( pos2 != -1 )
1072  {
1073  assert(pos1 != -1);
1074  SCIPerrorMessage("clique violates debugging solution, (at least) variable <%s%s> and variable <%s%s> are both one in the debugging solution\n",
1075  (values == NULL || values[pos1]) ? "" : "~", SCIPvarGetName(vars[pos1]), (values == NULL || values[pos2]) ? "" : "~", SCIPvarGetName(vars[pos2]));
1076  SCIPABORT();
1077  }
1078 
1079  return SCIP_OKAY;
1080 }
1081 
1082 /** check, whether at least one literals is TRUE in the debugging solution */
1083 static
1084 SCIP_Bool debugCheckBdchginfos(
1085  SCIP_SET* set, /**< global SCIP settings */
1086  SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
1087  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
1088  int nbdchginfos /**< number of bound changes in the conflict set */
1089  )
1090 {
1091  SCIP_Real solval;
1092  int i;
1093 
1094  /* check, whether at least one literals is TRUE in the debugging solution */
1095  for( i = 0; i < nbdchginfos; ++i )
1096  {
1097  SCIP_BDCHGINFO* bdchginfo;
1098  SCIP_VAR* var;
1099  SCIP_Real newbound;
1100 
1101  bdchginfo = bdchginfos[i];
1102  assert(bdchginfo != NULL);
1103 
1104  var = SCIPbdchginfoGetVar(bdchginfo);
1105  assert(var != NULL);
1106 
1107  if( relaxedbds != NULL )
1108  newbound = relaxedbds[i];
1109  else
1110  newbound = SCIPbdchginfoGetNewbound(bdchginfo);
1111 
1112  SCIP_CALL( getSolutionValue(set, var, &solval) );
1113 
1114  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1115  return TRUE;
1116 
1118  {
1119  assert(SCIPsetIsLE(set, newbound, SCIPbdchginfoGetNewbound(bdchginfo)));
1120 
1122  {
1123  if( SCIPsetIsLE(set, solval, newbound) )
1124  return TRUE;
1125  }
1126  else
1127  {
1128  if( SCIPsetIsLT(set, solval, newbound) )
1129  return TRUE;
1130  }
1131  }
1132  else
1133  {
1134  assert(SCIPsetIsGE(set, newbound, SCIPbdchginfoGetNewbound(bdchginfo)));
1135 
1137  {
1138  if( SCIPsetIsGE(set, solval, newbound) )
1139  return TRUE;
1140  }
1141  else
1142  {
1143  if( SCIPsetIsGT(set, solval, newbound) )
1144  return TRUE;
1145  }
1146  }
1147  }
1148 
1149  return FALSE;
1150 }
1151 
1152 /** print bound change information */
1153 static
1154 SCIP_RETCODE printBdchginfo(
1155  SCIP_SET* set, /**< global SCIP settings */
1156  SCIP_BDCHGINFO * bdchginfo, /**< bound change information */
1157  SCIP_Real relaxedbd /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
1158  )
1159 {
1160  SCIP_Real solval;
1161 
1162  /* get solution value within the debug solution */
1163  SCIP_CALL( getSolutionValue(set, SCIPbdchginfoGetVar(bdchginfo), &solval) );
1164 
1165  printf(" <%s>[%.15g] %s %g(%g)", SCIPvarGetName(SCIPbdchginfoGetVar(bdchginfo)), solval,
1166  SCIPbdchginfoGetBoundtype(bdchginfo) == SCIP_BOUNDTYPE_LOWER ? ">=" : "<=",
1167  SCIPbdchginfoGetNewbound(bdchginfo), relaxedbd);
1168 
1169  return SCIP_OKAY;
1170 }
1171 
1172 
1173 /** print bound change information */
1174 static
1175 SCIP_RETCODE printBdchginfos(
1176  SCIP_SET* set, /**< global SCIP settings */
1177  SCIP_BDCHGINFO** bdchginfos, /**< bound change information array */
1178  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict, or NULL */
1179  int nbdchginfos /**< number of bound changes in the conflict set */
1180  )
1181 {
1182  int i;
1183 
1184  for( i = 0; i < nbdchginfos; ++i )
1185  {
1186  SCIP_BDCHGINFO* bdchginfo;
1187 
1188  bdchginfo = bdchginfos[i];
1189  assert(bdchginfo != NULL);
1190 
1191  printBdchginfo(set, bdchginfo, relaxedbds != NULL ? relaxedbds[i] : SCIPbdchginfoGetNewbound(bdchginfo));
1192  }
1193 
1194  return SCIP_OKAY;
1195 }
1196 
1197 /** checks whether given conflict is valid for the debugging solution */
1199  BMS_BLKMEM* blkmem, /**< block memory */
1200  SCIP_SET* set, /**< global SCIP settings */
1201  SCIP_NODE* node, /**< node where the conflict clause is added */
1202  SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
1203  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict */
1204  int nbdchginfos /**< number of bound changes in the conflict set */
1205  )
1206 {
1207  SCIP_Bool solcontained;
1208 
1209  assert(set != NULL);
1210  assert(blkmem != NULL);
1211  assert(node != NULL);
1212  assert(nbdchginfos == 0 || bdchginfos != NULL);
1213 
1214  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1215  if( debugsoldisabled )
1216  return SCIP_OKAY;
1217 
1218  /* check if we are in the original problem and not in a sub MIP */
1219  if( !isMainscipset(set) )
1220  return SCIP_OKAY;
1221 
1222  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1223  if( debugSolIsAchieved(set) )
1224  return SCIP_OKAY;
1225 
1226  /* check whether the debugging solution is contained in the local subproblem */
1227  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
1228  if( !solcontained )
1229  return SCIP_OKAY;
1230 
1231  /* check, whether at least one literals is TRUE in the debugging solution */
1232  if( debugCheckBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) )
1233  return SCIP_OKAY;
1234 
1235  SCIPerrorMessage("invalid conflict set:");
1236 
1237  /* print bound changes which are already part of the conflict set */
1238  SCIP_CALL( printBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) );
1239 
1240  printf("\n");
1241  SCIPABORT();
1242 
1243  return SCIP_OKAY; /*lint !e527*/
1244 }
1245 
1246 /** checks whether given conflict graph frontier is valid for the debugging solution */
1248  BMS_BLKMEM* blkmem, /**< block memory */
1249  SCIP_SET* set, /**< global SCIP settings */
1250  SCIP_NODE* node, /**< node where the conflict clause is added */
1251  SCIP_BDCHGINFO* bdchginfo, /**< bound change info which got resolved, or NULL */
1252  SCIP_BDCHGINFO** bdchginfos, /**< bound change informations of the conflict set */
1253  SCIP_Real* relaxedbds, /**< array with relaxed bounds which are efficient to create a valid conflict */
1254  int nbdchginfos, /**< number of bound changes in the conflict set */
1255  SCIP_PQUEUE* bdchgqueue, /**< unprocessed conflict bound changes */
1256  SCIP_PQUEUE* forcedbdchgqueue /**< unprocessed conflict bound changes that must be resolved */
1257  )
1258 {
1259  SCIP_BDCHGINFO** bdchgqueued;
1260  SCIP_BDCHGINFO** forcedbdchgqueued;
1261  SCIP_Bool solcontained;
1262  int nbdchgqueued;
1263  int nforcedbdchgqueued;
1264 
1265  assert(set != NULL);
1266  assert(blkmem != NULL);
1267  assert(node != NULL);
1268  assert(nbdchginfos == 0 || bdchginfos != NULL);
1269 
1270  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1271  if( debugsoldisabled )
1272  return SCIP_OKAY;
1273 
1274  /* check if we are in the original problem and not in a sub MIP */
1275  if( !isMainscipset(set) )
1276  return SCIP_OKAY;
1277 
1278  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1279  if( debugSolIsAchieved(set) )
1280  return SCIP_OKAY;
1281 
1282  /* check whether the debugging solution is contained in the local subproblem */
1283  SCIP_CALL( isSolutionInNode(blkmem, set, node, &solcontained) );
1284  if( !solcontained )
1285  return SCIP_OKAY;
1286 
1287  /* check, whether one literals is TRUE in the debugging solution */
1288  if( debugCheckBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) )
1289  return SCIP_OKAY;
1290 
1291  /* get the elements of the bound change queue */
1292  bdchgqueued = (SCIP_BDCHGINFO**)SCIPpqueueElems(bdchgqueue);
1293  nbdchgqueued = SCIPpqueueNElems(bdchgqueue);
1294 
1295  /* check, whether one literals is TRUE in the debugging solution */
1296  if( debugCheckBdchginfos(set, bdchgqueued, NULL, nbdchgqueued) )
1297  return SCIP_OKAY;
1298 
1299  /* get the elements of the bound change queue */
1300  forcedbdchgqueued = (SCIP_BDCHGINFO**)SCIPpqueueElems(forcedbdchgqueue);
1301  nforcedbdchgqueued = SCIPpqueueNElems(forcedbdchgqueue);
1302 
1303  /* check, whether one literals is TRUE in the debugging solution */
1304  if( debugCheckBdchginfos(set, forcedbdchgqueued, NULL, nforcedbdchgqueued) )
1305  return SCIP_OKAY;
1306 
1307  SCIPerrorMessage("invalid conflict frontier:");
1308 
1309  if( bdchginfo != NULL )
1310  {
1311  printBdchginfo(set, bdchginfo, SCIPbdchginfoGetNewbound(bdchginfo));
1312  printf(" ");
1313  }
1314 
1315  /* print bound changes which are already part of the conflict set */
1316  SCIP_CALL( printBdchginfos(set, bdchginfos, relaxedbds, nbdchginfos) );
1317 
1318  /* print bound changes which are queued */
1319  SCIP_CALL( printBdchginfos(set, bdchgqueued, NULL, nbdchgqueued) );
1320 
1321  /* print bound changes which are queued in the force queue */
1322  SCIP_CALL( printBdchginfos(set, forcedbdchgqueued, NULL, nforcedbdchgqueued) );
1323 
1324  printf("\n");
1325  SCIPABORT();
1326 
1327  return SCIP_OKAY; /*lint !e527*/
1328 }
1329 
1330 /** check whether the debugging solution is valid in the current node */
1332  SCIP* scip, /**< SCIP data structure */
1333  SCIP_Bool* isvalidinsubtree /**< pointer to store whether the solution is valid in the current
1334  * subtree
1335  */
1336  )
1337 {
1338  SCIP_Bool solcontained;
1339 
1340  *isvalidinsubtree = FALSE;
1341 
1342  /* when debugging was disabled the solution is not defined to be not valid in the current subtree */
1343  if( debugsoldisabled )
1344  return SCIP_OKAY;
1345 
1346  /* check if we are in the original problem and not in a sub MIP */
1347  if( !isMainscipset(scip->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(scip->set) )
1352  return SCIP_OKAY;
1353 
1354  /* check whether the debugging solution is contained in the local subproblem */
1355  SCIP_CALL( isSolutionInNode(SCIPblkmem(scip), scip->set, SCIPgetCurrentNode(scip), &solcontained) );
1356 
1357  if( solcontained )
1358  *isvalidinsubtree = TRUE;
1359 
1360  return SCIP_OKAY;
1361 }
1362 
1363 /** set the main SCIP settings pointer */
1365  SCIP_SET* set /**< settings of SCIP instance */
1366  )
1367 {
1368  assert(set != NULL);
1369 
1370  if( mainscipset == NULL )
1371  mainscipset = set;
1372 }
1373 
1374 /** checks whether SCIP data structure is the main SCIP (the one for which debugging is enabled) */
1375 SCIP_Bool SCIPdebugIsMainscip(
1376  SCIP* scip /**< SCIP data structure */
1377  )
1378 {
1379  assert(scip != NULL);
1380 
1381  return isMainscipset(scip->set);
1382 }
1383 
1384 /** enabling solution debugging mechanism */
1385 void SCIPdebugSolEnable(
1386  SCIP* scip /**< SCIP data structure */
1387  )
1388 {
1389  debugsoldisabled = FALSE;
1390 }
1391 
1392 /** disabling solution debugging mechanism */
1393 void SCIPdebugSolDisable(
1394  SCIP* scip /**< SCIP data structure */
1395  )
1396 {
1397  debugsoldisabled = TRUE;
1398 }
1399 
1400 /** check if solution debugging mechanism is enabled */
1402  SCIP* scip /**< SCIP data structure */
1403  )
1404 {
1405  return (!debugsoldisabled);
1406 }
1407 
1408 /** propagator to force finding the debugging solution */
1409 static
1410 SCIP_DECL_PROPEXEC(propExecDebug)
1411 { /*lint --e{715}*/
1412  SCIP_VAR** vars;
1413  int nvars;
1414  int i;
1415 
1416  assert(scip != NULL);
1417  assert(result != NULL);
1418 
1419  *result = SCIP_DIDNOTFIND;
1420 
1421  /* check if we are in the original problem and not in a sub MIP */
1422  if( !isMainscipset(scip->set) )
1423  return SCIP_OKAY;
1424 
1425  if( SCIPgetStage(scip) != SCIP_STAGE_SOLVING )
1426  return SCIP_OKAY;
1427 
1428  /* check if the incumbent solution is at least as good as the debug solution, so we can stop to check the debug solution */
1429  if( debugSolIsAchieved(scip->set) )
1430  return SCIP_OKAY;
1431 
1432 #if 1
1433  /* solve at least one LP */
1434  if( SCIPgetNLPIterations(scip) == 0 )
1435  return SCIP_OKAY;
1436 #endif
1437 
1438  vars = SCIPgetOrigVars(scip);
1439  nvars = SCIPgetNOrigVars(scip);
1440  for( i = 0; i < nvars; ++i )
1441  {
1442  SCIP_Real solval;
1443  SCIP_Real lb;
1444  SCIP_Real ub;
1445  SCIP_Bool infeasible;
1446  SCIP_Bool fixed;
1447 
1448  SCIP_CALL( getSolutionValue(scip->set, vars[i], &solval) );
1449  if( solval == SCIP_UNKNOWN ) /*lint !e777*/
1450  {
1451  SCIPerrorMessage("original variable without debugging solution value\n");
1452  SCIPABORT();
1453  }
1454 
1455  lb = SCIPvarGetLbGlobal(vars[i]);
1456  ub = SCIPvarGetUbGlobal(vars[i]);
1457  if( SCIPisLT(scip, solval, lb) || SCIPisGT(scip, solval, ub) )
1458  {
1459  SCIPerrorMessage("solution value %.15g of <%s> outside bounds loc=[%.15g,%.15g], glb=[%.15g,%.15g]\n",
1460  solval, SCIPvarGetName(vars[i]), lb, ub, SCIPvarGetLbGlobal(vars[i]), SCIPvarGetUbGlobal(vars[i]));
1461  SCIPABORT();
1462  }
1463 
1464  SCIP_CALL( SCIPfixVar(scip, vars[i], solval, &infeasible, &fixed) );
1465  if( infeasible )
1466  *result = SCIP_CUTOFF;
1467  else if( fixed )
1468  *result = SCIP_REDUCEDDOM;
1469  }
1470 
1471  return SCIP_OKAY;
1472 }
1473 
1474 /** creates the debugging propagator and includes it in SCIP */
1476  SCIP* scip /**< SCIP data structure */
1477  )
1478 {
1479  assert(scip != NULL);
1480 
1481  /* include propagator */
1482  SCIP_CALL( SCIPincludeProp(scip, "debug", "debugging propagator", 99999999, -1, FALSE,
1484  NULL, propExecDebug, NULL, NULL) );
1485 
1486  return SCIP_OKAY;
1487 }
1488 
1489 /** adds a solution value for a new variable in the transformed problem that has no original counterpart
1490  * a value can only be set if no value has been set for this variable before
1491  */
1493  SCIP* scip, /**< SCIP data structure */
1494  SCIP_VAR* var, /**< variable for which to add a value */
1495  SCIP_Real val /**< solution value for variable */
1496  )
1497 {
1498  const char* varname;
1499  int i;
1500 
1501  assert(var != NULL);
1502 
1503  /* assert that we are in the SCIP instance that we are debugging and not some different (subSCIP, auxiliary CIP, ...) */
1504  assert(isMainscipset(scip->set));
1505 
1506  if( SCIPvarIsOriginal(var) )
1507  {
1508  SCIPerrorMessage("adding solution values for original variables is forbidden\n");
1509  return SCIP_ERROR;
1510  }
1511 
1512  if( SCIPvarIsTransformedOrigvar(var) )
1513  {
1514  SCIPerrorMessage("adding solution values for variable that are direct counterparts of original variables is forbidden\n");
1515  return SCIP_ERROR;
1516  }
1517 
1518  /* allocate memory */
1519  if( nsolvals >= solsize )
1520  {
1521  solsize = MAX(2*solsize, nsolvals+1);
1522  SCIP_ALLOC( BMSreallocMemoryArray(&solnames, solsize) );
1523  SCIP_ALLOC( BMSreallocMemoryArray(&solvals, solsize) );
1524  }
1525  assert(nsolvals < solsize);
1526 
1527  /* store solution value in sorted list */
1528  varname = SCIPvarGetName(var);
1529  for( i = nsolvals; i > 0 && strcmp(varname, solnames[i-1]) < 0; --i )
1530  {
1531  solnames[i] = solnames[i-1];
1532  solvals[i] = solvals[i-1];
1533  }
1534  if( i > 0 && strcmp(varname, solnames[i-1]) == 0 )
1535  {
1536  if( REALABS(solvals[i-1] - val) > 1e-9 )
1537  {
1538  SCIPerrorMessage("already have stored different debugging solution value (%g) for variable <%s>, cannot store %g\n", solvals[i-1], varname, val);
1539  return SCIP_ERROR;
1540  }
1541  else
1542  {
1543  SCIPdebugMessage("already have stored debugging solution value %g for variable <%s>, do not store same value again\n", val, varname);
1544  for( ; i < nsolvals; ++i )
1545  {
1546  solnames[i] = solnames[i+1];
1547  solvals[i] = solvals[i+1];
1548  }
1549  return SCIP_OKAY;
1550  }
1551  }
1552 
1553  /* insert new solution value */
1554  SCIP_ALLOC( BMSduplicateMemoryArray(&solnames[i], varname, strlen(varname)+1) );
1555  SCIPdebugMessage("add variable <%s>: value <%g>\n", solnames[i], val);
1556  solvals[i] = val;
1557  nsolvals++;
1558 
1559  /* update objective function value of debug solution */
1560  debugsolval += solvals[i] * SCIPvarGetObj(var);
1561  SCIPdebugMessage("Debug Solution value is now %g.\n", debugsolval);
1562 
1563  assert(debugsol != NULL);
1564 
1566  {
1567  /* add values to SCIP debug solution */
1568  SCIP_CALL( SCIPsetSolVal(scip, debugsol, var, solvals[i] ) );
1569  }
1570 
1571  return SCIP_OKAY;
1572 }
1573 
1574 #else
1575 
1576 /** this is a dummy method to make the SunOS gcc linker happy */
1577 extern void SCIPdummyDebugMethodForSun(void);
1579 {
1580  return;
1581 }
1582 
1583 #endif
1584 
1585 
1586 /*
1587  * debug method for LP interface, to check if the LP interface works correct
1588  */
1589 #ifdef SCIP_DEBUG_LP_INTERFACE
1590 
1591 /* check whether coef is the r-th row of the inverse basis matrix B^-1; this is
1592  * the case if( coef * B ) is the r-th unit vector */
1594  SCIP* scip, /**< SCIP data structure */
1595  int r, /**< row number */
1596  SCIP_Real* coef /**< r-th row of the inverse basis matrix */
1597  )
1598 {
1599  SCIP_Real vecval;
1600  SCIP_Real matrixval;
1601  int* basisind;
1602  int nrows;
1603  int idx;
1604  int i;
1605  int k;
1606 
1607  assert(scip != NULL);
1608 
1609  nrows = SCIPgetNLPRows(scip);
1610 
1611  /* get basic indices for the basic matrix B */
1612  SCIP_CALL( SCIPallocBufferArray(scip, &basisind, nrows) );
1613  SCIP_CALL( SCIPgetLPBasisInd(scip, basisind) );
1614 
1615 
1616  /* loop over the columns of B */
1617  for( k = 0; k < nrows; ++k )
1618  {
1619  vecval = 0.0;
1620 
1621  /* indices of basic columns and rows:
1622  * - index i >= 0 corresponds to column i,
1623  * - index i < 0 to row -i-1
1624  */
1625  idx = basisind[k];
1626 
1627  /* check if we have a slack variable; this is the case if idx < 0 */
1628  if( idx >= 0 )
1629  {
1630  /* loop over the rows to compute the corresponding value in the unit vector */
1631  for( i = 0; i < nrows; ++i )
1632  {
1633  SCIP_CALL( SCIPlpiGetCoef(scip->lp->lpi, i, idx, &matrixval) );
1634  vecval += coef[i] * matrixval;
1635  }
1636  }
1637  else
1638  {
1639  assert( idx < 0 );
1640 
1641  /* retransform idx
1642  * - index i >= 0 corresponds to column i,
1643  * - index i < 0 to row -i-1
1644  */
1645  idx = -idx - 1;
1646  assert( idx >= 0 && idx < nrows );
1647 
1648  /* since idx < 0 we are in the case of a slack variable, i.e., the corresponding column
1649  is the idx-unit vector; note that some LP solver return a -idx-unit vector */
1650  /* vecval = REALABS(coef[idx]);*/
1651  vecval = coef[idx];
1652  }
1653 
1654  /* check if vecval fits to the r-th unit vector */
1655  if( k == r && !SCIPisFeasEQ(scip, vecval, 1.0) )
1656  {
1657  /* we expected a 1.0 and found something different */
1658  SCIPmessagePrintWarning(SCIPgetMessagehdlr(scip), "checked SCIPgetLPBInvRow() found value <%g> expected 1.0\n", vecval);
1659  }
1660  else if( k != r && !SCIPisFeasZero(scip, vecval) )
1661  {
1662  /* we expected a 0.0 and found something different */
1663  SCIPmessagePrintWarning(SCIPgetMessagehdlr(scip), "checked SCIPgetLPBInvRow() found value <%g> expected 0.0\n", vecval);
1664  }
1665  }
1666 
1667  SCIPfreeBufferArray(scip, &basisind);
1668 
1669  return SCIP_OKAY;
1670 }
1671 
1672 #endif
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:51
SCIP_RETCODE SCIPfixVar(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval, SCIP_Bool *infeasible, SCIP_Bool *fixed)
Definition: scip.c:22764
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
SCIP_RETCODE SCIPincludeProp(SCIP *scip, const char *name, const char *desc, int priority, int freq, SCIP_Bool delay, SCIP_PROPTIMING timingmask, int presolpriority, int presolmaxrounds, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_PROPCOPY((*propcopy)), SCIP_DECL_PROPFREE((*propfree)), SCIP_DECL_PROPINIT((*propinit)), SCIP_DECL_PROPEXIT((*propexit)), SCIP_DECL_PROPINITPRE((*propinitpre)), SCIP_DECL_PROPEXITPRE((*propexitpre)), SCIP_DECL_PROPINITSOL((*propinitsol)), SCIP_DECL_PROPEXITSOL((*propexitsol)), SCIP_DECL_PROPPRESOL((*proppresol)), SCIP_DECL_PROPEXEC((*propexec)), SCIP_DECL_PROPRESPROP((*propresprop)), SCIP_PROPDATA *propdata)
Definition: scip.c:6824
int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1068
SCIP_VAR * SCIPvarGetNegationVar(SCIP_VAR *var)
Definition: var.c:16781
SCIP_Bool SCIPsetIsLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5089
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16341
SCIP_Bool SCIPsetIsFeasZero(SCIP_SET *set, SCIP_Real val)
Definition: set.c:5539
SCIP_Bool SCIPlpDiving(SCIP_LP *lp)
Definition: lp.c:19402
#define SCIPdebugRemoveNode(blkmem, set, node)
Definition: debug.h:238
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:103
internal methods for branch and bound tree
SCIP_RETCODE SCIPvarGetOrigvarSum(SCIP_VAR **var, SCIP_Real *scalar, SCIP_Real *constant)
Definition: var.c:11991
#define SCIPdebugFreeDebugData(set)
Definition: debug.h:232
SCIP_NODETYPE SCIPnodeGetType(SCIP_NODE *node)
Definition: tree.c:7006
SCIP_Bool SCIPsetIsFeasEQ(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5429
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:16521
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41528
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
Definition: scip.c:37064
#define SCIP_MAXSTRLEN
Definition: def.h:198
SCIP_BOUNDCHG * boundchgs
Definition: struct_var.h:123
#define NULL
Definition: lpi_spx.cpp:130
#define SCIPdebugCheckImplic(set, var, varfixing, implvar, impltype, implbound)
Definition: debug.h:240
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition: lp.c:18914
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
Definition: lp.c:18860
SCIP_Bool SCIPconsIsActive(SCIP_CONS *cons)
Definition: cons.c:7685
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:16965
int SCIPnodeGetDepth(SCIP_NODE *node)
Definition: tree.c:7026
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
Definition: scip.c:34453
unsigned int nboundchgs
Definition: struct_var.h:121
#define SCIPdebugCheckClique(set, vars, values, nvars)
Definition: debug.h:241
int SCIPconsGetActiveDepth(SCIP_CONS *cons)
Definition: cons.c:7674
#define FALSE
Definition: def.h:53
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2052
#define TRUE
Definition: def.h:52
#define SCIPdebugCheckRow(set, row)
Definition: debug.h:234
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_Real SCIPbdchginfoGetNewbound(SCIP_BDCHGINFO *bdchginfo)
Definition: var.c:17546
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
Definition: scip.c:41580
#define BMSallocMemoryArray(ptr, num)
Definition: memory.h:78
#define SCIPdebugMessage
Definition: pub_message.h:77
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:20414
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:16803
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2111
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
Definition: lp.c:18880
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
Definition: cons.c:7843
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
Definition: scip.c:11148
#define SCIP_DECL_PROPEXEC(x)
Definition: type_prop.h:202
#define SCIPdebugCheckVbound(set, var, vbtype, vbvar, vbcoef, vbconstant)
Definition: debug.h:239
internal methods for LP management
SCIP_Longint number
Definition: struct_tree.h:124
#define SCIP_PRESOLTIMING_FAST
Definition: type_timing.h:43
SCIP * scip
Definition: struct_set.h:58
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:34676
SCIP_Bool SCIPsetIsGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5125
SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:16460
#define SCIPdebugCheckConflict(blkmem, set, node, bdchginfos, relaxedbds, nliterals)
Definition: debug.h:242
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip.c:11175
SCIP_BOUNDTYPE SCIPbdchginfoGetBoundtype(SCIP_BDCHGINFO *bdchginfo)
Definition: var.c:17576
#define SCIPdebugSetMainscipset(set)
Definition: debug.h:248
SCIP_VAR * SCIPbdchginfoGetVar(SCIP_BDCHGINFO *bdchginfo)
Definition: var.c:17556
SCIP_Bool SCIPsetIsLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5071
SCIP_DOMCHG * domchg
Definition: struct_tree.h:140
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41193
SCIP_Bool SCIPtreeProbing(SCIP_TREE *tree)
Definition: tree.c:7839
SCIP_Bool SCIPvarIsOriginal(SCIP_VAR *var)
Definition: var.c:16470
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
Definition: var.c:16483
#define SCIPdebugIncludeProp(scip)
Definition: debug.h:244
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:102
internal methods for storing and manipulating the main problem
#define SCIPerrorMessage
Definition: pub_message.h:45
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:20426
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition: lp.c:18924
#define SCIPdebugCheckInference(blkmem, set, node, var, newbound, boundtype)
Definition: debug.h:237
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.c:25857
int SCIPcalcHashtableSize(int minsize)
Definition: misc.c:1152
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip.c:40927
SCIP_BOUNDCHGTYPE SCIPboundchgGetBoundchgtype(SCIP_BOUNDCHG *boundchg)
Definition: var.c:16258
const char * SCIPconsGetName(SCIP_CONS *cons)
Definition: cons.c:7624
SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
Definition: scip.c:10034
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41515
SCIP_Bool SCIPvarIsNegated(SCIP_VAR *var)
Definition: var.c:16496
SCIP_Bool SCIPvarIsDeleted(SCIP_VAR *var)
Definition: var.c:16562
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
Definition: lp.c:19023
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2070
void SCIPmessagePrintWarning(SCIP_MESSAGEHDLR *messagehdlr, const char *formatstr,...)
Definition: message.c:411
#define REALABS(x)
Definition: def.h:148
#define SCIP_PROPTIMING_ALWAYS
Definition: type_timing.h:62
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:263
SCIP main data structure.
SCIP_Bool SCIPsetIsFeasGE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5517
void SCIPdummyDebugMethodForSun(void)
Definition: debug.c:1578
const char * SCIProwGetName(SCIP_ROW *row)
Definition: lp.c:18973
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41554
#define SCIPdebugCheckBInvRow(scip, r, coef)
Definition: debug.h:271
#define SCIPdebugCheckLbGlobal(scip, var, lb)
Definition: debug.h:235
SCIP_LPI * lpi
Definition: struct_lp.h:278
#define SCIPdebugGetSolVal(scip, var, val)
Definition: debug.h:246
void SCIProwPrint(SCIP_ROW *row, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: lp.c:5065
SCIP_Bool SCIPsetIsFeasLE(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5473
#define SCIPdebugCheckUbGlobal(scip, var, ub)
Definition: debug.h:236
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:98
#define SCIPdebugCheckConss(scip, conss, nconss)
Definition: debug.h:233
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41219
internal methods for problem variables
#define SCIP_UNKNOWN
Definition: def.h:145
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:50
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
Definition: scip.c:1188
void SCIPprintSysError(const char *message)
Definition: misc.c:8105
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:801
#define SCIPdebugSolIsValidInSubtree(scip, isvalidinsubtree)
Definition: debug.h:247
#define MAX(x, y)
Definition: tclique_def.h:75
#define SCIPdebugCheckConflictFrontier(blkmem, set, node, bdchginfo, bdchginfos, relaxedbds, nliterals, bdchgqueue, forcedbdchgqueue)
Definition: debug.h:243
methods for debugging
SCIP_Real SCIPvarGetNegationConstant(SCIP_VAR *var)
Definition: var.c:16792
void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1079
SCIP_Bool SCIPsetIsFeasLT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5451
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip.c:36389
int SCIPgetDepth(SCIP *scip)
Definition: scip.c:37750
SCIP_RETCODE SCIPgetLPBasisInd(SCIP *scip, int *basisind)
Definition: scip.c:26853
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16506
SCIP_DOMCHGBOUND domchgbound
Definition: struct_var.h:151
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:16955
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2172
SCIP_NODE * parent
Definition: struct_tree.h:138
SCIP_Bool SCIPvarIsTransformedOrigvar(SCIP_VAR *var)
Definition: var.c:12078
#define SCIP_DECL_SORTPTRCOMP(x)
Definition: type_misc.h:136
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
Definition: lp.c:18870
SCIP_SET * set
Definition: struct_scip.h:57
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip.c:33828
public methods for message output
SCIP_Bool SCIPsetIsGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5107
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:2132
#define SCIPdebugSolDisable(scip)
Definition: debug.h:250
#define SCIP_Real
Definition: def.h:124
enum SCIP_Stage SCIP_STAGE
Definition: type_set.h:48
SCIP_VAR * SCIPfindVar(SCIP *scip, const char *name)
Definition: scip.c:11429
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:82
void SCIPsortPtrReal(void **ptrarray, SCIP_Real *realarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
#define SCIPdebugAddSolVal(scip, var, val)
Definition: debug.h:245
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip.c:34495
SCIP_Bool SCIPsetIsFeasGT(SCIP_SET *set, SCIP_Real val1, SCIP_Real val2)
Definition: set.c:5495
SCIP_TREE * tree
Definition: struct_scip.h:79
#define SCIPdebugSolIsEnabled(scip)
Definition: debug.h:251
int SCIProwGetNNonz(SCIP_ROW *row)
Definition: lp.c:18835
SCIP_STAGE SCIPsetGetStage(SCIP_SET *set)
Definition: set.c:2283
common defines and data types used in all packages of SCIP
SCIP_RETCODE SCIPlpiGetCoef(SCIP_LPI *lpi, int row, int col, SCIP_Real *val)
Definition: lpi_clp.cpp:1598
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:392
SCIP_BOUNDTYPE SCIPboundchgGetBoundtype(SCIP_BOUNDCHG *boundchg)
Definition: var.c:16268
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
Definition: lp.c:18684
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip.c:35377
SCIP_LP * lp
Definition: struct_scip.h:75
#define SCIP_ALLOC(x)
Definition: def.h:274
#define SCIPdebugSolEnable(scip)
Definition: debug.h:249
#define SCIPABORT()
Definition: def.h:235
int SCIPgetNLPRows(SCIP *scip)
Definition: scip.c:26793
SCIP callable library.
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
Definition: scip.c:34217
memory allocation routines