Skip to content

Commit b762394

Browse files
committed
Merge branch 'pm/iis_api' into 'master'
IIS finder: Use subscip settings instead of arguments See merge request integer/scip!3826
2 parents 28cf911 + 8579a25 commit b762394

File tree

8 files changed

+149
-149
lines changed

8 files changed

+149
-149
lines changed

CHANGELOG

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ Interface changes
6868

6969
### New and changed callbacks
7070

71+
- added SCIP_DECL_IISFINDERCOPY(), SCIP_DECL_IISFINDERFREE(), and SCIP_DECL_IISFINDEREXEC() for iisfinder implementations
7172
- added a new callback TABLE_COLLECT for the table plugin that collects the data for the specific statistics table in a SCIP_DATATREE object
7273
- for a table plugin, only one of the callbacks TABLE_COLLECT or TABLE_OUTPUT needs to be implemented, but implementing both is preferred;
7374
if TABLE_OUTPUT is omitted, then SCIP tries to print a table from the data given by TABLE_COLLECT
@@ -135,7 +136,7 @@ Interface changes
135136
STO readers respectively. These readers are all used when reading an SMPS instance.
136137
- SCIPdialogIsHidden(), SCIPdialogSetHidden() to determine whether a dialog should be hidden in help list
137138
- added SCIPincludeIISfinder(), SCIPincludeIISfinderBasic(), SCIPsetIISfinderCopy(), SCIPsetIISfinderFree(), SCIPgenerateIIS(), SCIPfindIISfinder(), SCIPgetIISfinders(), SCIPgetNIISfinders(), SCIPsetIISfinderPriority(), SCIPgetIIS()
138-
- added SCIPiisfinderGetName(), SCIPiisfinderGetData(), SCIPiisfinderGetDesc(), SCIPiisfinderGetPriority(), SCIPiisfinderSetData(), SCIPiisfinderGetTime(), SCIPiisfinderInfoMessage(), SCIPiisGetTime(), SCIPiisIsSubscipInfeasible(), SCIPiisIsSubscipIrreducible(), SCIPiisGetNNodes(), SCIPiisSetSubscipInfeasible(), SCIPiisSetSubscipIrreducible(), SCIPiisAddNNodes(), SCIPiisGetRandnumgen(), SCIPiisGetSubscip()
139+
- added SCIPiisfinderGetName(), SCIPiisfinderGetData(), SCIPiisfinderGetDesc(), SCIPiisfinderGetPriority(), SCIPiisfinderSetData(), SCIPiisfinderGetTime(), SCIPiisfinderInfoMessage(), SCIPiisGetTime(), SCIPiisIsSubscipInfeasible(), SCIPiisIsSubscipIrreducible(), SCIPiisGetNNodes(), SCIPiisSetSubscipInfeasible(), SCIPiisSetSubscipIrreducible(), SCIPiisAddNNodes(), SCIPiisGetRandnumgen(), SCIPiisGetSubscip(), SCIPiisGreedyMinimize()
139140
- functions to create, modify, and free SCIP_DATATREE objects and to print as JSON or table (see pub_datatree.h and scip_datatree.h)
140141
- SCIPcollect*Statistics() for every SCIPprint*Statistics() in scip_solvingstats.h
141142
- SCIPprintStatisticsJson() to output a JSON string of the table statistics data

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_R
2121
set(SCIP_VERSION_MAJOR 10)
2222
set(SCIP_VERSION_MINOR 0)
2323
set(SCIP_VERSION_PATCH 0)
24-
set(SCIP_VERSION_API 145)
24+
set(SCIP_VERSION_API 146)
2525

2626
project(SCIP
2727
VERSION ${SCIP_VERSION_MAJOR}.${SCIP_VERSION_MINOR}.${SCIP_VERSION_PATCH}

make/make.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ CLOCKTYPE = 1
9797
SCIP_VERSION_MAJOR = 10
9898
SCIP_VERSION_MINOR = 0
9999
SCIP_VERSION_PATCH = 0
100-
SCIP_VERSION_API = 145
100+
SCIP_VERSION_API = 146
101101
SCIP_VERSION = $(SCIP_VERSION_MAJOR).$(SCIP_VERSION_MINOR).$(SCIP_VERSION_PATCH)
102102

103103
# compiling and linking parameters

src/objscip/objiisfinder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ SCIP_DECL_IISFINDEREXEC(iisfinderExecObj)
112112
assert(iisfinderdata->objiisfinder != NULL);
113113

114114
/* call virtual method of iisfinder object */
115-
SCIP_CALL( iisfinderdata->objiisfinder->scip_exec(iis, iisfinder, timelim, nodelim, removebounds, silent, result) );
115+
SCIP_CALL( iisfinderdata->objiisfinder->scip_exec(iis, iisfinder, result) );
116116

117117
return SCIP_OKAY;
118118
}

