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