35#define IISFINDER_NAME "greedy"
36#define IISFINDER_DESC "greedy deletion or addition constraint deletion"
37#define IISFINDER_PRIORITY 8000
39#define DEFAULT_TIMELIMPERITER 1e+20
40#define DEFAULT_NODELIMPERITER -1L
42#define DEFAULT_ADDITIVE TRUE
43#define DEFAULT_CONSERVATIVE TRUE
44#define DEFAULT_DELAFTERADD TRUE
45#define DEFAULT_DYNAMICREORDERING TRUE
47#define DEFAULT_INITBATCHSIZE 16
48#define DEFAULT_INITRELBATCHSIZE 0.03125
49#define DEFAULT_MAXBATCHSIZE INT_MAX
50#define DEFAULT_MAXRELBATCHSIZE 0.5
51#define DEFAULT_BATCHINGFACTOR 2.0
52#define DEFAULT_BATCHINGOFFSET 0.0
53#define DEFAULT_BATCHUPDATEINTERVAL 1
61struct SCIP_IISfinderData
77 int batchupdateinterval;
101 mintimelim =
MIN(timelim - currtime, timelimperiter);
102 mintimelim =
MAX(mintimelim, 0);
111 assert( globalnodelim >= 0 );
113 if( globalnodelim == -1 && nodelimperiter == -1 )
117 else if( globalnodelim == -1 || nodelimperiter == -1 )
142 for (
i = 0;
i < ndelbounds; ++
i)
171 for(
i = 0;
i < ndelconss; ++
i )
180 copycons = conss[idxs[
i]];
199 int batchupdateinterval,
204 *batchsize = initbatchsize;
205 else if( iteration % batchupdateinterval == 0 )
206 *batchsize = (int)ceil(batchingfactor * (*batchsize) + batchingoffset);
209 *batchsize =
MIN(*batchsize, maxbatchsize);
210 *batchsize =
MAX(*batchsize, 1);
252 for (
i = 0;
i < ndels; ++
i)
280 for (
i = 0;
i < ndels; ++
i)
303 SCIPdebugMsg(
scip,
"Error in sub-scip with deleted constraints / bounds. Re-adding them.\n");
313 *alldeletionssolved =
FALSE;
335 *alldeletionssolved =
FALSE;
347 *alldeletionssolved =
FALSE;
348 SCIPdebugMsg(
scip,
"Some limit reached. Keeping bounds / constraints removed if non-conservative.\n");
354 if( conservative && delbounds )
365 SCIPdebugMsg(
scip,
"Subproblem with bounds / constraints removed infeasible. Keep them removed.\n");
379 SCIPdebugMsg(
scip,
"Found solution to subproblem with bounds / constraints removed. Add them back.\n");
392 *alldeletionssolved =
FALSE;
393 SCIPerrorMessage(
"Unexpected return status %d in removed bounds subproblem. Exiting...\n", status);
432 SCIPdebugMsg(
scip,
"Error in sub-scip with added constraints. Keep added constraints.\n");
458 SCIPdebugMsg(
scip,
"Some limit reached. Added constraint batch failed to induce infeasibility. Continue adding.\n");
462 SCIPdebugMsg(
scip,
"Subproblem with added constraints infeasible. Final batch of constraints added.\n");
470 SCIPdebugMsg(
scip,
"Found solution of subproblem with added constraints. Keep adding constraint batches.\n");
501 int batchupdateinterval,
519 int batchsize = initbatchsize;
534 assert( initbatchsize >= 1 );
535 assert( maxbatchsize >= 1 );
536 initbatchsize =
MIN(initbatchsize, maxbatchsize);
552 for (
i = 0;
i < nconss; ++
i)
564 SCIP_CALL(
updateBatchsize(
scip, initbatchsize, maxbatchsize, iteration, !deleted, batchingfactor, batchingoffset, batchupdateinterval, &batchsize) );
568 while(
i < nconss && k < batchsize )
581 conservative,
FALSE,
FALSE, &deleted, &stopiter, alldeletionssolved) );
582 if( !silent && deleted )
589 if( !deleted && k > initbatchsize )
625 SCIP_CALL(
updateBatchsize(
scip, initbatchsize, maxbatchsize, iteration, !deleted, batchingfactor, batchingoffset, batchupdateinterval, &batchsize) );
630 while(
i <
nvars && k < batchsize )
644 conservative,
TRUE,
TRUE, &deleted, &stopiter, alldeletionssolved) );
647 if( !silent && deleted )
652 conservative,
TRUE,
FALSE, &deleted, &stopiter, alldeletionssolved) );
656 if( !silent && deleted )
660 if( !deleted && k > initbatchsize )
690 int batchupdateinterval
722 assert( initbatchsize >= 1 );
723 assert( maxbatchsize >= 1 );
724 initbatchsize =
MIN(initbatchsize, maxbatchsize);
725 batchsize = initbatchsize;
737 for(
i = 0;
i < nconss; ++
i )
755 for (
i = 0;
i < nconss; ++
i)
768 while(
i < nconss && k < batchsize )
770 if( !inIS[order[
i]] )
774 inIS[order[
i]] =
TRUE;
788 retcode =
additionSubproblem(iis, timelim, timelimperiter, nodelim, nodelimperiter, &feasible, &stopiter);
798 if( dynamicreordering && retcode ==
SCIP_OKAY )
812 if( copysol !=
NULL )
815 for( j =
i; j < nconss; ++j )
826 inIS[order[j]] =
TRUE;
851 SCIPdebugMsg(
scip,
"Hit limit or interrupt. Restore full infeasible problem.\n");
852 for(
i = 0;
i < nconss; ++
i )
854 if( !inIS[order[
i]] )
858 inIS[order[
i]] =
TRUE;
865 for(
i = 0;
i < nconss; ++
i )
867 if( !inIS[order[
i]] )
924 initbatchsize = iisfinderdata->initrelbatchsize > 0.0
925 ? (int)ceil(iisfinderdata->initrelbatchsize * maxbatchsize) :
MIN(iisfinderdata->initbatchsize, maxbatchsize);
926 maxbatchsize = (int)ceil(iisfinderdata->maxrelbatchsize * maxbatchsize);
927 maxbatchsize =
MIN(iisfinderdata->maxbatchsize, maxbatchsize);
928 initbatchsize =
MAX(initbatchsize, 1);
929 maxbatchsize =
MAX(maxbatchsize, 1);
933 if( iisfinderdata->additive )
940 iisfinderdata->nodelimperiter, iisfinderdata->dynamicreordering, initbatchsize, maxbatchsize,
941 iisfinderdata->batchingfactor, iisfinderdata->batchingoffset, iisfinderdata->batchupdateinterval) );
953 iisfinderdata->nodelimperiter, iisfinderdata->conservative, initbatchsize, maxbatchsize,
954 iisfinderdata->batchingfactor, iisfinderdata->batchingoffset, iisfinderdata->batchupdateinterval,
955 &alldeletionssolved) );
958 if( alldeletionssolved && initbatchsize == 1 )
962 if( iisfinderdata->delafteradd && iisfinderdata->additive )
966 SCIPdebugMsg(
scip,
"----- STARTING GREEDY DELETION ALGORITHM FOLLOWING COMPLETED ADDITION ALGORITHM -----\n");
969 iisfinderdata->nodelimperiter, iisfinderdata->conservative, initbatchsize, maxbatchsize,
970 iisfinderdata->batchingfactor, iisfinderdata->batchingoffset, iisfinderdata->batchupdateinterval,
971 &alldeletionssolved) );
974 if( alldeletionssolved && initbatchsize == 1 )
1056 iisfinderExecGreedy, iisfinderdata) );
1067 "time limit of optimization process for each individual subproblem",
1072 "node limit of optimization process for each individual subproblem",
1077 "should an additive constraint approach be used instead of deletion",
1082 "should an unsolved problem (by e.g. user interrupt, node limit, time limit) be considered feasible when deleting constraints",
1087 "should the deletion routine be performed after the addition routine (in the case of additive)",
1092 "should satisfied constraints outside the batch of an intermediate solve be added during the additive method",
1097 "the initial batchsize for the first iteration, ignored if initrelbatchsize is positive",
1102 "the initial batchsize relative to the original problem for the first iteration (0.0: use initbatchsize)",
1107 "the maximum batchsize per iteration",
1112 "the maximum batchsize relative to the original problem per iteration",
1117 "the factor with which the batchsize is multiplied in every update",
1122 "the offset which is added to the multiplied batchsize in every update",
1127 "the number of iterations to run with a constant batchsize before updating (1: always update)",
1169 for(
c = 0;
c < nentries; ++
c )
1209 for(
c = 0;
c < nconss; ++
c )
#define SCIP_STRINGEQ(name, reference, retcode)
SCIP_STATUS SCIPgetStatus(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
int SCIPgetNOrigConss(SCIP *scip)
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPdelCons(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNOrigVars(SCIP *scip)
SCIP_CONS ** SCIPgetOrigConss(SCIP *scip)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
int SCIPhashmapGetNElements(SCIP_HASHMAP *hashmap)
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
SCIP_Bool SCIPhashmapIsEmpty(SCIP_HASHMAP *hashmap)
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
SCIP_RETCODE SCIPiisGreedyMakeIrreducible(SCIP_IIS *iis)
SCIP_RETCODE SCIPincludeIISfinderGreedy(SCIP *scip)
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
SCIP_RETCODE SCIPgetLongintParam(SCIP *scip, const char *name, SCIP_Longint *value)
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
void SCIPrandomPermuteIntArray(SCIP_RANDNUMGEN *randnumgen, int *array, int begin, int end)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPcheckCons(SCIP *scip, SCIP_CONS *cons, SCIP_SOL *sol, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool printreason, SCIP_RESULT *result)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInProb(SCIP_CONS *cons)
int SCIPconsGetNUses(SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetIISfinderFree(SCIP *scip, SCIP_IISFINDER *iisfinder,)
const char * SCIPiisfinderGetName(SCIP_IISFINDER *iisfinder)
SCIP_IISFINDERDATA * SCIPiisfinderGetData(SCIP_IISFINDER *iisfinder)
void SCIPiisfinderSetData(SCIP_IISFINDER *iisfinder, SCIP_IISFINDERDATA *iisfinderdata)
void SCIPiisfinderInfoMessage(SCIP_IIS *iis, SCIP_Bool printheaders)
SCIP_RETCODE SCIPsetIISfinderCopy(SCIP *scip, SCIP_IISFINDER *iisfinder,)
SCIP_RETCODE SCIPincludeIISfinderBasic(SCIP *scip, SCIP_IISFINDER **iisfinder, const char *name, const char *desc, int priority, SCIP_DECL_IISFINDEREXEC((*iisfinderexec)), SCIP_IISFINDERDATA *iisfinderdata)
SCIP_RANDNUMGEN * SCIPiisGetRandnumgen(SCIP_IIS *iis)
void SCIPiisAddNNodes(SCIP_IIS *iis, SCIP_Longint nnodes)
SCIP * SCIPiisGetSubscip(SCIP_IIS *iis)
void SCIPiisSetSubscipIrreducible(SCIP_IIS *iis, SCIP_Bool irreducible)
SCIP_Longint SCIPiisGetNNodes(SCIP_IIS *iis)
SCIP_Real SCIPiisGetTime(SCIP_IIS *iis)
SCIP_Bool SCIPiisIsSubscipInfeasible(SCIP_IIS *iis)
void SCIPiisSetSubscipInfeasible(SCIP_IIS *iis, SCIP_Bool infeasible)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
#define SCIPduplicateBlockMemoryArray(scip, ptr, source, num)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPcreateSolCopyOrig(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
SCIP_RETCODE SCIPsolve(SCIP *scip)
SCIP_Longint SCIPgetNTotalNodes(SCIP *scip)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPvarGetLbOriginal(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbOriginal(SCIP_VAR *var)
SCIPfreeSol(scip, &heurdata->sol))
assert(minobj< SCIPgetCutoffbound(scip))
static SCIP_RETCODE deletionFilterBatch(SCIP_IIS *iis, SCIP_Real timelim, SCIP_Longint nodelim, SCIP_Bool removebounds, SCIP_Bool silent, SCIP_Real timelimperiter, SCIP_Longint nodelimperiter, SCIP_Bool conservative, int initbatchsize, int maxbatchsize, SCIP_Real batchingfactor, SCIP_Real batchingoffset, int batchupdateinterval, SCIP_Bool *alldeletionssolved)
#define DEFAULT_INITBATCHSIZE
static SCIP_RETCODE revertBndChgs(SCIP *scip, SCIP_VAR **vars, SCIP_Real *bounds, int *idxs, int ndelbounds, SCIP_Bool islb)
#define DEFAULT_MAXRELBATCHSIZE
#define DEFAULT_INITRELBATCHSIZE
static SCIP_RETCODE execIISfinderGreedy(SCIP_IIS *iis, SCIP_IISFINDERDATA *iisfinderdata, SCIP_RESULT *result)
#define DEFAULT_BATCHINGOFFSET
static SCIP_RETCODE deletionSubproblem(SCIP_IIS *iis, SCIP_CONS **conss, SCIP_VAR **vars, int *idxs, int ndels, SCIP_Real timelim, SCIP_Real timelimperiter, SCIP_Longint nodelim, SCIP_Longint nodelimperiter, SCIP_Bool conservative, SCIP_Bool delbounds, SCIP_Bool islb, SCIP_Bool *deleted, SCIP_Bool *stop, SCIP_Bool *alldeletionssolved)
static SCIP_RETCODE revertConssDeletions(SCIP *scip, SCIP_CONS **conss, int *idxs, int ndelconss, SCIP_Bool releaseonly)
#define DEFAULT_DELAFTERADD
#define DEFAULT_TIMELIMPERITER
#define IISFINDER_PRIORITY
#define DEFAULT_DYNAMICREORDERING
#define DEFAULT_BATCHUPDATEINTERVAL
#define DEFAULT_NODELIMPERITER
#define DEFAULT_CONSERVATIVE
static SCIP_RETCODE updateBatchsize(SCIP *scip, int initbatchsize, int maxbatchsize, int iteration, SCIP_Bool resettoinit, SCIP_Real batchingfactor, SCIP_Real batchingoffset, int batchupdateinterval, int *batchsize)
#define DEFAULT_BATCHINGFACTOR
#define DEFAULT_MAXBATCHSIZE
static SCIP_RETCODE setLimits(SCIP *scip, SCIP_IIS *iis, SCIP_Real timelim, SCIP_Real timelimperiter, SCIP_Longint nodelim, SCIP_Longint nodelimperiter)
static SCIP_RETCODE additionFilterBatch(SCIP_IIS *iis, SCIP_Real timelim, SCIP_Longint nodelim, SCIP_Bool silent, SCIP_Real timelimperiter, SCIP_Longint nodelimperiter, SCIP_Bool dynamicreordering, int initbatchsize, int maxbatchsize, SCIP_Real batchingfactor, SCIP_Real batchingoffset, int batchupdateinterval)
static SCIP_RETCODE additionSubproblem(SCIP_IIS *iis, SCIP_Real timelim, SCIP_Real timelimperiter, SCIP_Longint nodelim, SCIP_Longint nodelimperiter, SCIP_Bool *feasible, SCIP_Bool *stop)
greedy deletion and addition filter heuristic to compute IISs
#define BMSclearMemory(ptr)
data structures for irreducible infeasible subsystems (IIS)
struct SCIP_Cons SCIP_CONS
#define SCIP_DECL_IISFINDERFREE(x)
#define SCIP_DECL_IISFINDEREXEC(x)
struct SCIP_IISfinder SCIP_IISFINDER
struct SCIP_IISfinderData SCIP_IISFINDERDATA
#define SCIP_DECL_IISFINDERCOPY(x)
struct SCIP_HashMap SCIP_HASHMAP
struct SCIP_HashMapEntry SCIP_HASHMAPENTRY
struct SCIP_RandNumGen SCIP_RANDNUMGEN
enum SCIP_Result SCIP_RESULT
enum SCIP_Retcode SCIP_RETCODE
@ SCIP_STATUS_TOTALNODELIMIT
@ SCIP_STATUS_BESTSOLLIMIT
@ SCIP_STATUS_PRIMALLIMIT
@ SCIP_STATUS_USERINTERRUPT
@ SCIP_STATUS_STALLNODELIMIT
@ SCIP_STATUS_RESTARTLIMIT
enum SCIP_Status SCIP_STATUS