solver_gcg.cpp
Go to the documentation of this file.
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
70#define SOLVER_ENABLED TRUE /**< indicates whether the exact solving method of the solver should be enabled */
71#define SOLVER_HEU_ENABLED TRUE /**< indicates whether the heuristic solving method of the solver should be enabled */
79#define DEFAULT_NODELIMITFAC 1.25 /**< factor by which to increase node limit for heuristic pricing */
80#define DEFAULT_STALLNODELIMITFAC 1.25 /**< factor by which to increase stalling node limit for heuristic pricing */
81#define DEFAULT_GAPLIMITFAC 0.8 /**< factor by which to decrease gap limit for heuristic pricing */
82#define DEFAULT_SOLLIMITFAC 1.5 /**< factor by which to increase solution limit for heuristic pricing */
85#define DEFAULT_ENABLE_WARNINGS FALSE /**< should warnings (of pricing problems) be enabled by default */
102 int* nbasicpricingconss; /**< array storing the basic number of constraints of the pricing problems */
103 int* relpricingprobidxs; /**< indices of the relevant pricing problems (-1 if pp is not relevant) */
111 SCIP_Real stallnodelimitfac; /**< factor by which to increase stalling node limit for heuristic pricing */
155 SCIP_CALL( SCIPduplicateMemoryArray(nestedsolverdata->origprob, &nestedsolverdata->settingsfile, solverdata->settingsfile, strlen(solverdata->settingsfile)+1) );
247 * creates and initializes the GCG data structure for a given pricing problem, calls the detection if necessary
376 SCIPinfoMessage(solverdata->origprob, NULL, "No decomposition found for pricing problem %d.\n", probnr);
394 SCIPdebugMessage("Problem %d structure detected, stage: %d\n", probnr, SCIPgetStage(subgcgorig));
516 SCIP_CALL( SCIPgetConsCopy(pricingprob, subgcgorig, cons, &newcons, SCIPconsGetHdlr(cons), varmap, NULL, NULL,
532 SCIPerrorMessage("Could not copy constraint %s (conshdlr: %s)!\n", SCIPconsGetName(cons), SCIPconshdlrGetName(SCIPconsGetHdlr(cons)));
612 GCGconshdlrDecompTranslateNBestOrigPartialdecs(subgcg, 1, TRUE, solverdata->translatesymmetry[probnr]);
669 SCIPwarningMessage(pricingprob, "Pricing problem %d terminated with retcode = %d, ignoring\n", probnr, retcode);
705 /* If the pricing problem is neither infeasible nor unbounded, try to extract feasible columns */
715 SCIP_CALL( getColumnsFromPricingprob(gcg, pricingprob, subgcgorig, varmap, probnr, solverdata->checksols) );
723 SCIPerrorMessage("Pricing problem %d has invalid status: %d\n", probnr, SCIPgetStatus(subgcgorig));
822/** solving process initialization method of pricing solver (called when branch and bound process is about to begin) */
853 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(solverdata->nbasicpricingconss), npricingprobs) );
857 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(solverdata->curstallnodelimit), npricingprobs) );
858 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(solverdata->translatesymmetry), npricingprobs) );
859 SCIP_CALL( SCIPallocBlockMemoryArray(masterprob, &(solverdata->relpricingprobidxs), npricingprobs));
895/** solving process deinitialization method of pricing solver (called before branch and bound process data is freed) */
928/** initialization method of pricing solver (called after problem was transformed and solver is active) */
931/** deinitialization method of pricing solver (called before transformed problem is freed and solver is active) */
954 SCIPdebugMessage("GCG Solver %" PRId64 ": solve start, probnr: %d, status: %u\n", solverdata->count+1, probnr, *status);
976 assert(SCIPisEQ(solverdata->origprob, SCIPgetDualbound(pricingprob), SCIPgetDualbound(subgcgorig)));
977 if( !SCIPisEQ(solverdata->origprob, SCIPgetDualbound(pricingprob), SCIPgetDualbound(subgcgorig)) )
979 SCIPerrorMessage("GCG Solver: optimal dualbound (gcg: %f, scip: %f) does not match: prob %d, iter %ld\n", SCIPgetDualbound(subgcgorig), SCIPgetDualbound(pricingprob), probnr, solverdata->count);
1016 SCIPdebugMessage("GCG Solver %" PRId64 ": solveHeur start, probnr: %d, status: %u\n", solverdata->count+1, probnr, *status);
1054 solverdata->curgaplimit[probnr] = MAX(solverdata->curgaplimit[probnr] - solverdata->startgaplimit, 0.0);
1064 SCIPwarningMessage(pricingprob, "GCG solver: cancelled with status %u\n", SCIPgetStatus(subgcgorig));
1068 SCIP_CALL( SCIPsetLongintParam(subgcgorig, "limits/nodes", solverdata->curnodelimit[probnr]) );
1069 SCIP_CALL( SCIPsetLongintParam(subgcgorig, "limits/stallnodes", solverdata->curstallnodelimit[probnr]) );
1073 SCIP_CALL( SCIPgetIntParam(solverdata->origprob, "pricing/masterpricer/heurpricingiters", &heurpricingiters) );
1074 SCIP_CALL( SCIPsetIntParam(subgcgorig, "pricing/masterpricer/heurpricingiters", heurpricingiters) );
1077 SCIPdebugMessage("Solving pricing problem %d heuristically (pointer: %p)\n", probnr, (void*)pricingprob);
1085 assert(SCIPisEQ(solverdata->origprob, SCIPgetDualbound(pricingprob), SCIPgetDualbound(subgcgorig)));
1086 if( !SCIPisEQ(solverdata->origprob, SCIPgetDualbound(pricingprob), SCIPgetDualbound(subgcgorig)) )
1088 SCIPerrorMessage("GCG Solver: optimal dualbound (gcg: %f, scip: %f) does not match: prob %d, iter %ld\n", SCIPgetDualbound(subgcgorig), SCIPgetDualbound(pricingprob), probnr, solverdata->count);
1115 SCIPdebugMessage("GCG solver -- update data for problem %d: varobjschanged = %u, varbndschanged = %u, consschanged = %u\n",
1127 SCIP_CALL( updateVars(solverdata->masterprob, solverdata, pricingprob, probnr, varobjschanged, varbndschanged) );
1179 SCIP_CALL( GCGpricerIncludeSolver(gcg, SOLVER_NAME, SOLVER_DESC, SOLVER_PRIORITY, SOLVER_HEU_ENABLED, SOLVER_ENABLED,
1180 solverUpdateGcg, solverSolveGcg, solverSolveHeurGcg, solverFreeGcg, solverInitGcg, solverExitGcg,
1194 &solverdata->startnodelimit, TRUE, DEFAULT_STARTNODELIMIT, -1LL, SCIP_LONGINT_MAX, NULL, NULL) );
1198 &solverdata->startstallnodelimit, TRUE, DEFAULT_STARTSTALLNODELIMIT, -1LL, SCIP_LONGINT_MAX, NULL, NULL) );
1210 &solverdata->nodelimitfac, TRUE, DEFAULT_NODELIMITFAC, 1.0, SCIPinfinity(origprob), NULL, NULL) );
1214 &solverdata->stallnodelimitfac, TRUE, DEFAULT_STALLNODELIMITFAC, 1.0, SCIPinfinity(origprob), NULL, NULL) );
1222 &solverdata->sollimitfac, TRUE, DEFAULT_SOLLIMITFAC, 1.0, SCIPinfinity(origprob), NULL, NULL) );
1229 "maximal number of presolving rounds (-1: unlimited, 0: off, will be overwritten by a settings file)",
Definition: objpricer_gcg.h:56
class storing partialdecs and the problem matrix
class storing (potentially incomplete) decompositions
Definition: class_detprobdata.h:110
GCG_EXPORT SCIP * getScip()
returns the corresponding scip data structure
Definition: class_detprobdata.cpp:934
GCG_EXPORT DETPROBDATA * getDetprobdata()
Gets the corresponding detprobdata.
Definition: class_partialdecomp.cpp:4725
bool isNested()
Checks whether this is a nested decomposition.
Definition: class_partialdecomp.cpp:4957
BLOCK_STRUCTURE * getBlockStructure(int block)
Returns the structure information of a specific block.
Definition: class_partialdecomp.cpp:4319
SCIP_RETCODE GCGconshdlrDecompTranslateNBestOrigPartialdecs(GCG *gcg, int n, SCIP_Bool completeGreedily, SCIP_Bool translateSymmetry)
translates n best unpresolved partialdec to a complete presolved one
Definition: cons_decomp.cpp:4629
void GCGconshdlrDecompFreeOrigOnExit(GCG *gcg, SCIP_Bool free)
sets freeing of detection data of original problem during exit to true
Definition: cons_decomp.cpp:3831
void GCGconshdlrDecompFreeDetprobdata(GCG *gcg)
Frees Detprobdata of the original and transformed/presolved problem.
Definition: cons_decomp.cpp:3810
DETPROBDATA * GCGconshdlrDecompGetDetprobdataOrig(GCG *gcg)
help method to access detprobdata for unpresolved problem
Definition: cons_decomp.cpp:3962
SCIP_RETCODE GCGdetectStructure(GCG *gcg, SCIP_RESULT *result)
interface method to detect the structure including presolving
Definition: cons_decomp.cpp:2093
PARTIALDECOMP * GCGconshdlrDecompGetPartialdecFromID(GCG *gcg, int partialdecid)
local method to find a partialdec for a given id or NULL if no partialdec with such id is found
Definition: cons_decomp.cpp:281
constraint handler for structure detection
C++ interface of cons_decomp.
constraint handler for storing the branching decisions at each node of the tree
#define SCIP_MAXSTRLEN
#define SCIP_Longint
#define SCIP_Bool
#define MIN(x, y)
#define SCIP_Real
#define MAX(x, y)
#define SCIP_CALL_ABORT(x)
#define SCIP_LONGINT_MAX
#define SCIP_CALL(x)
#define TRUE
#define FALSE
#define infinity
GCG interface methods.
SCIP plugins for generic column generation.
SCIP_RETCODE SCIPcopyOrigVars(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars)
SCIP_RETCODE SCIPcopyOrigConss(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool enablepricing, SCIP_Bool *valid)
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)
GCG_EXPORT SCIP * GCGgetPricingprob(GCG *gcg, int pricingprobnr)
Definition: relax_gcg.c:4075
GCG_EXPORT SCIP_Bool GCGisPricingprobRelevant(GCG *gcg, int pricingprobnr)
Definition: relax_gcg.c:4132
SCIP_STATUS SCIPgetStatus(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
const char * SCIPgetProbName(SCIP *scip)
SCIP_RETCODE SCIPwriteOrigProblem(SCIP *scip, const char *filename, const char *extension, SCIP_Bool genericnames)
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 SCIPwriteTransProblem(SCIP *scip, const char *filename, const char *extension, SCIP_Bool genericnames)
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
void SCIPsetMessagehdlrQuiet(SCIP *scip, SCIP_Bool quiet)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
GCG_EXPORT GCG_SOLVERDATA * GCGsolverGetData(GCG_SOLVER *solver)
Definition: solver.c:400
GCG_EXPORT void GCGsolverSetData(GCG_SOLVER *solver, GCG_SOLVERDATA *solverdata)
Definition: solver.c:410
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 SCIPaddStringParam(SCIP *scip, const char *name, const char *desc, char **valueptr, SCIP_Bool isadvanced, const char *defaultvalue, 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 SCIPsetIntParam(SCIP *scip, const char *name, int value)
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
SCIP_RETCODE SCIPreadParams(SCIP *scip, const char *filename)
SCIP_RETCODE SCIPwriteParams(SCIP *scip, const char *filename, SCIP_Bool comments, SCIP_Bool onlychanged)
SCIP_RETCODE SCIPsetCharParam(SCIP *scip, const char *name, char 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 SCIPgetIntParam(SCIP *scip, const char *name, int *value)
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
SCIP_RETCODE SCIPfixParam(SCIP *scip, const char *name)
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsPropagated(SCIP_CONS *cons)
const char * SCIPconsGetName(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsModifiable(SCIP_CONS *cons)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
#define SCIPfreeMemoryArrayNull(scip, ptr)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocMemory(scip, ptr)
#define SCIPduplicateMemoryArray(scip, ptr, source, num)
#define SCIPfreeMemory(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
int SCIPgetNSols(SCIP *scip)
SCIP_Bool SCIPhasPrimalRay(SCIP *scip)
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
SCIP_RETCODE SCIPsolve(SCIP *scip)
SCIP_Real SCIPgetDualbound(SCIP *scip)
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_RETCODE SCIPstopClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPfreeClock(SCIP *scip, SCIP_CLOCK **clck)
SCIP_Real SCIPgetClockTime(SCIP *scip, SCIP_CLOCK *clck)
SCIP_RETCODE SCIPstartClock(SCIP *scip, SCIP_CLOCK *clck)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPchgVarLb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Bool SCIPvarIsTransformed(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarUb(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
int SCIPsnprintf(char *t, int len, const char *s,...)
#define NULL
Definition: class_conspartition.cpp:44
GCG variable pricer.
SCIP_RETCODE GCGpricerIncludeSolver(GCG *gcg, const char *name, const char *desc, int priority, SCIP_Bool heurenabled, SCIP_Bool exactenabled, GCG_DECL_SOLVERUPDATE((*solverupdate)), GCG_DECL_SOLVERSOLVE((*solversolve)), GCG_DECL_SOLVERSOLVEHEUR((*solversolveheur)), GCG_DECL_SOLVERFREE((*solverfree)), GCG_DECL_SOLVERINIT((*solverinit)), GCG_DECL_SOLVEREXIT((*solverexit)), GCG_DECL_SOLVERINITSOL((*solverinitsol)), GCG_DECL_SOLVEREXITSOL((*solverexitsol)), GCG_SOLVERDATA *solverdata)
Definition: pricer_gcg.cpp:5750
GCG variable pricer.
public C++ methods for working with gcg structure
#define SCIPerrorMessage
#define SCIPdebugMessage
GCG relaxator.
static SCIP_RETCODE buildProblem(GCG *gcg, GCG_SOLVERDATA *solverdata, SCIP *pricingprob, int probnr)
Definition: solver_gcg.cpp:250
static SCIP_RETCODE updateVars(SCIP *scip, GCG_SOLVERDATA *solverdata, SCIP *pricingprob, int probnr, SCIP_Bool varobjschanged, SCIP_Bool varbndschanged)
Definition: solver_gcg.cpp:401
static SCIP_RETCODE solveProblem(GCG *gcg, SCIP *pricingprob, GCG *subgcg, int probnr, GCG_SOLVERDATA *solverdata, SCIP_Real *lowerbound, GCG_PRICINGSTATUS *status)
Definition: solver_gcg.cpp:544
static SCIP_RETCODE solverGcgPrepareNestedSolver(GCG_SOLVERDATA *solverdata, GCG_SOLVER *nestedsolver)
Definition: solver_gcg.cpp:143
static SCIP_RETCODE updateBranchingConss(SCIP *scip, GCG_SOLVERDATA *solverdata, SCIP *pricingprob, int probnr)
Definition: solver_gcg.cpp:473
static GCG_DECL_SOLVERSOLVEHEUR(solverSolveHeurGcg)
Definition: solver_gcg.cpp:997
static SCIP_RETCODE adjustSettings(GCG_SOLVERDATA *solverdata, SCIP *pricingprob, GCG *subgcg, SCIP *subgcgorig)
Definition: solver_gcg.cpp:173
static SCIP_RETCODE freeBlockMemory(GCG *gcg, GCG_SOLVERDATA *solverdata)
Definition: solver_gcg.cpp:765
gcg solver for pricing problem
SCIP_RETCODE createColumnFromRay(GCG *gcg, SCIP *pricingprob, SCIP *subproblem, SCIP_HASHMAP *varmap, int probnr, GCG_COL **newcol)
Definition: solver_mip.c:521
SCIP_RETCODE getColumnsFromPricingprob(GCG *gcg, SCIP *pricingprob, SCIP *subproblem, SCIP_HASHMAP *varmap, int probnr, SCIP_Bool checksols)
Definition: solver_mip.c:652
mip solver for pricing problems
Definition: struct_gcgcol.h:52
Definition: struct_decomp.h:53
Definition: solver_cliquer.c:91
Definition: struct_solver.h:48
Definition: struct_gcg.h:55
structure information for decomposition information in GCG projects
data structures for solvers
Definition: class_partialdecomp.h:82
PARTIALDECOMP * createPartialdec(DETPROBDATA *parentdetprobdata, DETPROBDATA *newdetprobdata, int probnr)
Definition: class_partialdecomp.cpp:99
SCIP_VERBLEVEL_NONE
SCIP_VERBLEVEL_HIGH
SCIP_DIDNOTRUN
SCIP_SUCCESS
enum SCIP_Result SCIP_RESULT
SCIP_OKAY
SCIP_ERROR
enum SCIP_Retcode SCIP_RETCODE
SCIP_STAGE_PROBLEM
SCIP_STAGE_TRANSFORMED
SCIP_STATUS_OPTIMAL
SCIP_STATUS_SOLLIMIT
SCIP_STATUS_GAPLIMIT
SCIP_STATUS_STALLNODELIMIT
SCIP_STATUS_NODELIMIT