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