Skip to content

Commit 1d02391

Browse files
committed
Merge remote-tracking branch 'origin/v10-minor'
2 parents 1cbe637 + 22b2020 commit 1d02391

File tree

2 files changed

+40
-12
lines changed

2 files changed

+40
-12
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Fixed bugs
6868
----------
6969

7070
- fixed call of SCIPcreateConsBasicSOCNonlinear() with coefs being NULL, and fixed check for offsets being finite
71+
- avoid crash when initial IIS solve fails while reporting errors explicitly
7172

7273

7374
@section RN1000 SCIP 10.0.0

src/scip/iisfinder.c

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,19 @@ SCIP_RETCODE createSubscipIIS(
6464
SCIP_SET* set, /**< global SCIP settings */
6565
SCIP_IIS* iis, /**< pointer to store IIS */
6666
SCIP_Real timelim, /**< timelimit */
67-
SCIP_Longint nodelim /**< nodelimit */
67+
SCIP_Longint nodelim, /**< nodelimit */
68+
SCIP_Bool* success /**< whether the created subscip is complete */
6869
)
6970
{
7071
SCIP_VAR** vars;
71-
SCIP_Bool success;
7272
int nvars;
7373
int i;
7474

75-
assert( set != NULL );
76-
assert( iis != NULL );
75+
assert(set != NULL);
76+
assert(iis != NULL);
77+
assert(success != NULL);
78+
79+
*success = FALSE;
7780

7881
/* Create the subscip used for storing the IIS */
7982
if( iis->subscip != NULL )
@@ -96,10 +99,10 @@ SCIP_RETCODE createSubscipIIS(
9699
SCIP_CALL( SCIPhashmapCreate(&(iis->conssmap), SCIPblkmem(set->scip), SCIPgetNOrigConss(set->scip)) );
97100

98101
/* create problem in sub-SCIP */
99-
SCIP_CALL( SCIPcopyOrig(set->scip, iis->subscip, iis->varsmap, iis->conssmap, "iis", TRUE, FALSE, FALSE, &success) );
102+
SCIP_CALL( SCIPcopyOrig(set->scip, iis->subscip, iis->varsmap, iis->conssmap, "iis", TRUE, FALSE, FALSE, success) );
100103

101-
if( ! success )
102-
return SCIP_ERROR;
104+
if( !(*success) )
105+
return SCIP_OKAY;
103106

104107
/* Remove the objective */
105108
vars = SCIPgetOrigVars(iis->subscip);
@@ -326,6 +329,7 @@ SCIP_RETCODE SCIPiisGenerate(
326329
SCIP_VAR** vars;
327330
SCIP_IIS* iis;
328331
SCIP_RESULT result = SCIP_DIDNOTFIND;
332+
SCIP_RETCODE retcode;
329333
SCIP_Real timelim;
330334
SCIP_Longint nodelim;
331335
SCIP_Bool silent;
@@ -334,30 +338,52 @@ SCIP_RETCODE SCIPiisGenerate(
334338
SCIP_Bool removeunusedvars;
335339
SCIP_Bool trivial;
336340
SCIP_Bool islinear;
341+
SCIP_Bool success;
337342
int nconss;
338343
int nvars;
339344
int nbounds;
340345
int i;
341346
int j;
342347

348+
/* exact mode is not supported */
349+
if( set->exact_enable )
350+
{
351+
SCIPinfoMessage(set->scip, NULL, "IIS generation does not yet support exact mode.\n");
352+
return SCIP_OKAY;
353+
}
354+
343355
/* sort the iis finders by priority */
344356
SCIPsetSortIISfinders(set);
345357

346358
/* Get the IIS data. */
347359
iis = SCIPgetIIS(set->scip);
348-
349-
/* Create the subscip used for storing the IIS */
350360
SCIP_CALL( SCIPiisReset(&iis) );
351361
SCIP_CALL( SCIPgetRealParam(set->scip, "iis/time", &timelim) );
352362
SCIP_CALL( SCIPgetLongintParam(set->scip, "iis/nodes", &nodelim) );
353-
SCIP_CALL( createSubscipIIS(set, iis, timelim, nodelim) );
363+
364+
/* Create the subscip used for storing the IIS */
365+
SCIP_CALL( createSubscipIIS(set, iis, timelim, nodelim, &success) );
366+
367+
if( !success )
368+
{
369+
SCIPinfoMessage(iis->subscip, NULL, "Error copying original problem instance. IIS generation suspended.\n");
370+
return SCIP_OKAY;
371+
}
354372

355373
SCIPclockStart(iis->iistime, set);
356374

357375
/* If the model is not yet shown to be infeasible then check for infeasibility */
358376
if( SCIPgetStage(set->scip) == SCIP_STAGE_PROBLEM )
359377
{
360-
SCIP_CALL( SCIPsolve(iis->subscip) );
378+
retcode = SCIPsolve(iis->subscip);
379+
380+
if( retcode != SCIP_OKAY )
381+
{
382+
SCIPinfoMessage(iis->subscip, NULL, "Error proving infeasibility of initial problem. IIS generation suspended.\n");
383+
SCIPclockStop(iis->iistime, set);
384+
return SCIP_OKAY;
385+
}
386+
361387
if( SCIPgetStage(iis->subscip) == SCIP_STAGE_SOLVED )
362388
{
363389
switch( SCIPgetStatus(iis->subscip) )
@@ -458,7 +484,8 @@ SCIP_RETCODE SCIPiisGenerate(
458484
/* recreate the initial subscip if the IIS finder has produced an invalid infeasible subsystem */
459485
if( !iis->infeasible )
460486
{
461-
SCIP_CALL( createSubscipIIS(set, iis, timelim, nodelim) );
487+
SCIP_CALL( createSubscipIIS(set, iis, timelim, nodelim, &success) );
488+
assert(success);
462489
}
463490

464491
if( timelim - SCIPclockGetTime(iis->iistime) <= 0 || (nodelim != -1 && iis->nnodes > nodelim) )

0 commit comments

Comments
 (0)