src/scip/iisfinder.c

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "scip/cons_linear.h"
4141
#include "scip/iisfinder.h"
4242
#include "scip/iisfinder_greedy.h"
43-
4443
#include "scip/struct_iisfinder.h"
4544

4645

@@ -73,6 +72,9 @@ SCIP_RETCODE createSubscipIIS(
7372
int nvars;
7473
int i;
7574

75+
assert( set != NULL );
76+
assert( iis != NULL );
77+
7678
/* Create the subscip used for storing the IIS */
7779
if( iis->subscip != NULL )
7880
{
@@ -255,26 +257,20 @@ SCIP_RETCODE SCIPiisGenerate(
255257
SCIP_CONS** conss;
256258
SCIP_VAR** vars;
257259
SCIP_IIS* iis;
258-
int i;
259-
int j;
260-
int nconss;
261-
int nvars;
262-
int nbounds;
263260
SCIP_RESULT result = SCIP_DIDNOTFIND;
261+
SCIP_Real timelim;
262+
SCIP_Longint nodelim;
264263
SCIP_Bool silent;
265-
SCIP_Bool removebounds;
266264
SCIP_Bool minimal;
267265
SCIP_Bool stopafterone;
268266
SCIP_Bool removeunusedvars;
269267
SCIP_Bool trivial;
270268
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;
278274

279275
/* sort the iis finders by priority */
280276
SCIPsetSortIISfinders(set);
@@ -284,6 +280,8 @@ SCIP_RETCODE SCIPiisGenerate(
284280

285281
/* Create the subscip used for storing the IIS */
286282
SCIP_CALL( SCIPiisReset(&iis) );
283+
SCIP_CALL( SCIPgetRealParam(set->scip, "iis/time", &timelim) );
284+
SCIP_CALL( SCIPgetLongintParam(set->scip, "iis/nodes", &nodelim) );
287285
SCIP_CALL( createSubscipIIS(set, iis, timelim, nodelim) );
288286

289287
SCIPclockStart(iis->iistime, set);
@@ -369,33 +367,33 @@ SCIP_RETCODE SCIPiisGenerate(
369367

370368
/* Try all IIS generators */
371369
SCIP_CALL( SCIPgetBoolParam(set->scip, "iis/stopafterone", &stopafterone) );
372-
SCIP_CALL( SCIPgetBoolParam(set->scip, "iis/removebounds", &removebounds) );
373370
if( !trivial )
374371
{
375372
for( i = 0; i < set->niisfinders; ++i )
376373
{
377374
SCIP_IISFINDER* iisfinder;
378375
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 );
384377

385378
/* start timing */
386379
SCIPclockStart(iisfinder->iisfindertime, set);
387380

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 );
390384

391385
/* stop timing */
392386
SCIPclockStop(iisfinder->iisfindertime, set);
393387

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+
}
395393

396394
if( timelim - SCIPclockGetTime(iis->iistime) <= 0 || (nodelim != -1 && iis->nnodes > nodelim) )
397395
{
398-
SCIPdebugMsg(set->scip, "Time or node limit hit. Stopping Search.\n");
396+
SCIPdebugMsg(iis->subscip, "Time or node limit hit. Stopping Search.\n");
399397
break;
400398
}
401399

@@ -408,13 +406,11 @@ SCIP_RETCODE SCIPiisGenerate(
408406
SCIP_CALL( SCIPgetBoolParam(set->scip, "iis/minimal", &minimal) );
409407
if( !iis->irreducible && minimal && !(timelim - SCIPclockGetTime(iis->iistime) <= 0 || (nodelim != -1 && iis->nnodes > nodelim)) && !trivial )
410408
{
411-
SCIPdebugMsg(set->scip, "----- STARTING GREEDY DELETION ALGORITHM WITH BATCHSIZE=1. ATTEMPT TO ENSURE IRREDUCIBILITY -----\n");
409+
assert( iis->infeasible );
412410

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");
415412

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) );
418414
}
419415

420416
/* Remove redundant constraints that potentially are left over from indicator constraints,
@@ -456,6 +452,7 @@ SCIP_RETCODE SCIPiisGenerate(
456452
}
457453
}
458454

455+
SCIP_CALL( SCIPgetBoolParam(set->scip, "iis/silent", &silent) );
459456
if( !silent )
460457
SCIPiisfinderInfoMessage(iis, FALSE);
461458

0 commit comments

Comments
 (0)