Loading...
Searching...
No Matches
solver_highs.c
Go to the documentation of this file.
34/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
73#define SOLVER_HEURENABLED FALSE /**< indicates whether the heuristic solving method of the solver should be enabled */
74#define SOLVER_EXACTENABLED FALSE /**< indicates whether the exact solving method of the solver should be enabled */
76#define DEFAULT_CHECKSOLS TRUE /**< should solutions of the pricing MIPs be checked for duplicity? */
77#define DEFAULT_THREADS 1 /**< number of threads the HIGHS pricing solver is allowed to use (0: automatic) */
81#define DEFAULT_NODELIMITFAC 1.25 /**< factor by which to increase node limit for heuristic pricing (1.0: add start limit) */
82#define DEFAULT_STALLNODELIMITFAC 1.25 /**< factor by which to increase stalling node limit for heuristic pricing */
83#define DEFAULT_GAPLIMITFAC 0.8 /**< factor by which to decrease gap limit for heuristic pricing (1.0: subtract start limit) */
84#define DEFAULT_SOLLIMITFAC 1.5 /**< factor by which to increase solution limit for heuristic pricing (1.0: add start limit) */
105 int* nbasicpricingconss; /**< array storing the basic number of constraints of the pricing problems */
110 int threads; /**< number of threads the HIGHS pricing solver is allowed to use (0: automatic) */
114 SCIP_Real nodelimitfac; /**< factor by which to increase node limit for heuristic pricing (1.0: add start limit) */
115 SCIP_Real gaplimitfac; /**< factor by which to decrease gap limit for heuristic pricing (1.0: subtract start limit) */
116 SCIP_Real sollimitfac; /**< factor by which to increase solution limit for heuristic pricing (1.0: add start limit) */
204 SCIP_CALL( SCIPallocMemoryArray(scip, &solverdata->pricingvars[probnr], nvars) ); /*lint !e866*/
205 SCIP_CALL( SCIPallocMemoryArray(scip, &solverdata->pricingvartypes[probnr], nvars) ); /*lint !e866*/
206 SCIP_CALL( SCIPallocMemoryArray(scip, &solverdata->pricingconss[probnr], nconss) ); /*lint !e866*/
316 * NOTE: the format is row-wise, where HiGHS typically expects col-wise. The value for row-wise is 2,
318 CHECK_ZERO( Highs_passMip(solverdata->highsptr[probnr], nvars, nconss, nnonzeros, 2, sense, 0, varobj, varlb,
433 CHECK_ZERO( Highs_changeColsBoundsBySet(solverdata->highsptr[probnr], nvars, updatevaridx, collower, colupper) );
499 CHECK_ZERO( Highs_deleteRowsByRange(solverdata->highsptr[probnr], nbasicpricingconss, nhighsrows - 1) );
591 CHECK_ZERO( Highs_addRows(solverdata->highsptr[probnr], nnewconss, newrowlower, newrowupper, nnonzeros, newstart,
662 * NOTE: the optimal status is also returned when a gap limit is reached. As such, the heuristic pricing with
683 solverdata->curgaplimit[probnr] = MAX(solverdata->curgaplimit[probnr] - solverdata->startgaplimit, 0.0);
717 SCIPdebugMessage(" -> disable presolving in HIGHS and only solve the LP relaxation to get primal ray\n");
733 /* since the primal ray is found by solving an LP, then it is necessary to round the integer variables in
742 highssolvals[i] = SCIPisPositive(pricingprob, SCIPvarGetObj(solverdata->pricingvars[probnr][i])) ?
745 highssolvals[i] = SCIPisNegative(pricingprob, SCIPvarGetObj(solverdata->pricingvars[probnr][i])) ?
752 SCIP_CALL( GCGcreateGcgCol(gcg, pricingprob, &col, probnr, solverdata->pricingvars[probnr], highssolvals, numcols, TRUE, SCIPinfinity(pricingprob)) );
764 /* The iteration limit model status is used for indicating a node or a solution is reached. It must be checked
765 * to identify what limit actually triggered the termination. Since HiGHS doesn't record the number of
775 CHECK_ZERO( Highs_getInt64InfoValue(solverdata->highsptr[probnr], "mip_node_count", &nodecount) );
782 /* checking whether a solution exists. If not, then we don't know the current solution status */
783 CHECK_ZERO( Highs_getIntInfoValue(solverdata->highsptr[probnr], "primal_solution_status", &solstatus) );
794 solverdata->curnodelimit[probnr] = (SCIP_Longint) (solverdata->curnodelimit[probnr] * solverdata->nodelimitfac);
797 SCIPdebugMessage(" -> node limit reached, increasing to %"SCIP_LONGINT_FORMAT"\n", solverdata->curnodelimit[probnr]);
802 solverdata->cursollimit[probnr] = (SCIP_Longint) (solverdata->cursollimit[probnr] * solverdata->sollimitfac);
805 SCIPdebugMessage(" -> solution limit reached, increasing to %"SCIP_LONGINT_FORMAT"\n", solverdata->cursollimit[probnr]);
812 /* a limit is reached, but not handled by GCG. We check the solution status to determine whether we can use the
821 /* checking whether a solution exists. If not, then we don't know the current solution status */
822 CHECK_ZERO( Highs_getIntInfoValue(solverdata->highsptr[probnr], "primal_solution_status", &solstatus) );
838 /* checking whether a solution exists. If not, then we don't know the current solution status */
839 CHECK_ZERO( Highs_getIntInfoValue(solverdata->highsptr[probnr], "primal_solution_status", &solstatus) );
854 /* if the pricing problem is a MIP, then we can collect the dual bound. Otherwise, if it is an LP, we expect that
859 CHECK_ZERO( Highs_getDoubleInfoValue(solverdata->highsptr[probnr], "mip_dual_bound", lowerbound) );
870 SCIPdebugMessage(" -> pricing problem %d solved: status=%d, modelstatus=%d, lowerbound=%g, upperbound=%g\n",
880 SCIP_CALL( SCIPsetSolVals(pricingprob, sol, numcols, solverdata->pricingvars[probnr], highssolvals) );
898 SCIP_CALL( GCGcreateGcgColFromSol(gcg, pricingprob, NULL, NULL, &col, probnr, sol, FALSE, SCIPinfinity(pricingprob)) );
910 CHECK_ZERO( Highs_setBoolOptionValue(solverdata->highsptr[probnr], "solve_relaxation", FALSE) );
940/** solving process initialization method of pricing solver (called when branch and bound process is about to begin) */
995/** solving process deinitialization method of pricing solver (called before branch and bound process data is freed) */
1079 SCIPdebugMessage("HIGHS solver -- update data for problem %d: varobjschanged = %u, varbndschanged = %u, consschanged = %u\n",
1083 SCIP_CALL( updateVars(GCGgetMasterprob(gcg), solverdata, pricingprob, probnr, varobjschanged, varbndschanged) );
1095 * * after checking variable bounds, because they change in particular when a new generic branching subproblem is considered
1096 * * but not after adding new branching constraints, since objectives will be set afterwards before solving
1104 (void) SCIPsnprintf(filename, SCIP_MAXSTRLEN, "highs-%s-%d-%d.lp", SCIPgetProbName(pricingprob), SCIPgetNNodes(scip), solverdata->nupdates[probnr]);
1137 SCIP_CALL( solveHighs(gcg, solverdata, pricingprob, probnr, dualsolconv, lowerbound, &ncols, status) );
1164 CHECK_ZERO( Highs_setIntOptionValue(solverdata->highsptr[probnr], "mip_max_improving_sols", INT_MAX) );
1167 SCIP_CALL( solveHighs(gcg, solverdata, pricingprob, probnr, dualsolconv, lowerbound, &ncols, status) );
1213 &solverdata->nodelimitfac, TRUE, DEFAULT_NODELIMITFAC, 1.0, SCIPinfinity(origprob), NULL, NULL) );
1221 &solverdata->sollimitfac, TRUE, DEFAULT_SOLLIMITFAC, 1.0, SCIPinfinity(origprob), NULL, NULL) );
1224 SCIP_CALL( SCIPincludeExternalCodeInformation(origprob, name, "High performance serial and parallel solver for large-scale sparse LP, MIP, and QP models (https://highs.dev/)") );
#define SCIP_MAXSTRLEN
#define SCIP_Longint
#define SCIP_Bool
#define SCIP_Real
#define MAX(x, y)
#define SCIP_LONGINT_FORMAT
#define TRUE
#define FALSE
GCG interface methods.
SCIP_RETCODE GCGcreateGcgColFromSol(GCG *gcg, SCIP *pricingprob, SCIP *subproblem, SCIP_HASHMAP *varmap, GCG_COL **gcgcol, int prob, SCIP_SOL *sol, SCIP_Bool isray, SCIP_Real redcost)
Definition gcgcol.c:267
SCIP_RETCODE GCGcreateGcgCol(GCG *gcg, SCIP *pricingprob, GCG_COL **gcgcol, int probnr, SCIP_VAR **vars, SCIP_Real *vals, int nvars, SCIP_Bool isray, SCIP_Real redcost)
Definition gcgcol.c:53
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_STAGE SCIPgetStage(SCIP *scip)
const char * SCIPgetProbName(SCIP *scip)
int SCIPgetNOrigConss(SCIP *scip)
SCIP_VAR ** SCIPgetOrigVars(SCIP *scip)
int SCIPgetNOrigVars(SCIP *scip)
SCIP_CONS ** SCIPgetOrigConss(SCIP *scip)
SCIP_OBJSENSE SCIPgetObjsense(SCIP *scip)
SCIP_RETCODE GCGconsGetVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int nvars)
Definition scip_misc.c:487
SCIP_RETCODE GCGconsGetVals(SCIP *scip, SCIP_CONS *cons, SCIP_Real *vals, int nvals)
Definition scip_misc.c:618
void SCIPinfoMessage(SCIP *scip, FILE *file, 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 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 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 SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
SCIP_RETCODE SCIPcaptureCons(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPincludeExternalCodeInformation(SCIP *scip, const char *name, const char *description)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPallocMemoryArray(scip, ptr, num)
#define SCIPallocClearBufferArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPallocMemory(scip, ptr)
#define SCIPfreeMemoryArray(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
SCIP_RETCODE SCIPcheckSolOrig(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *feasible, SCIP_Bool printreason, SCIP_Bool completely)
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
SCIP_RETCODE SCIPcreateOrigSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPfloor(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPfeastol(SCIP *scip)
SCIP_Bool SCIPisNegative(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPceil(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_VAR * SCIPvarGetTransVar(SCIP_VAR *var)
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
int SCIPsnprintf(char *t, int len, const char *s,...)
SCIPfreeMemory(GCGgetOrigprob(gcg), &divingdata)
static assert(heur !=NULL)
SCIP_CALL(SCIPgetExternBranchCands(origprob, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, NULL, NULL, NULL))
SCIPdebugMessage("feasibility pump finished [%d iterations done].\n", nloops)
SCIPfreeBufferArray(scip, &cycles)
#define NULL
#define BMSclearMemoryArray(ptr, num)
Definition class_conspartition.cpp:44
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 methods for working with gcg columns
#define SCIPerrorMessage
various SCIP helper methods
static SCIP_RETCODE buildProblem(GCG *gcg, GCG_SOLVERDATA *solverdata, SCIP *pricingprob, int probnr)
Definition solver_cplex.c:120
static SCIP_RETCODE updateVars(SCIP *scip, GCG_SOLVERDATA *solverdata, SCIP *pricingprob, int probnr, SCIP_Bool varobjschanged, SCIP_Bool varbndschanged)
Definition solver_cplex.c:376
static SCIP_RETCODE updateBranchingConss(SCIP *scip, GCG_SOLVERDATA *solverdata, SCIP *pricingprob, int probnr)
Definition solver_cplex.c:481
static SCIP_RETCODE solveHighs(GCG *gcg, GCG_SOLVERDATA *solverdata, SCIP *pricingprob, int probnr, SCIP_Real dualsolconv, SCIP_Real *lowerbound, int *ncols, GCG_PRICINGSTATUS *status)
Definition solver_highs.c:614
highs solver for pricing problems
Definition solver_cliquer.c:91
struct SCIP_Cons SCIP_CONS
SCIP_OBJSENSE_MINIMIZE
SCIP_INVALIDDATA
enum SCIP_Retcode SCIP_RETCODE
struct Scip SCIP
SCIP_STAGE_TRANSFORMED
struct SCIP_Sol SCIP_SOL
struct SCIP_Var SCIP_VAR
SCIP_VARTYPE_INTEGER
SCIP_VARTYPE_CONTINUOUS
SCIP_VARTYPE_BINARY
enum SCIP_Vartype SCIP_VARTYPE