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
93 for (
i = 0;
i < n && ! (*cutoff); ++
i)
95 for (j =
i+1; j < n && ! (*cutoff); ++j)
125 for (k =
i+1; k < n; ++k)
200 for (
i = 0;
i < n; ++
i)
237 for (
c = 0;
c < nconss; ++
c)
252 vars = consdata->vars;
258 for (
i = 0;
i < n; ++
i)
261 for (j = 0; j < n; ++j)
282 for (
i = 0;
i < n; ++
i)
324 for (
i = 0;
i < n; ++
i)
327 for (j = 0; j < n; ++j)
366 for (
c = 0;
c < nconss; ++
c)
382 vars = consdata->vars;
385 for (
i = 0;
i < n; ++
i)
387 for (j =
i+1; j < n; ++j)
431 for (
c = 0;
c < nconss; ++
c)
475 for (
c = 0;
c < nconss; ++
c)
519 for (
c = 0;
c < nconss; ++
c)
537 vars = consdata->vars;
540 for (
i = 0;
i < n; ++
i)
542 for (j =
i + 1; j < n; ++j)
576 for (k =
i + 1; k < n; ++k)
642 for (
c = 0;
c < nconss; ++
c)
659 vars = consdata->vars;
663 for (
i = 0;
i < n; ++
i)
665 for (j =
i + 1; j < n; ++j)
677 if ( oneIJ == oneJI )
684 for (k =
i + 1; k < n; ++k)
699 if ( oneIJ && oneJK && oneKI )
728 for (
c = 0;
c < nconss; ++
c)
745 vars = consdata->vars;
749 for (
i = 0;
i < n; ++
i)
751 for (j =
i + 1; j < n; ++j)
764 if ( oneIJ == oneJI )
778 for (k =
i + 1; k < n; ++k)
793 if ( oneIJ && oneJK && oneKI )
801 "violation: triangle inequality violated <%s> = %.15g, <%s> = %.15g, <%s> = %.15g\n",
834 for (
c = 0;
c < nconss; ++
c)
854 vars = consdata->vars;
858 for (
i = 0;
i < n; ++
i)
860 for (j =
i + 1; j < n; ++j)
901 for (k =
i + 1; k < n; ++k)
961 vars = consdata->vars;
963 assert( 0 <= inferinfo && inferinfo < n*n + n*n*n );
966 if ( inferinfo < (n*n) )
971 index1 = inferinfo/n;
972 index2 = inferinfo % n;
973 assert( 0 <= index1 && index1 < n );
974 assert( 0 <= index2 && index2 < n );
980 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 0 was x[%d][%d] = 1.\n", index2, index1, index1, index2);
990 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 1 was x[%d][%d] = 0.\n", index2, index1, index1, index2);
1004 index1 = (inferinfo - n*n)/(n*n);
1005 index2 = (inferinfo - n*n - index1 * n*n)/n;
1006 index3 = (inferinfo - n*n) % n;
1008 assert( 0 <= index1 && index1 < n );
1009 assert( 0 <= index2 && index2 < n );
1010 assert( 0 <= index3 && index3 < n );
1011 assert( index1 != index2 && index2 != index3 && index1 != index3 );
1018 SCIPdebugMsg(
scip,
" -> reason for x[%d][%d] == 0 was x[%d][%d] = x[%d][%d] = 1.\n", index3, index1, index1, index2, index2, index3);
1049 vars = consdata->vars;
1051 for (
i = 0;
i < n; ++
i)
1053 for (j = 0; j < n; ++j)
1085 vars = consdata->vars;
1088 for (
i = 0;
i < n; ++
i)
1093 for (j = 0; j < n; ++j)
1097 if ( j > 0 && (
i > 0 || j > 1) )
1131 SCIPdebugMsg(
scip,
"Copying method for linear ordering constraint handler.\n");
1137 sourcevars = sourcedata->vars;
1143 for (
i = 0;
i < n; ++
i)
1147 for (j = 0; j < n && *
valid; ++j)
1164 initial, separate, enforce, check,
propagate, local, modifiable, dynamic, removable, stickingatnode) );
1168 for (
i = n-1;
i >= 0; --
i)
1185 consEnfolpLOP, consEnfopsLOP, consCheckLOP, consLockLOP,
NULL) );
1230 if (conshdlr ==
NULL)
1241 for (
i = 0;
i < n; ++
i)
1244 for (j = 0; j < n; ++j)
1249 consdata->vars[
i][j] =
vars[
i][j];
1255 SCIP_CALL(
SCIPcreateCons(
scip, cons, name, conshdlr, consdata, initial, separate, enforce, check,
propagate,
1256 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)
static SCIP_RETCODE LOPseparate(SCIP *scip, SCIP_CONSHDLR *conshdlr, int n, SCIP_VAR ***vars, SCIP_SOL *sol, int *nGen, SCIP_Bool *cutoff)
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)
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)
const char * SCIPvarGetName(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
SCIP_Real SCIPvarGetLbAtIndex(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)
SCIP_Real SCIPvarGetUbAtIndex(SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
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)
@ 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