36#define IISFINDER_NAME "greedy"
37#define IISFINDER_DESC "greedy deletion or addition constraint deletion"
38#define IISFINDER_PRIORITY 8000
40#define DEFAULT_TIMELIMPERITER 1e+20
41#define DEFAULT_NODELIMPERITER -1L
43#define DEFAULT_ADDITIVE TRUE
44#define DEFAULT_CONSERVATIVE TRUE
45#define DEFAULT_DELAFTERADD TRUE
46#define DEFAULT_DYNAMICREORDERING TRUE
48#define DEFAULT_INITBATCHSIZE 16
49#define DEFAULT_INITRELBATCHSIZE 0.03125
50#define DEFAULT_MAXBATCHSIZE INT_MAX
51#define DEFAULT_MAXRELBATCHSIZE 0.5
52#define DEFAULT_BATCHINGFACTOR 2.0
53#define DEFAULT_BATCHINGOFFSET 0.0
54#define DEFAULT_BATCHUPDATEINTERVAL 1
62struct SCIP_IISfinderData
78 int batchupdateinterval;
102 mintimelim =
MIN(timelim - currtime, timelimperiter);
103 mintimelim =
MAX(mintimelim, 0);
112 assert( globalnodelim >= 0 );
114 if( globalnodelim == -1 && nodelimperiter == -1 )
118 else if( globalnodelim == -1 || nodelimperiter == -1 )
143 for (
i = 0;
i < ndelbounds; ++
i)
172 for(
i = 0;
i < ndelconss; ++
i )
181 copycons = conss[idxs[
i]];
200 int batchupdateinterval,
205 *batchsize = initbatchsize;
206 else if( iteration % batchupdateinterval == 0 )
207 *batchsize = (int)ceil(batchingfactor * (*batchsize) + batchingoffset);
210 *batchsize =
MIN(*batchsize, maxbatchsize);
211 *batchsize =
MAX(*batchsize, 1);
253 for (
i = 0;
i < ndels; ++
i)
281 for (
i = 0;
i < ndels; ++
i)
304 SCIPdebugMsg(
scip,
"Error in sub-scip with deleted constraints / bounds. Re-adding them.\n");
314 *alldeletionssolved =
FALSE;
336 *alldeletionssolved =
FALSE;
348 *alldeletionssolved =
FALSE;
349 SCIPdebugMsg(
scip,
"Some limit reached. Keeping bounds / constraints removed if non-conservative.\n");
355 if( conservative && delbounds )
366 SCIPdebugMsg(
scip,
"Subproblem with bounds / constraints removed infeasible. Keep them removed.\n");
380 SCIPdebugMsg(
scip,
"Found solution to subproblem with bounds / constraints removed. Add them back.\n");
393 *alldeletionssolved =
FALSE;
394 SCIPerrorMessage(
"Unexpected return status %d in removed bounds subproblem. Exiting...\n", status);
433 SCIPdebugMsg(
scip,
"Error in sub-scip with added constraints. Keep added constraints.\n");
459 SCIPdebugMsg(
scip,
"Some limit reached. Added constraint batch failed to induce infeasibility. Continue adding.\n");
463 SCIPdebugMsg(
scip,
"Subproblem with added constraints infeasible. Final batch of constraints added.\n");
471 SCIPdebugMsg(
scip,
"Found solution of subproblem with added constraints. Keep adding constraint batches.\n");
502 int batchupdateinterval,
520 int batchsize = initbatchsize;
535 assert( initbatchsize >= 1 );
536 assert( maxbatchsize >= 1 );
537 initbatchsize =
MIN(initbatchsize, maxbatchsize);
553 for (
i = 0;
i < nconss; ++
i)
565 SCIP_CALL(
updateBatchsize(
scip, initbatchsize, maxbatchsize, iteration, !deleted, batchingfactor, batchingoffset, batchupdateinterval, &batchsize) );
569 while(
i < nconss && k < batchsize )
582 conservative,
FALSE,
FALSE, &deleted, &stopiter, alldeletionssolved) );
583 if( !silent && deleted )
590 if( !deleted && k > initbatchsize )
626 SCIP_CALL(
updateBatchsize(
scip, initbatchsize, maxbatchsize, iteration, !deleted, batchingfactor, batchingoffset, batchupdateinterval, &batchsize) );
631 while(
i <
nvars && k < batchsize )
645 conservative,
TRUE,
TRUE, &deleted, &stopiter, alldeletionssolved) );
648 if( !silent && deleted )
653 conservative,
TRUE,
FALSE, &deleted, &stopiter, alldeletionssolved) );
657 if( !silent && deleted )
661 if( !deleted && k > initbatchsize )
691 int batchupdateinterval
723 assert( initbatchsize >= 1 );
724 assert( maxbatchsize >= 1 );
725 initbatchsize =
MIN(initbatchsize, maxbatchsize);
726 batchsize = initbatchsize;
738 for(
i = 0;
i < nconss; ++
i )
756 for (
i = 0;
i < nconss; ++
i)
769 while(
i < nconss && k < batchsize )
771 if( !inIS[order[
i]] )
775 inIS[order[
i]] =
TRUE;
789 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;
853 for(
i = 0;
i < nconss; ++
i )
855 if( !inIS[order[
i]] )
911 initbatchsize = iisfinderdata->initrelbatchsize > 0.0
912 ? (int)ceil(iisfinderdata->initrelbatchsize * maxbatchsize) :
MIN(iisfinderdata->initbatchsize, maxbatchsize);
913 maxbatchsize = (int)ceil(iisfinderdata->maxrelbatchsize * maxbatchsize);
914 maxbatchsize =
MIN(iisfinderdata->maxbatchsize, maxbatchsize);
915 initbatchsize =
MAX(initbatchsize, 1);
916 maxbatchsize =
MAX(maxbatchsize, 1);
920 if( iisfinderdata->additive )
927 iisfinderdata->nodelimperiter, iisfinderdata->dynamicreordering, initbatchsize, maxbatchsize,
928 iisfinderdata->batchingfactor, iisfinderdata->batchingoffset, iisfinderdata->batchupdateinterval) );
940 iisfinderdata->nodelimperiter, iisfinderdata->conservative, initbatchsize, maxbatchsize,
941 iisfinderdata->batchingfactor, iisfinderdata->batchingoffset, iisfinderdata->batchupdateinterval,
942 &alldeletionssolved) );
945 if( alldeletionssolved && initbatchsize == 1 )
949 if( iisfinderdata->delafteradd && iisfinderdata->additive )
953 SCIPdebugMsg(
scip,
"----- STARTING GREEDY DELETION ALGORITHM FOLLOWING COMPLETED ADDITION ALGORITHM -----\n");
956 iisfinderdata->nodelimperiter, iisfinderdata->conservative, initbatchsize, maxbatchsize,
957 iisfinderdata->batchingfactor, iisfinderdata->batchingoffset, iisfinderdata->batchupdateinterval,
958 &alldeletionssolved) );
961 if( alldeletionssolved && initbatchsize == 1 )
1042 iisfinderExecGreedy, iisfinderdata) );
1053 "time limit of optimization process for each individual subproblem",
1058 "node limit of optimization process for each individual subproblem",
1063 "should an additive constraint approach be used instead of deletion",
1068 "should an unsolved problem (by e.g. user interrupt, node limit, time limit) be considered feasible when deleting constraints",
1073 "should the deletion routine be performed after the addition routine (in the case of additive)",
1078 "should satisfied constraints outside the batch of an intermediate solve be added during the additive method",
1083 "the initial batchsize for the first iteration, ignored if initrelbatchsize is positive",
1088 "the initial batchsize relative to the original problem for the first iteration (0.0: use initbatchsize)",
1093 "the maximum batchsize per iteration",
1098 "the maximum batchsize relative to the original problem per iteration",
1103 "the factor with which the batchsize is multiplied in every update",
1108 "the offset which is added to the multiplied batchsize in every update",
1113 "the number of iterations to run with a constant batchsize before updating (1: always update)",
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)
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)
#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)
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_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