benders_gcg.c
Go to the documentation of this file.
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
45 #define BENDERS_SHAREAUXVARS FALSE /**< should this Benders' share the highest priority Benders' aux vars */
105 assert(GCGoriginalVarIsLinking(GCGpricingVarGetOrigvars(probvars[i])[0]) || (GCGvarGetBlock(GCGpricingVarGetOrigvars(probvars[i])[0]) == probnumber));
109 SCIPdebugMessage("pricingobj var <%s> %f\n", SCIPvarGetName(probvars[i]), varGetObj(probvars[i]));
115 /** sets the pricing problem variable values for the original problem using the decomposed problem solution
116 * There is a mapping between the original problem and the variables from the pricing problems. This mapping is used to
117 * identify the variables of the original problem corresponding to the pricing problem variables.
119 * An artificial solution can be constructed, which is indicated by the vals array provided as NULL. An artifical
120 * solution sets the original problem variables corresponding to pricing problems variables to their bounds. An
121 * artificial solution is created if branching candidates need to be found. Branching candidates only come from the
122 * master problem, so the variable values of the pricing problem variables does not affect the branching variable
160 /* all variables should be associated with a single original variable. This is because no reformulation has
162 * TODO: This appears not to be true. Need to find out why multiple original problem variables are associated
168 /* for all variables that are from the subproblems, they are set to their bounds if the solution is being
188 /* identifying whether the variable is a master problem variable. The variable is a master problem variable if
189 * there is a mapping from the subproblem to the master problem. If a mapping exists, then the variable value
200 SCIPdebugMsg(masterprob, "setting the value of <%s> (dw variable <%s>) to %g in the original solution.\n",
214 /** sets the master problem values for the original problem using the decomposed problem solution */
252 /* all master variables should be associated with a single original variable. This is because no reformulation has
259 SCIPdebugMsg(masterprob, "setting the value of <%s> (master variable <%s>) to %g in the original solution.\n",
317 SCIP_CALL( setOriginalProblemMasterValues(origprob, masterprob, benders, origsol, vars, vals, nvars) );
328 /* it is only possible to use the subproblem solutions if the subproblems are enabled. The subproblems are
345 /* the branching candidates come from the master problem solution. However, we need a full solution to pass to the
346 * original problem to find the branching candidate. So the subproblem variables are set to their bounds, creating
349 * It may occur that the subproblem has not been solved yet, this can happen if the subproblem is independent.
355 SCIP_CALL( setOriginalProblemPricingValues(origprob, masterprob, benders, origsol, vars, NULL, nvars, &success) );
363 SCIP_CALL( setOriginalProblemPricingValues(origprob, masterprob, benders, origsol, vars, vals, nvars, &success) );
374 /* if the values were not set correctly, then the solution is not updated. This should only happen when the timelimit
388 /* if the solution is NULL, then the solution comes from the relaxation. Thus, it should be stored in the
389 * bendersdata. When it is not NULL, then solution comes from a heuristic. So this solution should be passed to the
403 /** @bug The solution doesn't have to be accepted, numerics might bite us, so the transformation might fail.
448 SCIP_CALL( SCIPmergeBendersSubproblemIntoMaster(masterprob, benders, varmap, consmap, probnumber) );
451 /* copying the variable data from the pricing variables to the newly created master variables */
467 /** performs a merge of subproblems into the master problem. The subproblems are merged into the master problem if the
468 * infeasibility can not be resolved through the addition of cuts. This could be because the appropriate cuts are not
469 * available in the Benders' decomposition framework, or that the subproblem has been infeasible for a set number of
489 /* adding the priority merge candidates. If there are no priority candidates, then the first merge candidate is
498 /* if there were no priority candidates and there is a merge candidate, then only a single merge candidate is
516 /* TODO: Implement all necessary Benders' decomposition methods. The methods with an #ifdef SCIP_DISABLED_CODE ... #else #define ... are optional */
537 /** presolving initialization method of constraint handler (called when presolving is about to begin) */
557 /** solving process deinitialization method of Benders' decomposition (called before branch and bound process data is freed) */
577 /** mapping method between the master problem variables and the subproblem variables of Benders' decomposition */
588 /* if there is no corresponding master variable for the input variable, then NULL is returned */
598 /* checking whether the original variable is associated with any master problem variables. This is identified by
600 * NOTE: previously, only the linking variables were master variables. As such, the following check was to find
601 * only the original variables corresponding to linking variables. Since linking constraints, and their associated
616 /* checking whether the original variable is associated with any master problem variables. This is identified by
618 * NOTE: previously, only the linking variables were master variables. As such, the following check was to find
619 * only the original variables corresponding to linking variables. Since linking constraints, and their associated
622 /* checking whether the original variable is associated with any master problem variables. This is identified by
625 * If the pricing variable is requested, then there are two options. The first is that the pricing variable is a
626 * linking variable. The second is that the pricing variable has been directly copied to the master problem since
631 /* if the original variable is a linking variable, then the linking pricing variable is retrieved */
666 SCIP_CALL( mergeSubproblemsIntoMaster(scip, benders, mergecands, npriomergecands, nmergecands, merged) );
680 /** the method for creating the Benders' decomposition subproblem. This method is called during the initialization stage
683 * This method must create the SCIP instance for the subproblem and add the required variables and constraints. In
684 * addition, the settings required for the solving the problem must be set here. However, some settings will be
685 * overridden by the standard solving method included in the Benders' decomposition framework. If a special solving
705 * This is required because the variables are added to the pricing problems with a zero coefficient. In the DW
706 * context, this is appropriate because the objective coefficients are constantly changing. In the BD context, the
735 SCIP_CALL( SCIPincludeBendersBasic(scip, &benders, BENDERS_NAME, BENDERS_DESC, BENDERS_PRIORITY,
GCG interface methods.
static SCIP_RETCODE setOriginalProblemMasterValues(SCIP *origprob, SCIP *masterprob, SCIP_BENDERS *benders, SCIP_SOL *origsol, SCIP_VAR **vars, SCIP_Real *vals, int nvars)
Definition: benders_gcg.c:216
SCIP_VAR ** GCGoriginalVarGetMastervars(SCIP_VAR *var)
Definition: gcgvar.c:587
SCIP_RETCODE GCGaddDataAuxiliaryVar(SCIP *scip, SCIP_VAR *auxiliaryvar, int probnumber)
Definition: gcgvar.c:1554
static SCIP_DECL_BENDERSINITPRE(bendersInitpreGcg)
Definition: benders_gcg.c:539
static SCIP_DECL_BENDERSGETVAR(bendersGetvarGcg)
Definition: benders_gcg.c:579
SCIP * GCGgetPricingprob(SCIP *scip, int pricingprobnr)
Definition: relax_gcg.c:3939
SCIP_VAR * GCGoriginalVarGetPricingVar(SCIP_VAR *var)
Definition: gcgvar.c:216
GCG Benders' decomposition.
various SCIP helper methods
SCIP_RETCODE GCGrelaxUpdateCurrentSol(SCIP *scip)
Definition: relax_gcg.c:4796
static SCIP_RETCODE mergeSubproblemsIntoMaster(SCIP *masterprob, SCIP_BENDERS *benders, int *mergecands, int npriomergecands, int nmergecands, SCIP_Bool *merged)
Definition: benders_gcg.c:473
static SCIP_RETCODE setSubproblemObjs(SCIP_BENDERS *benders, int probnumber)
Definition: benders_gcg.c:83
static SCIP_DECL_BENDERSPOSTSOLVE(bendersPostsolveGcg)
Definition: benders_gcg.c:644
SCIP_SOL * SCIPbendersGetRelaxSol(SCIP_BENDERS *benders)
Definition: benders_gcg.c:753
static SCIP_RETCODE mergeSubproblemIntoMaster(SCIP *masterprob, SCIP_BENDERS *benders, int probnumber)
Definition: benders_gcg.c:426
static SCIP_DECL_BENDERSEXITSOL(bendersExitsolGcg)
Definition: benders_gcg.c:559
Definition: benders_gcg.c:54
GCG relaxator.
SCIP_VAR ** GCGpricingVarGetOrigvars(SCIP_VAR *var)
Definition: gcgvar.c:1015
static SCIP_DECL_BENDERSCREATESUB(bendersCreatesubGcg)
Definition: benders_gcg.c:689
SCIP_RETCODE SCIPincludeBendersGcg(SCIP *scip, SCIP *origprob)
Definition: benders_gcg.c:719
static SCIP_RETCODE setOriginalProblemPricingValues(SCIP *origprob, SCIP *masterprob, SCIP_BENDERS *benders, SCIP_SOL *origsol, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Bool *success)
Definition: benders_gcg.c:126
public methods for GCG variables
SCIP_RETCODE GCGcopyPricingvarDataToMastervar(SCIP *scip, SCIP_VAR *pricingvar, SCIP_VAR *mastervar)
Definition: gcgvar.c:367
SCIP_VAR ** GCGlinkingVarGetPricingVars(SCIP_VAR *var)
Definition: gcgvar.c:409
static SCIP_RETCODE createOriginalProblemSolution(SCIP *masterprob, SCIP_BENDERS *benders, SCIP_SOL *sol, SCIP_Bool artificial)
Definition: benders_gcg.c:271