65#define CONSHDLR_NAME "exactsol"
66#define CONSHDLR_DESC "constraint handler for repairing floating-point primal solutions to satisfy exact feasibility"
67#define CONSHDLR_ENFOPRIORITY -9999999
68#define CONSHDLR_CHECKPRIORITY -999999
69#define CONSHDLR_EAGERFREQ 100
71#define CONSHDLR_NEEDSCONS FALSE
73#define DEFAULT_CHECKFPFEASIBILITY TRUE
75#define DEFAULT_CHECKCONTIMPLINT TRUE
77#define DEFAULT_ABORTFRAC 1e-9
79#define DEFAULT_UNFIXFRAC 0.0
80#define DEFAULT_MAXSTALLS 1000
81#define DEFAULT_SOLBUFSIZE 10
82#define DEFAULT_MINIMPROVE 0.2
93struct SCIP_ConshdlrData
98 int nhashedassignments;
135 if( sol1->
len != sol2->
len )
138 for(
i = 0;
i < sol1->
len;
i++ )
157 for(
i = 0;
i <
sol->len; ++
i )
179 if( conshdlrdata->nbufferedsols == conshdlrdata->lensolubuffer )
182 conshdlrdata->lensolubuffer, conshdlrdata->lensolubuffer * 2) );
183 conshdlrdata->lensolubuffer *= 2;
187 conshdlrdata->solubuffer[conshdlrdata->nbufferedsols] = insertsol;
188 conshdlrdata->nbufferedsols++;
202 for(
i = 0;
i < conshdlrdata->nbufferedsols;
i++ )
207 conshdlrdata->nbufferedsols = 0;
227 if( checkcontimplint )
232 nintegers =
nvars - ncontvars;
240 nintegers =
nvars - ncontvars - ncontimplvars;
248 for(
i = 0;
i < nintegers;
i++ )
256 (*assignment)->len = nintegers;
291 if( conshdlrdata->probhasconteqs != -1 )
298 conshdlrdata->probhasconteqs = 0;
300 for(
c = 0;
c < nconss; ++
c )
315 conshdlrdata->probhasconteqs = 1;
320 if( conshdlrdata->probhasconteqs == 1 )
412 if( conshdlrdata->probhasconteqs == -1 )
416 if( conshdlrdata->ncurrentstalls >= conshdlrdata->maxstalls )
477 if( conshdlrdata->checkfpfeasibility )
520 if( conshdlrdata->lenhash == conshdlrdata->nhashedassignments )
523 conshdlrdata->lenhash, conshdlrdata->lenhash * 2) );
524 conshdlrdata->lenhash *= 2;
526 conshdlrdata->hashedassignments[conshdlrdata->nhashedassignments] = assignment;
527 conshdlrdata->nhashedassignments++;
564 if( !conshdlrdata->checkcontimplint )
568 for(
i = nintegers;
i <
nvars; ++
i )
583 SCIPsortPtr((
void**)conshdlrdata->solubuffer, SCIPsolComp, conshdlrdata->nbufferedsols);
585 while( conshdlrdata->nbufferedsols > 0 && !foundsol )
588 worksol = conshdlrdata->solubuffer[conshdlrdata->nbufferedsols - 1];
593 SCIPdebugMessage(
"don't repair heuristic with obj value (%g) greater than upper bound (%g) \n",
596 conshdlrdata->nbufferedsols--;
600 SCIPdebugMessage(
"attempting to repair solution from heuristic %s with floating point objval %g \n",
604 for(
i = 0;
i < nintegers; ++
i )
659 conshdlrdata->nbufferedsols--;
675 SCIPwarningMessage(
scip,
"Error while solving LP in Exactsol Constraint Handler; exact LP solve terminated with code <%d>\n",retstat);
698 conshdlrdata->nbufferedsols--;
705 conshdlrdata->nbufferedsols--;
714 SCIPdebugMessage(
"successfully found feasible improving solution, objval %g, upperbound %g\n",
716 conshdlrdata->ncurrentstalls = 0;
720 SCIPdebugMessage(
"repaired solution not feasible or not improving, objval %g, upperbound %g \n",
722 conshdlrdata->ncurrentstalls++;
776 conshdlrdata->nhashedassignments = 0;
782 conshdlrdata->nbufferedsols = 0;
784 conshdlrdata->ncurrentstalls = 0;
785 conshdlrdata->probhasconteqs = -1;
814 for(
i = 0;
i < conshdlrdata->nhashedassignments;
i++ )
821 conshdlrdata->nhashedassignments = 0;
824 for(
i = 0;
i < conshdlrdata->nbufferedsols;
i++ )
829 conshdlrdata->nbufferedsols = 0;
869 consEnfolpExactSol, consEnfopsExactSol, consCheckExactSol, consLockExactSol,
886 "should a solution be checked in floating-point arithmetic prior to being processed?",
890 "should integrality of continuous implied integral variables be ensured?",
894 "fractionality of enforced integral value above which reparation is aborted",
898 "fractionality of weakly implied value up to which reparation fixes variable",
902 "maximal number of consecutive repair calls without success",
906 "size of solution buffer",
910 "minimal percentage of primal improvement to trigger solution processing",
#define CONSHDLR_NEEDSCONS
#define CONSHDLR_CHECKPRIORITY
#define CONSHDLR_EAGERFREQ
#define CONSHDLR_ENFOPRIORITY
Constraint handler for linear constraints in their most general form, .
#define DEFAULT_CHECKFPFEASIBILITY
#define DEFAULT_MAXSTALLS
#define DEFAULT_ABORTFRAC
struct SolIntAssignment SOLINTASSIGNMENT
static void clearSoluBuffer(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
static SCIP_RETCODE bufferSolution(SCIP *scip, SCIP_SOL *sol, SCIP_CONSHDLRDATA *conshdlrdata)
#define DEFAULT_MINIMPROVE
static void checkProbHasContEqs(SCIP *scip, SCIP_CONSHDLRDATA *conshdlrdata)
#define DEFAULT_CHECKCONTIMPLINT
static void solFreeAssignment(SCIP *scip, SOLINTASSIGNMENT **assignment)
static SCIP_RETCODE solCreateSolAssignment(SCIP *scip, SCIP_SOL *sol, SCIP_Bool checkcontimplint, SOLINTASSIGNMENT **assignment)
#define DEFAULT_UNFIXFRAC
#define DEFAULT_SOLBUFSIZE
constraint handler for ensuring that primal solution is exact
common defines and data types used in all packages of SCIP
#define SCIP_CALL_ABORT(x)
SCIP_VAR ** SCIPgetVarsExactLinear(SCIP *scip, SCIP_CONS *cons)
int SCIPgetNVarsExactLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPincludeConshdlrExactSol(SCIP *scip)
SCIP_STAGE SCIPgetStage(SCIP *scip)
int SCIPgetNContVars(SCIP *scip)
SCIP_RETCODE SCIPgetSolVarsData(SCIP *scip, SCIP_SOL *sol, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nbinimplvars, int *nintimplvars, int *ncontimplvars, int *ncontvars)
SCIP_CONS ** SCIPgetConss(SCIP *scip)
int SCIPgetNVars(SCIP *scip)
int SCIPgetNConss(SCIP *scip)
SCIP_VAR ** SCIPgetVars(SCIP *scip)
int SCIPgetNContImplVars(SCIP *scip)
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
#define SCIPhashSignature64(a)
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
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)
void SCIPconshdlrSetData(SCIP_CONSHDLR *conshdlr, SCIP_CONSHDLRDATA *conshdlrdata)
SCIP_RETCODE SCIPsetConshdlrFree(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrEnforelax(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPincludeConshdlrBasic(SCIP *scip, SCIP_CONSHDLR **conshdlrptr, const char *name, const char *desc, int enfopriority, int chckpriority, int eagerfreq, SCIP_Bool needscons, SCIP_DECL_CONSENFOLP((*consenfolp)), SCIP_DECL_CONSENFOPS((*consenfops)), SCIP_DECL_CONSCHECK((*conscheck)), SCIP_DECL_CONSLOCK((*conslock)), SCIP_CONSHDLRDATA *conshdlrdata)
void SCIPconshdlrMarkExact(SCIP_CONSHDLR *conshdlr)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_Bool SCIPconshdlrNeedsCons(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)),)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
void SCIPconshdlrSetNeedsCons(SCIP_CONSHDLR *conshdlr, SCIP_Bool needscons)
SCIP_RETCODE SCIPsetConshdlrInit(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_CONSHDLRDATA * SCIPconshdlrGetData(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPsetConshdlrExit(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_CONSHDLR * SCIPconsGetHdlr(SCIP_CONS *cons)
SCIP_Bool SCIPisExact(SCIP *scip)
const char * SCIPheurGetName(SCIP_HEUR *heur)
SCIP_RETCODE SCIPchgVarLbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_RETCODE SCIPchgVarUbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
SCIP_Bool SCIPinDive(SCIP *scip)
SCIP_RETCODE SCIPsolveExactDiveLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
SCIP_Bool SCIPisExactDivePossible(SCIP *scip)
SCIP_RETCODE SCIPchgVarLbExactDive(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newbound)
SCIP_LPSOLSTAT SCIPgetLPExactSolstat(SCIP *scip)
SCIP_RETCODE SCIPstartExactDive(SCIP *scip)
SCIP_RETCODE SCIPendExactDive(SCIP *scip)
SCIP_RETCODE SCIPchgVarUbExactDive(SCIP *scip, SCIP_VAR *var, SCIP_RATIONAL *newbound)
SCIP_Bool SCIPinExactDive(SCIP *scip)
SCIP_RETCODE SCIPflushLP(SCIP *scip)
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
SCIP_RETCODE SCIPconstructLP(SCIP *scip, SCIP_Bool *cutoff)
SCIP_Bool SCIPisLPConstructed(SCIP *scip)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
BMS_BUFMEM * SCIPbuffer(SCIP *scip)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_NODETYPE SCIPnodeGetType(SCIP_NODE *node)
void SCIPrationalRoundInteger(SCIP_RATIONAL *res, SCIP_RATIONAL *src, SCIP_ROUNDMODE_RAT roundmode)
void SCIPrationalSetReal(SCIP_RATIONAL *res, SCIP_Real real)
void SCIPrationalFreeBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
SCIP_RETCODE SCIPrationalCreateBuffer(BMS_BUFMEM *bufmem, SCIP_RATIONAL **rational)
SCIP_Bool SCIPrationalIsEQ(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_Bool SCIPrationalIsLE(SCIP_RATIONAL *rat1, SCIP_RATIONAL *rat2)
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
SCIP_Real SCIPgetRowSolActivity(SCIP *scip, SCIP_ROW *row, SCIP_SOL *sol)
SCIP_RETCODE SCIPcreateSolCopy(SCIP *scip, SCIP_SOL **sol, SCIP_SOL *sourcesol)
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
SCIP_RETCODE SCIPtrySolFreeExact(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 SCIPoverwriteFPsol(SCIP *scip, SCIP_SOL *sol)
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
SCIP_RETCODE SCIPunlinkSol(SCIP *scip, SCIP_SOL *sol)
SCIP_RETCODE SCIPcreateLPSolExact(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
SCIP_SOLTYPE SCIPsolGetType(SCIP_SOL *sol)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
void SCIPsolSetHeur(SCIP_SOL *sol, SCIP_HEUR *heur)
SCIP_Bool SCIPsolIsExact(SCIP_SOL *sol)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
SCIP_Real SCIPround(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
SCIP_VARSTATUS SCIPvarGetStatusExact(SCIP_VAR *var)
int SCIPvarGetIndex(SCIP_VAR *var)
SCIP_RATIONAL * SCIPvarGetUbLocalExact(SCIP_VAR *var)
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
SCIP_RATIONAL * SCIPvarGetLbGlobalExact(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
SCIP_RATIONAL * SCIPvarGetLbLocalExact(SCIP_VAR *var)
SCIP_IMPLINTTYPE SCIPvarGetImplType(SCIP_VAR *var)
SCIP_RATIONAL * SCIPvarGetUbGlobalExact(SCIP_VAR *var)
void SCIPsortPtr(void **ptrarray, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), int len)
SCIPfreeSol(scip, &heurdata->sol))
assert(minobj< SCIPgetCutoffbound(scip))
SCIP_RATIONAL * SCIPconsGetRhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_RATIONAL * SCIPconsGetLhsExact(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_ROW * SCIPconsGetRow(SCIP *scip, SCIP_CONS *cons)
public methods for managing constraints
public methods for primal heuristics
public methods for LP management
public methods for LP management
public methods for message output
public data structures and miscellaneous methods
public methods for primal CIP solutions
public methods for problem variables
wrapper for rational number arithmetic
public methods for certified solving
public methods for constraint handler plugins and constraints
public methods for exact solving
public methods for the LP relaxation, rows and columns
public methods for the LP relaxation, rows and columns
public methods for memory management
public methods for message handling
public methods for numerical tolerances
public methods for SCIP parameter handling
public methods for global and local (sub)problems
public methods for querying solving statistics
public methods for the branch-and-bound tree
internal methods for global SCIP settings
#define SCIP_DECL_CONSENFOLP(x)
struct SCIP_Cons SCIP_CONS
#define SCIP_DECL_CONSEXIT(x)
struct SCIP_ConshdlrData SCIP_CONSHDLRDATA
#define SCIP_DECL_CONSENFORELAX(x)
#define SCIP_DECL_CONSENFOPS(x)
#define SCIP_DECL_CONSLOCK(x)
struct SCIP_Conshdlr SCIP_CONSHDLR
#define SCIP_DECL_CONSINIT(x)
#define SCIP_DECL_CONSCHECK(x)
#define SCIP_DECL_CONSHDLRCOPY(x)
#define SCIP_DECL_CONSFREE(x)
#define SCIP_DECL_HASHKEYEQ(x)
#define SCIP_DECL_HASHGETKEY(x)
#define SCIP_DECL_HASHKEYVAL(x)
struct SCIP_HashTable SCIP_HASHTABLE
struct SCIP_Rational SCIP_RATIONAL
enum SCIP_Retcode SCIP_RETCODE
@ SCIP_NODETYPE_FOCUSNODE
@ SCIP_VARTYPE_CONTINUOUS