example constraint handler for linear ordering constraints
We handle the following system of linear constraints:
Definition in file cons_lop.c.
Go to the source code of this file.
Macros | |
#define | CONSHDLR_NAME "lop" |
#define | CONSHDLR_DESC "linear ordering constraint handler" |
#define | CONSHDLR_SEPAPRIORITY 100 |
#define | CONSHDLR_ENFOPRIORITY -100 |
#define | CONSHDLR_CHECKPRIORITY -100 |
#define | CONSHDLR_SEPAFREQ 10 |
#define | CONSHDLR_PROPFREQ 1 |
#define | CONSHDLR_EAGERFREQ 100 |
#define | CONSHDLR_DELAYSEPA FALSE |
#define | CONSHDLR_DELAYPROP FALSE |
#define | CONSHDLR_NEEDSCONS TRUE |
#define | CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP |
Functions | |
static SCIP_RETCODE | LOPseparate (SCIP *scip, SCIP_CONSHDLR *conshdlr, int n, SCIP_VAR ***vars, SCIP_SOL *sol, int *nGen, SCIP_Bool *cutoff) |
static | SCIP_DECL_CONSHDLRCOPY (conshdlrCopyLOP) |
static | SCIP_DECL_CONSDELETE (consDeleteLOP) |
static | SCIP_DECL_CONSEXIT (consExitLOP) |
static | SCIP_DECL_CONSTRANS (consTransLOP) |
static | SCIP_DECL_CONSINITLP (consInitlpLOP) |
static | SCIP_DECL_CONSSEPALP (consSepalpLOP) |
static | SCIP_DECL_CONSSEPASOL (consSepasolLOP) |
static | SCIP_DECL_CONSENFOLP (consEnfolpLOP) |
static | SCIP_DECL_CONSENFOPS (consEnfopsLOP) |
static | SCIP_DECL_CONSCHECK (consCheckLOP) |
static | SCIP_DECL_CONSPROP (consPropLOP) |
static | SCIP_DECL_CONSRESPROP (consRespropLOP) |
static | SCIP_DECL_CONSLOCK (consLockLOP) |
static | SCIP_DECL_CONSPRINT (consPrintLOP) |
static | SCIP_DECL_CONSCOPY (consCopyLOP) |
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) |
#define CONSHDLR_NAME "lop" |
Definition at line 37 of file cons_lop.c.
Referenced by SCIP_DECL_CONSCHECK(), SCIP_DECL_CONSCOPY(), SCIP_DECL_CONSDELETE(), SCIP_DECL_CONSENFOLP(), SCIP_DECL_CONSENFOPS(), SCIP_DECL_CONSEXIT(), SCIP_DECL_CONSHDLRCOPY(), SCIP_DECL_CONSINITLP(), SCIP_DECL_CONSLOCK(), SCIP_DECL_CONSPRINT(), SCIP_DECL_CONSPROP(), SCIP_DECL_CONSRESPROP(), SCIP_DECL_CONSSEPALP(), SCIP_DECL_CONSSEPASOL(), SCIP_DECL_CONSTRANS(), SCIPcreateConsLOP(), and SCIPincludeConshdlrLOP().
#define CONSHDLR_DESC "linear ordering constraint handler" |
Definition at line 38 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_SEPAPRIORITY 100 |
priority of the constraint handler for separation
Definition at line 39 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_ENFOPRIORITY -100 |
priority of the constraint handler for constraint enforcing
Definition at line 40 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_CHECKPRIORITY -100 |
priority of the constraint handler for checking feasibility
Definition at line 41 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_SEPAFREQ 10 |
frequency for separating cuts; zero means to separate only in the root node
Definition at line 42 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_PROPFREQ 1 |
frequency for propagating domains; zero means only preprocessing propagation
Definition at line 43 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_EAGERFREQ 100 |
frequency for using all instead of only the useful constraints in separation, propagation and enforcement, -1 for no eager evaluations, 0 for first only
Definition at line 44 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_DELAYSEPA FALSE |
should separation method be delayed, if other separators found cuts?
Definition at line 47 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_DELAYPROP FALSE |
should propagation method be delayed, if other propagators found reductions?
Definition at line 48 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_NEEDSCONS TRUE |
should the constraint handler be skipped, if no constraints are available?
Definition at line 49 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
#define CONSHDLR_PROP_TIMING SCIP_PROPTIMING_BEFORELP |
Definition at line 51 of file cons_lop.c.
Referenced by SCIPincludeConshdlrLOP().
|
static |
separate symmetry equations and triangle inequalities
scip | SCIP pointer |
conshdlr | constraint handler |
n | number of elements |
vars | n x n matrix of variables |
sol | solution to be separated |
nGen | output: pointer to store number of added rows |
cutoff | output: pointer to store whether we detected a cutoff |
Definition at line 64 of file cons_lop.c.
References FALSE, NULL, SCIP_CALL, SCIP_DECL_CONSHDLRCOPY(), SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddCut(), SCIPaddVarToRow(), SCIPcacheRowExtensions(), SCIPcreateEmptyRowCons(), SCIPdebug, SCIPflushRowExtensions(), SCIPgetSolVal(), SCIPinfinity(), SCIPisEfficacious(), SCIPisFeasEQ(), SCIPprintRow(), SCIPreleaseRow(), SCIPsnprintf(), and TRUE.
Referenced by SCIP_DECL_CONSSEPALP(), and SCIP_DECL_CONSSEPASOL().
|
static |
copy method for constraint handler plugins (called when SCIP copies plugins)
Definition at line 161 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSDELETE(), SCIP_OKAY, SCIPconshdlrGetName(), SCIPincludeConshdlrLOP(), and TRUE.
Referenced by LOPseparate().
|
static |
frees specific constraint data
Definition at line 178 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_DECL_CONSEXIT(), SCIP_OKAY, SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMsg, SCIPfreeBlockMemory, and SCIPfreeBlockMemoryArray.
Referenced by SCIP_DECL_CONSHDLRCOPY().
|
static |
deinitialization method of constraint handler (called before transformed problem is freed)
We output the final linear ordering.
Definition at line 207 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSTRANS(), SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPgetBestSol(), SCIPgetSolVal(), SCIPgetSubscipDepth(), SCIPinfoMessage(), SCIPisFeasIntegral(), and SCIPsortIntInt().
Referenced by SCIP_DECL_CONSDELETE().
|
static |
transforms constraint data into data belonging to the transformed problem
Definition at line 289 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSINITLP(), SCIP_MAXSTRLEN, SCIP_OKAY, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPconsIsChecked(), SCIPconsIsDynamic(), SCIPconsIsEnforced(), SCIPconsIsInitial(), SCIPconsIsLocal(), SCIPconsIsModifiable(), SCIPconsIsPropagated(), SCIPconsIsRemovable(), SCIPconsIsSeparated(), SCIPconsIsStickingAtNode(), SCIPcreateCons(), SCIPdebugMsg, SCIPgetTransformedVar(), and SCIPsnprintf().
Referenced by SCIP_DECL_CONSEXIT().
|
static |
LP initialization method of constraint handler
Definition at line 346 of file cons_lop.c.
References CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_DECL_CONSSEPALP(), SCIP_MAXSTRLEN, SCIP_OKAY, SCIPaddCut(), SCIPaddVarToRow(), SCIPcacheRowExtensions(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPcreateEmptyRowCons(), SCIPdebug, SCIPdebugMsg, SCIPflushRowExtensions(), SCIPprintRow(), SCIPreleaseRow(), and SCIPsnprintf().
Referenced by SCIP_DECL_CONSTRANS().
|
static |
separation method of constraint handler for LP solutions
Definition at line 409 of file cons_lop.c.
References CONSHDLR_NAME, LOPseparate(), NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSSEPASOL(), SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_SEPARATED, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), and SCIPdebugMsg.
Referenced by SCIP_DECL_CONSINITLP().
|
static |
separation method of constraint handler for arbitrary primal solutions
Definition at line 453 of file cons_lop.c.
References CONSHDLR_NAME, LOPseparate(), NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSENFOLP(), SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_SEPARATED, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), and SCIPdebugMsg.
Referenced by SCIP_DECL_CONSSEPALP().
|
static |
constraint enforcing method of constraint handler for LP solutions
Definition at line 496 of file cons_lop.c.
References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DECL_CONSENFOPS(), SCIP_DIDNOTRUN, SCIP_FEASIBLE, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIP_SEPARATED, SCIPaddCut(), SCIPaddVarToRow(), SCIPcacheRowExtensions(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPcreateEmptyRowCons(), SCIPdebug, SCIPdebugMsg, SCIPflushRowExtensions(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasEQ(), SCIPisFeasGT(), SCIPprintRow(), SCIPreleaseRow(), SCIPsnprintf(), and TRUE.
Referenced by SCIP_DECL_CONSSEPASOL().
|
static |
constraint enforcing method of constraint handler for pseudo solutions
Definition at line 622 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_Bool, SCIP_DECL_CONSCHECK(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMsg, SCIPgetSolVal(), SCIPisFeasIntegral(), and SCIPisGT().
Referenced by SCIP_DECL_CONSENFOLP().
|
static |
feasibility check method of constraint handler for integral solutions
Definition at line 703 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_Bool, SCIP_CALL, SCIP_DECL_CONSPROP(), SCIP_FEASIBLE, SCIP_INFEASIBLE, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMsg, SCIPgetSolVal(), SCIPinfoMessage(), SCIPisFeasIntegral(), SCIPisGT(), SCIPprintCons(), and SCIPvarGetName().
Referenced by SCIP_DECL_CONSENFOPS().
|
static |
domain propagation method of constraint handler
Definition at line 801 of file cons_lop.c.
References CONSHDLR_NAME, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_CONFTYPE_PROPAGATION, SCIP_CUTOFF, SCIP_DECL_CONSRESPROP(), SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_OKAY, SCIP_REDUCEDDOM, SCIPaddConflictBinvar(), SCIPanalyzeConflictCons(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMsg, SCIPinferBinvarCons(), SCIPinitConflictAnalysis(), SCIPvarGetLbLocal(), SCIPvarGetUbLocal(), and TRUE.
Referenced by SCIP_DECL_CONSCHECK().
|
static |
propagation conflict resolving method of constraint handler
Definition at line 923 of file cons_lop.c.
References CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_DECL_CONSLOCK(), SCIP_DIDNOTFIND, SCIP_OKAY, SCIP_SUCCESS, SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPdebugMsg, SCIPvarGetLbAtIndex(), SCIPvarGetUbAtIndex(), and TRUE.
Referenced by SCIP_DECL_CONSPROP().
|
static |
variable rounding lock method of constraint handler
Definition at line 1013 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_DECL_CONSPRINT(), SCIP_OKAY, SCIPaddVarLocks(), SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), and SCIPdebugMsg.
Referenced by SCIP_DECL_CONSRESPROP().
|
static |
constraint display method of constraint handler
Definition at line 1052 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_DECL_CONSCOPY(), SCIP_OKAY, SCIPconsGetData(), SCIPconshdlrGetName(), SCIPinfoMessage(), and SCIPvarGetName().
Referenced by SCIP_DECL_CONSLOCK().
|
static |
constraint copying method of constraint handler
Definition at line 1095 of file cons_lop.c.
References BMSclearMemoryArray, CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetName(), SCIPconshdlrGetName(), SCIPcreateConsLOP(), SCIPdebugMsg, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPgetVarCopy(), SCIPincludeConshdlrLOP(), and TRUE.
Referenced by SCIP_DECL_CONSPRINT().
SCIP_RETCODE SCIPincludeConshdlrLOP | ( | SCIP * | scip | ) |
creates the handler for linear ordering constraints and includes it in SCIP
scip | SCIP data structure |
Definition at line 1159 of file cons_lop.c.
References CONSHDLR_CHECKPRIORITY, CONSHDLR_DELAYPROP, CONSHDLR_DELAYSEPA, CONSHDLR_DESC, CONSHDLR_EAGERFREQ, CONSHDLR_ENFOPRIORITY, CONSHDLR_NAME, CONSHDLR_NEEDSCONS, CONSHDLR_PROP_TIMING, CONSHDLR_PROPFREQ, CONSHDLR_SEPAFREQ, CONSHDLR_SEPAPRIORITY, NULL, SCIP_CALL, SCIP_OKAY, SCIPcreateConsLOP(), SCIPincludeConshdlrBasic(), SCIPsetConshdlrCopy(), SCIPsetConshdlrDelete(), SCIPsetConshdlrExit(), SCIPsetConshdlrInitlp(), SCIPsetConshdlrPrint(), SCIPsetConshdlrProp(), SCIPsetConshdlrResprop(), SCIPsetConshdlrSepa(), and SCIPsetConshdlrTrans().
Referenced by main(), SCIP_DECL_CONSCOPY(), and SCIP_DECL_CONSHDLRCOPY().
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 | ||
) |
creates and captures a linear ordering constraint
scip | SCIP data structure |
cons | pointer to hold the created constraint |
name | name of constraint |
n | number of elements |
vars | n x n matrix of binary variables |
initial | should the LP relaxation of constraint be in the initial LP? |
separate | should the constraint be separated during LP processing? |
enforce | should the constraint be enforced during node processing? |
check | should the constraint be checked for feasibility? |
propagate | should the constraint be propagated during node processing? |
local | is constraint only valid locally? |
modifiable | is constraint modifiable (subject to column generation)? |
dynamic | is constraint subject to aging? |
removable | should the relaxation be removed from the LP due to aging or cleanup? |
stickingatnode | should the constraint always be kept at the node where it was added, even if it may be moved to a more global node? |
Definition at line 1188 of file cons_lop.c.
References CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPallocBlockMemory, SCIPallocBlockMemoryArray, SCIPcreateCons(), SCIPerrorMessage, and SCIPfindConshdlr().
Referenced by SCIP_DECL_CONSCOPY(), SCIP_DECL_READERREAD(), and SCIPincludeConshdlrLOP().