74#define RELAX_NAME "benders"
75#define RELAX_DESC "applies default Benders' decomposition and solves the problem"
76#define RELAX_PRIORITY 1
79#define DEFAULT_CONTORIG FALSE
80#define DEFAULT_NODELIMIT -1LL
187 for(
i = 0;
i < nconsvars;
i++ )
205 SCIPerrorMessage(
"It is not possible to copy constraint <%s>. Benders' decomposition could not be applied.\n",
246 relaxdata->decomp = decomp;
254 relaxdata->nsubproblems = nblocks;
260 SCIP_CALL(
SCIPcopyPlugins(
scip, relaxdata->masterprob,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
261 TRUE,
TRUE,
TRUE,
FALSE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE, &
valid) );
275 for(
i = 0;
i < nblocks;
i++ )
280 SCIP_CALL(
SCIPcopyPlugins(
scip, relaxdata->subproblems[
i],
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
281 TRUE,
TRUE,
TRUE,
FALSE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE,
TRUE, &
valid) );
308 for(
i = 0;
i < nblocks;
i++ )
314 for(
i = 0;
i < nconss;
i++ )
319 if( conslabels[
i] >= 0 )
321 assert(conslabels[
i] < relaxdata->nsubproblems);
352 relaxdata->decompapplied =
TRUE;
378 masterprob = relaxdata->masterprob;
383 if( bestsol ==
NULL )
391 decomp = relaxdata->decomp;
405 if( varslabels[
i] < 0 )
408 if( mappedvar !=
NULL )
465 masterprob = relaxdata->masterprob;
478 for(
i = 0;
i < relaxdata->nsubproblems;
i++)
538 for(
i = 0;
i < relaxdata->nsubproblems;
i++ )
554 for(
i = 0;
i < relaxdata->nsubproblems;
i++ )
556 subproblem = relaxdata->subproblems[
i];
564 decomp = relaxdata->decomp;
586 subproblem = varslabels[
i] >= 0;
589 solscip = relaxdata->subproblems[varslabels[
i]];
590 varmap = relaxdata->subvarmaps[varslabels[
i]];
594 solscip = relaxdata->masterprob;
595 varmap = relaxdata->mastervarmap;
606 if( nlprelaxation && nlpsols !=
NULL )
609 bestsol = nlpsols[varslabels[
i]];
615 if( mappedvar !=
NULL )
628 for(
i = relaxdata->nsubproblems - 1;
i >= 0;
i-- )
630 if( nlpsols[
i] !=
NULL )
660 masterprob = relaxdata->masterprob;
669 for(
i = 0;
i < relaxdata->nsubproblems;
i++)
693 (*infeasible) =
FALSE;
718 "The solution found by the Benders' decomposition algorithm is not valid for the original problem.\n");
746 if( relaxdata->decompapplied )
749 for(
i = relaxdata->nsubproblems - 1;
i >= 0;
i-- )
757 for(
i = relaxdata->nsubproblems - 1;
i >= 0;
i-- )
766 relaxdata->decompapplied =
FALSE;
776#define relaxCopyBenders NULL
777#define relaxInitBenders NULL
778#define relaxExitBenders NULL
779#define relaxExitsolBenders NULL
841 if( benders ==
NULL )
843 SCIPerrorMessage(
"The default Benders' decomposition plugin is required to apply Benders' decomposition using the input decomposition.");
872 if( !relaxdata->decompapplied )
881 "\nApplying Benders' decomposition and solving the decomposed problem.\n\n");
887 if( relaxdata->nodelimit >= 0 )
903 "\nBenders' decomposition solve has completed.\n\n");
924 if( !relaxdata->contorig &&
969 "continue solving the original SCIP instance if the optimal solution is not found by Benders' decomposition",
973 "the node limit applied only to the Benders' decomposition solve (-1 indicates that the original SCIP node limit is used).",
997 if( !relaxdata->decompapplied )
1000 return relaxdata->masterprob;
default Benders' decomposition plugin
#define DEFAULT_NODELIMIT
SCIP_RETCODE SCIPcreateBendersDefault(SCIP *scip, SCIP **subproblems, int nsubproblems)
SCIP_RETCODE SCIPincludeBendersDefault(SCIP *scip)
SCIP_RETCODE SCIPcopyPlugins(SCIP *sourcescip, SCIP *targetscip, SCIP_Bool copyreaders, SCIP_Bool copypricers, SCIP_Bool copyconshdlrs, SCIP_Bool copyconflicthdlrs, SCIP_Bool copypresolvers, SCIP_Bool copyrelaxators, SCIP_Bool copyseparators, SCIP_Bool copycutselectors, SCIP_Bool copypropagators, SCIP_Bool copyheuristics, SCIP_Bool copyeventhdlrs, SCIP_Bool copynodeselectors, SCIP_Bool copybranchrules, SCIP_Bool copyiisfinders, SCIP_Bool copydisplays, SCIP_Bool copydialogs, SCIP_Bool copytables, SCIP_Bool copyexprhdlrs, SCIP_Bool copynlpis, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
SCIP_RETCODE SCIPgetConsCopy(SCIP *sourcescip, SCIP *targetscip, SCIP_CONS *sourcecons, SCIP_CONS **targetcons, SCIP_CONSHDLR *sourceconshdlr, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *name, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode, SCIP_Bool global, SCIP_Bool *valid)
SCIP_RETCODE SCIPcopyParamSettings(SCIP *sourcescip, SCIP *targetscip)
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
void SCIPgetDecomps(SCIP *scip, SCIP_DECOMP ***decomps, int *ndecomps, SCIP_Bool original)
int SCIPdecompGetNBlocks(SCIP_DECOMP *decomp)
void SCIPdecompGetConsLabels(SCIP_DECOMP *decomp, SCIP_CONS **conss, int *labels, int nconss)
void SCIPdecompGetVarsLabels(SCIP_DECOMP *decomp, SCIP_VAR **vars, int *labels, int nvars)
SCIP_RETCODE SCIPfree(SCIP **scip)
SCIP_RETCODE SCIPcreate(SCIP **scip)
SCIP_STATUS SCIPgetStatus(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
SCIP_RETCODE SCIPaddVar(SCIP *scip, SCIP_VAR *var)
const char * SCIPgetProbName(SCIP *scip)
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
SCIP_CONS ** SCIPgetConss(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNConss(SCIP *scip)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
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 SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
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 SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
int SCIPgetNActiveBenders(SCIP *scip)
SCIP_BENDERS * SCIPfindBenders(SCIP *scip, const char *name)
SCIP_RETCODE SCIPfreeBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, int probnumber)
SCIP_RETCODE SCIPsetupBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, SCIP_SOL *sol, int probnumber, SCIP_BENDERSENFOTYPE type)
SCIP_RETCODE SCIPsolveBendersSubproblem(SCIP *scip, SCIP_BENDERS *benders, SCIP_SOL *sol, int probnumber, SCIP_Bool *infeasible, SCIP_Bool solvecip, SCIP_Real *objective)
int SCIPbendersGetNSubproblems(SCIP_BENDERS *benders)
SCIP * SCIPbendersSubproblem(SCIP_BENDERS *benders, int probnumber)
SCIP_RETCODE SCIPgetConsNVars(SCIP *scip, SCIP_CONS *cons, int *nvars, SCIP_Bool *success)
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsMarkedPropagate(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_RETCODE SCIPgetConsVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int varssize, SCIP_Bool *success)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsLocal(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsStickingAtNode(SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPallocClearBlockMemory(scip, ptr)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocClearBufferArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPfreeBlockMemory(scip, ptr)
int SCIPgetNNlpis(SCIP *scip)
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
SCIP_RETCODE SCIPincludeRelax(SCIP *scip, const char *name, const char *desc, int priority, int freq, SCIP_DECL_RELAXCOPY((*relaxcopy)), SCIP_DECL_RELAXFREE((*relaxfree)), SCIP_DECL_RELAXINIT((*relaxinit)), SCIP_DECL_RELAXEXIT((*relaxexit)), SCIP_DECL_RELAXINITSOL((*relaxinitsol)), SCIP_DECL_RELAXEXITSOL((*relaxexitsol)), SCIP_DECL_RELAXEXEC((*relaxexec)), SCIP_RELAXDATA *relaxdata)
SCIP_RELAX * SCIPfindRelax(SCIP *scip, const char *name)
SCIP_RELAXDATA * SCIPrelaxGetData(SCIP_RELAX *relax)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_RETCODE SCIPcreateNLPSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPaddSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *stored)
SCIP_RETCODE SCIPcheckSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_RETCODE SCIPpresolve(SCIP *scip)
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
SCIP_RETCODE SCIPsolve(SCIP *scip)
SCIP_Real SCIPgetDualbound(SCIP *scip)
SCIP_Bool SCIPvarIsInitial(SCIP_VAR *var)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_RETCODE SCIPcreateVarImpl(SCIP *scip, SCIP_VAR **var, const char *name, SCIP_Real lb, SCIP_Real ub, SCIP_Real obj, SCIP_VARTYPE vartype, SCIP_IMPLINTTYPE impltype, SCIP_Bool initial, SCIP_Bool removable, SCIP_DECL_VARDELORIG((*vardelorig)), SCIP_DECL_VARTRANS((*vartrans)), SCIP_DECL_VARDELTRANS((*vardeltrans)), SCIP_DECL_VARCOPY((*varcopy)), SCIP_VARDATA *vardata)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Bool SCIPvarIsRemovable(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_IMPLINTTYPE SCIPvarGetImplType(SCIP_VAR *var)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIPfreeSol(scip, &heurdata->sol))
SCIPcreateSol(scip, &heurdata->sol, heur))
assert(minobj< SCIPgetCutoffbound(scip))
public methods for Benders' decomposition
public methods for relaxation handlers
static SCIP_RETCODE addVariableToBendersProblem(SCIP *scip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_VAR *sourcevar)
static SCIP_RETCODE createOriginalSolution(SCIP *scip, SCIP_RELAX *relax, SCIP_Bool *infeasible)
SCIP_RETCODE SCIPincludeRelaxBenders(SCIP *scip)
static SCIP_RETCODE freeDecomposition(SCIP *scip, SCIP_RELAX *relax)
static SCIP_RETCODE addInitialSolution(SCIP *scip, SCIP_RELAXDATA *relaxdata)
static SCIP_RETCODE freeBendersSubproblems(SCIP *scip, SCIP_RELAX *relax)
SCIP * SCIPgetMasterProblemRelaxBenders(SCIP *scip)
static SCIP_RETCODE solveBendersSubproblems(SCIP *scip, SCIP_RELAX *relax, SCIP_Bool *infeasible)
#define relaxExitsolBenders
static SCIP_RETCODE getNlpSolution(SCIP *scip, SCIP_SOL **nlpsol)
static SCIP_Bool masterSolutionExists(SCIP *scip, SCIP_RELAX *relax)
static SCIP_RETCODE setSolutionValues(SCIP *scip, SCIP_RELAX *relax, SCIP_SOL *sol)
static SCIP_RETCODE addConstraintToBendersProblem(SCIP *scip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_CONS *sourcecons)
static SCIP_RETCODE applyDecomposition(SCIP *scip, SCIP_RELAX *relax, SCIP_DECOMP *decomp)
type definitions for Benders' decomposition methods
struct SCIP_Benders SCIP_BENDERS
@ SCIP_BENDERSENFOTYPE_CHECK
struct SCIP_Cons SCIP_CONS
struct SCIP_Decomp SCIP_DECOMP
type definitions for message output methods
struct SCIP_HashMap SCIP_HASHMAP
type definitions for relaxators
#define SCIP_DECL_RELAXFREE(x)
#define SCIP_DECL_RELAXINITSOL(x)
struct SCIP_Relax SCIP_RELAX
#define SCIP_DECL_RELAXEXEC(x)
struct SCIP_RelaxData SCIP_RELAXDATA
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
type definitions for problem statistics
@ SCIP_STATUS_PRIMALLIMIT
@ SCIP_STATUS_USERINTERRUPT
enum SCIP_Status SCIP_STATUS