40
40
#include "scip/cons_linear.h"
41
41
#include "scip/iisfinder.h"
42
42
#include "scip/iisfinder_greedy.h"
43
-
44
43
#include "scip/struct_iisfinder.h"
45
44
46
45
@@ -73,6 +72,9 @@ SCIP_RETCODE createSubscipIIS(
73
72
int nvars ;
74
73
int i ;
75
74
75
+ assert ( set != NULL );
76
+ assert ( iis != NULL );
77
+
76
78
/* Create the subscip used for storing the IIS */
77
79
if ( iis -> subscip != NULL )
78
80
{
@@ -255,26 +257,20 @@ SCIP_RETCODE SCIPiisGenerate(
255
257
SCIP_CONS * * conss ;
256
258
SCIP_VAR * * vars ;
257
259
SCIP_IIS * iis ;
258
- int i ;
259
- int j ;
260
- int nconss ;
261
- int nvars ;
262
- int nbounds ;
263
260
SCIP_RESULT result = SCIP_DIDNOTFIND ;
261
+ SCIP_Real timelim ;
262
+ SCIP_Longint nodelim ;
264
263
SCIP_Bool silent ;
265
- SCIP_Bool removebounds ;
266
264
SCIP_Bool minimal ;
267
265
SCIP_Bool stopafterone ;
268
266
SCIP_Bool removeunusedvars ;
269
267
SCIP_Bool trivial ;
270
268
SCIP_Bool islinear ;
271
- SCIP_Real timelim ;
272
- SCIP_Longint nodelim ;
273
-
274
- /* start timing */
275
- SCIP_CALL ( SCIPgetRealParam (set -> scip , "iis/time" , & timelim ) );
276
- SCIP_CALL ( SCIPgetLongintParam (set -> scip , "iis/nodes" , & nodelim ) );
277
- SCIP_CALL ( SCIPgetBoolParam (set -> scip , "iis/silent" , & silent ) );
269
+ int nconss ;
270
+ int nvars ;
271
+ int nbounds ;
272
+ int i ;
273
+ int j ;
278
274
279
275
/* sort the iis finders by priority */
280
276
SCIPsetSortIISfinders (set );
@@ -284,6 +280,8 @@ SCIP_RETCODE SCIPiisGenerate(
284
280
285
281
/* Create the subscip used for storing the IIS */
286
282
SCIP_CALL ( SCIPiisReset (& iis ) );
283
+ SCIP_CALL ( SCIPgetRealParam (set -> scip , "iis/time" , & timelim ) );
284
+ SCIP_CALL ( SCIPgetLongintParam (set -> scip , "iis/nodes" , & nodelim ) );
287
285
SCIP_CALL ( createSubscipIIS (set , iis , timelim , nodelim ) );
288
286
289
287
SCIPclockStart (iis -> iistime , set );
@@ -369,33 +367,33 @@ SCIP_RETCODE SCIPiisGenerate(
369
367
370
368
/* Try all IIS generators */
371
369
SCIP_CALL ( SCIPgetBoolParam (set -> scip , "iis/stopafterone" , & stopafterone ) );
372
- SCIP_CALL ( SCIPgetBoolParam (set -> scip , "iis/removebounds" , & removebounds ) );
373
370
if ( !trivial )
374
371
{
375
372
for ( i = 0 ; i < set -> niisfinders ; ++ i )
376
373
{
377
374
SCIP_IISFINDER * iisfinder ;
378
375
iisfinder = set -> iisfinders [i ];
379
- assert (iis != NULL );
380
-
381
- /* Recreate the subscip if one of the IIS finder algorithms has produced an invalid infeasible subsystem */
382
- if ( !iis -> infeasible )
383
- SCIP_CALL ( createSubscipIIS (set , iis , timelim - SCIPclockGetTime (iis -> iistime ), nodelim ) );
376
+ assert ( iis -> infeasible );
384
377
385
378
/* start timing */
386
379
SCIPclockStart (iisfinder -> iisfindertime , set );
387
380
388
- SCIPdebugMsg (set -> scip , "----- STARTING IIS FINDER %s -----\n" , iisfinder -> name );
389
- SCIP_CALL ( iisfinder -> iisfinderexec (iis , iisfinder , timelim , nodelim , removebounds , silent , & result ) );
381
+ SCIPdebugMsg (iis -> subscip , "----- STARTING IIS FINDER %s -----\n" , iisfinder -> name );
382
+ SCIP_CALL ( iisfinder -> iisfinderexec (iis , iisfinder , & result ) );
383
+ assert ( result == SCIP_SUCCESS || result == SCIP_DIDNOTFIND || result == SCIP_DIDNOTRUN );
390
384
391
385
/* stop timing */
392
386
SCIPclockStop (iisfinder -> iisfindertime , set );
393
387
394
- assert ( result == SCIP_SUCCESS || result == SCIP_DIDNOTFIND || result == SCIP_DIDNOTRUN );
388
+ /* recreate the initial subscip if the IIS finder has produced an invalid infeasible subsystem */
389
+ if ( !iis -> infeasible )
390
+ {
391
+ SCIP_CALL ( createSubscipIIS (set , iis , timelim , nodelim ) );
392
+ }
395
393
396
394
if ( timelim - SCIPclockGetTime (iis -> iistime ) <= 0 || (nodelim != -1 && iis -> nnodes > nodelim ) )
397
395
{
398
- SCIPdebugMsg (set -> scip , "Time or node limit hit. Stopping Search.\n" );
396
+ SCIPdebugMsg (iis -> subscip , "Time or node limit hit. Stopping Search.\n" );
399
397
break ;
400
398
}
401
399
@@ -408,13 +406,11 @@ SCIP_RETCODE SCIPiisGenerate(
408
406
SCIP_CALL ( SCIPgetBoolParam (set -> scip , "iis/minimal" , & minimal ) );
409
407
if ( !iis -> irreducible && minimal && !(timelim - SCIPclockGetTime (iis -> iistime ) <= 0 || (nodelim != -1 && iis -> nnodes > nodelim )) && !trivial )
410
408
{
411
- SCIPdebugMsg ( set -> scip , "----- STARTING GREEDY DELETION ALGORITHM WITH BATCHSIZE=1. ATTEMPT TO ENSURE IRREDUCIBILITY -----\n" );
409
+ assert ( iis -> infeasible );
412
410
413
- if ( !iis -> infeasible )
414
- SCIP_CALL ( createSubscipIIS (set , iis , timelim , nodelim ) );
411
+ SCIPdebugMsg (iis -> subscip , "----- STARTING GREEDY SINGLETON DELETION ALGORITHM. ATTEMPT TO ENSURE IRREDUCIBILITY -----\n" );
415
412
416
- SCIP_CALL ( SCIPexecIISfinderGreedy (iis , timelim , nodelim , removebounds , silent , 1e+20 , FALSE, TRUE, TRUE, TRUE, -1L , 1 , 1.0 , & result ) );
417
- assert ( result == SCIP_SUCCESS || result == SCIP_DIDNOTFIND || result == SCIP_DIDNOTRUN );
413
+ SCIP_CALL ( SCIPiisGreedyMinimize (iis ) );
418
414
}
419
415
420
416
/* Remove redundant constraints that potentially are left over from indicator constraints,
@@ -456,6 +452,7 @@ SCIP_RETCODE SCIPiisGenerate(
456
452
}
457
453
}
458
454
455
+ SCIP_CALL ( SCIPgetBoolParam (set -> scip , "iis/silent" , & silent ) );
459
456
if ( !silent )
460
457
SCIPiisfinderInfoMessage (iis , FALSE);
461
458
0 commit comments