46#define CONSHDLR_NAME "lop"
47#define CONSHDLR_DESC "linear ordering constraint handler"
48#define CONSHDLR_SEPAPRIORITY 100
49#define CONSHDLR_ENFOPRIORITY -100
50#define CONSHDLR_CHECKPRIORITY -100
51#define CONSHDLR_SEPAFREQ 1
52#define CONSHDLR_PROPFREQ 1
53#define CONSHDLR_EAGERFREQ 100
55#define CONSHDLR_DELAYSEPA FALSE
56#define CONSHDLR_DELAYPROP FALSE
57#define CONSHDLR_NEEDSCONS TRUE
59#define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP
95 for (
i = 0;
i < n && ! (*cutoff); ++
i)
97 for (j =
i+1; j < n && ! (*cutoff); ++j)
127 for (k =
i+1; k < n; ++k)
202 for (
i = 0;
i < n; ++
i)
239 for (
c = 0;
c < nconss; ++
c)
254 vars = consdata->vars;
260 for (
i = 0;
i < n; ++
i)
263 for (j = 0; j < n; ++j)
284 for (
i = 0;
i < n; ++
i)
326 for (
i = 0;
i < n; ++
i)
329 for (j = 0; j < n; ++j)
368 for (
c = 0;
c < nconss; ++
c)
384 vars = consdata->vars;
387 for (
i = 0;
i < n; ++
i)
389 for (j =
i+1; j < n; ++j)
433 for (
c = 0;
c < nconss; ++
c)
477 for (
c = 0;
c < nconss; ++
c)
521 for (
c = 0;
c < nconss; ++
c)
539 vars = consdata->vars;
542 for (
i = 0;
i < n; ++
i)
544 for (j =
i + 1; j < n; ++j)
578 for (k =
i + 1; k < n; ++k)
644 for (
c = 0;
c < nconss; ++
c)
661 vars = consdata->vars;
665 for (
i = 0;
i < n; ++
i)
667 for (j =
i + 1; j < n; ++j)
679 if ( oneIJ == oneJI )
686 for (k =
i + 1; k < n; ++k)
701 if ( oneIJ && oneJK && oneKI )
730 for (
c = 0;
c < nconss; ++
c)
747 vars = consdata->vars;
751 for (
i = 0;
i < n; ++
i)
753 for (j =
i + 1; j < n; ++j)
766 if ( oneIJ == oneJI )
780 for (k =
i + 1; k < n; ++k)
795 if ( oneIJ && oneJK && oneKI )
803 "violation: triangle inequality violated <%s> = %.15g, <%s> = %.15g, <%s> = %.15g\n",
836 for (
c = 0;
c < nconss; ++
c)
856 vars = consdata->vars;
860 for (
i = 0;
i < n; ++
i)
862 for (j =
i + 1; j < n; ++j)
906 for (k =
i + 1; k < n; ++k)
1009 vars = consdata->vars;
1011 assert( 0 <= inferinfo && inferinfo < n*n + n*n*n );
1014 if ( inferinfo < nsqrd )
1019 index1 = inferinfo/n;
1020 index2 = inferinfo % n;
1021 assert( 0 <= index1 && index1 < n );
1022 assert( 0 <= index2 && index2 < n );
1028 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 0 was x[%d][%d] = 1.\n", index2, index1, index1, index2);
1038 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 1 was x[%d][%d] = 0.\n", index2, index1, index1, index2);
1052 index1 = (inferinfo - nsqrd) / nsqrd;
1053 index2 = (inferinfo - nsqrd - index1 * nsqrd) / n;
1054 index3 = (inferinfo - nsqrd) % n;
1056 assert( 0 <= index1 && index1 < n );
1057 assert( 0 <= index2 && index2 < n );
1058 assert( 0 <= index3 && index3 < n );
1059 assert( index1 < index2 );
1060 assert( index1 < index3 );
1061 assert( index2 != index3 );
1063 if (
vars[index3][index1] == infervar )
1069 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 0 was x[%d][%d] = x[%d][%d] = 1.\n", index3, index1, index1, index2, index2, index3);
1074 else if (
vars[index2][index3] == infervar )
1080 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 0 was x[%d][%d] = x[%d][%d] = 1.\n", index2, index3, index1, index2, index3, index1);
1085 else if (
vars[index1][index2] == infervar )
1091 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 0 was x[%d][%d] = x[%d][%d] = 1.\n", index1, index2, index2, index3, index3, index1);
1128 vars = consdata->vars;
1130 for (
i = 0;
i < n; ++
i)
1132 for (j = 0; j < n; ++j)
1164 vars = consdata->vars;
1167 for (
i = 0;
i < n; ++
i)
1172 for (j = 0; j < n; ++j)
1176 if ( j > 0 && (
i > 0 || j > 1) )
1210 SCIPdebugMsg(
scip,
"Copying method for linear ordering constraint handler.\n");
1216 sourcevars = sourcedata->vars;
1222 for (
i = 0;
i < n; ++
i)
1226 for (j = 0; j < n && *
valid; ++j)
1243 initial,
separate, enforce, check,
propagate, local, modifiable, dynamic, removable, stickingatnode) );
1247 for (
i = n-1;
i >= 0; --
i)
1264 consEnfolpLOP, consEnfopsLOP, consCheckLOP, consLockLOP,
NULL) );
1309 if (conshdlr ==
NULL)
1320 for (
i = 0;
i < n; ++
i)
1323 for (j = 0; j < n; ++j)
1328 consdata->vars[
i][j] =
vars[
i][j];
1334 SCIP_CALL(
SCIPcreateCons(
scip, cons, name, conshdlr, consdata, initial,
separate, enforce, check,
propagate,
1335 local, modifiable, dynamic, removable, stickingatnode) );
#define CONSHDLR_NEEDSCONS
#define CONSHDLR_SEPAFREQ
#define CONSHDLR_CHECKPRIORITY
#define CONSHDLR_PROP_TIMING
#define CONSHDLR_SEPAPRIORITY
#define CONSHDLR_PROPFREQ
#define CONSHDLR_EAGERFREQ
#define CONSHDLR_ENFOPRIORITY
#define CONSHDLR_DELAYSEPA
#define CONSHDLR_DELAYPROP
SCIP_RETCODE SCIPincludeConshdlrLOP(SCIP *scip)
SCIP_RETCODE SCIPcreateConsLOP(SCIP *scip, SCIP_CONS **cons, const char *name, int n, SCIP_VAR ***vars, 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)
static SCIP_RETCODE LOPseparate(SCIP *scip, SCIP_CONSHDLR *conshdlr, int n, SCIP_VAR ***vars, SCIP_SOL *sol, int *ngen, SCIP_Bool *cutoff)
constraint handler for linear ordering constraints
int SCIPgetSubscipDepth(SCIP *scip)
SCIP_RETCODE SCIPgetVarCopy(SCIP *sourcescip, SCIP *targetscip, SCIP_VAR *sourcevar, SCIP_VAR **targetvar, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, SCIP_Bool *success)
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
SCIP_RETCODE SCIPaddConflictLb(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx)
SCIP_RETCODE SCIPinitConflictAnalysis(SCIP *scip, SCIP_CONFTYPE conftype, SCIP_Bool iscutoffinvolved)
SCIP_RETCODE SCIPaddConflictUb(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx)
SCIP_RETCODE SCIPaddConflictBinvar(SCIP *scip, SCIP_VAR *var)
SCIP_RETCODE SCIPanalyzeConflictCons(SCIP *scip, SCIP_CONS *cons, SCIP_Bool *success)
SCIP_RETCODE SCIPsetConshdlrSepa(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSSEPALP((*conssepalp)), SCIP_DECL_CONSSEPASOL((*conssepasol)), int sepafreq, int sepapriority, SCIP_Bool delaysepa)
SCIP_RETCODE SCIPsetConshdlrProp(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSPROP((*consprop)), int propfreq, SCIP_Bool delayprop, SCIP_PROPTIMING proptiming)
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)
SCIP_RETCODE SCIPsetConshdlrPrint(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
const char * SCIPconshdlrGetName(SCIP_CONSHDLR *conshdlr)
SCIP_RETCODE SCIPsetConshdlrCopy(SCIP *scip, SCIP_CONSHDLR *conshdlr, SCIP_DECL_CONSHDLRCOPY((*conshdlrcopy)),)
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
SCIP_RETCODE SCIPsetConshdlrDelete(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrTrans(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrResprop(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrExit(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_RETCODE SCIPsetConshdlrInitlp(SCIP *scip, SCIP_CONSHDLR *conshdlr,)
SCIP_CONSDATA * SCIPconsGetData(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsDynamic(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsInitial(SCIP_CONS *cons)
SCIP_RETCODE SCIPprintCons(SCIP *scip, SCIP_CONS *cons, FILE *file)
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsEnforced(SCIP_CONS *cons)
SCIP_RETCODE SCIPcreateCons(SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONSHDLR *conshdlr, SCIP_CONSDATA *consdata, 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 SCIPconsIsPropagated(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_Bool SCIPconsIsSeparated(SCIP_CONS *cons)
SCIP_Bool SCIPconsIsRemovable(SCIP_CONS *cons)
SCIP_Bool SCIPisEfficacious(SCIP *scip, SCIP_Real efficacy)
SCIP_RETCODE SCIPaddRow(SCIP *scip, SCIP_ROW *row, SCIP_Bool forcecut, SCIP_Bool *infeasible)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
#define SCIPallocBufferArray(scip, ptr, num)
#define SCIPfreeBufferArray(scip, ptr)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
#define SCIPfreeBlockMemory(scip, ptr)
#define SCIPfreeBufferArrayNull(scip, ptr)
#define SCIPallocBlockMemory(scip, ptr)
SCIP_RETCODE SCIPcacheRowExtensions(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPflushRowExtensions(SCIP *scip, SCIP_ROW *row)
SCIP_RETCODE SCIPcreateEmptyRowConshdlr(SCIP *scip, SCIP_ROW **row, SCIP_CONSHDLR *conshdlr, const char *name, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool removable)
SCIP_RETCODE SCIPaddVarToRow(SCIP *scip, SCIP_ROW *row, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPprintRow(SCIP *scip, SCIP_ROW *row, FILE *file)
SCIP_RETCODE SCIPreleaseRow(SCIP *scip, SCIP_ROW **row)
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
SCIP_Real SCIPinfinity(SCIP *scip)
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisFeasGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
SCIP_RETCODE SCIPaddVarLocksType(SCIP *scip, SCIP_VAR *var, SCIP_LOCKTYPE locktype, int nlocksdown, int nlocksup)
SCIP_Real SCIPgetVarUbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Real SCIPgetVarLbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
SCIP_RETCODE SCIPinferBinvarCons(SCIP *scip, SCIP_VAR *var, SCIP_Bool fixedval, SCIP_CONS *infercons, int inferinfo, SCIP_Bool *infeasible, SCIP_Bool *tightened)
SCIP_RETCODE SCIPgetTransformedVar(SCIP *scip, SCIP_VAR *var, SCIP_VAR **transvar)
void SCIPsortIntInt(int *intarray1, int *intarray2, int len)
int SCIPsnprintf(char *t, int len, const char *s,...)
assert(minobj< SCIPgetCutoffbound(scip))
static SCIP_Bool propagate
#define BMSclearMemoryArray(ptr, num)
static SCIP_RETCODE separate(SCIP *scip, SCIP_SEPA *sepa, SCIP_SOL *sol, SCIP_RESULT *result)
Main separation function.
@ SCIP_CONFTYPE_PROPAGATION
#define SCIP_DECL_CONSENFOLP(x)
#define SCIP_DECL_CONSDELETE(x)
struct SCIP_Cons SCIP_CONS
#define SCIP_DECL_CONSEXIT(x)
#define SCIP_DECL_CONSPRINT(x)
#define SCIP_DECL_CONSSEPALP(x)
#define SCIP_DECL_CONSPROP(x)
#define SCIP_DECL_CONSRESPROP(x)
#define SCIP_DECL_CONSENFOPS(x)
#define SCIP_DECL_CONSTRANS(x)
#define SCIP_DECL_CONSINITLP(x)
#define SCIP_DECL_CONSLOCK(x)
struct SCIP_Conshdlr SCIP_CONSHDLR
#define SCIP_DECL_CONSCOPY(x)
struct SCIP_ConsData SCIP_CONSDATA
#define SCIP_DECL_CONSCHECK(x)
#define SCIP_DECL_CONSHDLRCOPY(x)
#define SCIP_DECL_CONSSEPASOL(x)
enum SCIP_Retcode SCIP_RETCODE