|
constraint handler for pseudoboolean constraints
- Author
- Stefan Heinz
-
Michael Winkler
The constraint handler deals with pseudo boolean constraints. These are constraints of the form
where all are binary and all are integer.
Definition in file cons_pseudoboolean.h.
Go to the source code of this file.
|
SCIP_RETCODE | SCIPincludeConshdlrPseudoboolean (SCIP *scip) |
|
SCIP_RETCODE | SCIPcreateConsPseudobooleanWithConss (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_CONS *lincons, SCIP_LINEARCONSTYPE linconstype, SCIP_CONS **andconss, SCIP_Real *andcoefs, int nandconss, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs, 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_RETCODE | SCIPcreateConsPseudoboolean (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs, 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_RETCODE | SCIPcreateConsBasicPseudoboolean (SCIP *scip, SCIP_CONS **cons, const char *name, SCIP_VAR **linvars, int nlinvars, SCIP_Real *linvals, SCIP_VAR ***terms, int nterms, int *ntermvars, SCIP_Real *termvals, SCIP_VAR *indvar, SCIP_Real weight, SCIP_Bool issoftcons, SCIP_VAR *intvar, SCIP_Real lhs, SCIP_Real rhs) |
|
SCIP_RETCODE | SCIPaddCoefPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR *const var, SCIP_Real const val) |
|
SCIP_RETCODE | SCIPaddTermPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const vars, int const nvars, SCIP_Real const val) |
|
SCIP_VAR * | SCIPgetIndVarPseudoboolean (SCIP *const scip, SCIP_CONS *const cons) |
|
SCIP_CONS * | SCIPgetLinearConsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons) |
|
SCIP_LINEARCONSTYPE | SCIPgetLinearConsTypePseudoboolean (SCIP *const scip, SCIP_CONS *const cons) |
|
int | SCIPgetNLinVarsWithoutAndPseudoboolean (SCIP *const scip, SCIP_CONS *const cons) |
|
SCIP_RETCODE | SCIPgetLinDatasWithoutAndPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_VAR **const linvars, SCIP_Real *const lincoefs, int *const nlinvars) |
|
SCIP_RETCODE | SCIPgetAndDatasPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_CONS **const andconss, SCIP_Real *const andcoefs, int *const nandconss) |
|
int | SCIPgetNAndsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons) |
|
SCIP_RETCODE | SCIPchgLhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const lhs) |
|
SCIP_RETCODE | SCIPchgRhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons, SCIP_Real const rhs) |
|
SCIP_Real | SCIPgetLhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons) |
|
SCIP_Real | SCIPgetRhsPseudoboolean (SCIP *const scip, SCIP_CONS *const cons) |
|
#define ARTIFICIALVARNAMEPREFIX "andresultant_" |
solution status after solving LP
- Enumerator:
SCIP_LINEARCONSTYPE_INVALIDCONS |
this is no valid linear constraint type
|
SCIP_LINEARCONSTYPE_LINEAR |
this is the common linear constraint
|
SCIP_LINEARCONSTYPE_LOGICOR |
this is a logicor constraint
|
SCIP_LINEARCONSTYPE_KNAPSACK |
this is a knapsack constraint
|
SCIP_LINEARCONSTYPE_SETPPC |
this is a setppc constraint
|
Definition at line 45 of file cons_pseudoboolean.h.
creates the handler for pseudoboolean constraints and includes it in SCIP
- Parameters
-
Definition at line 8508 of file cons_pseudoboolean.c.
References CONSHDLR_CHECKPRIORITY, CONSHDLR_DELAYPRESOL, CONSHDLR_DESC, CONSHDLR_EAGERFREQ, CONSHDLR_ENFOPRIORITY, CONSHDLR_MAXPREROUNDS, CONSHDLR_NAME, CONSHDLR_NEEDSCONS, conshdlrdataCreate(), DEFAULT_DECOMPOSEINDICATORPBCONS, DEFAULT_DECOMPOSENORMALPBCONS, DEFAULT_PROPAGATENONLINEAR, DEFAULT_REMOVABLENONLINEAR, DEFAULT_SEPARATENONLINEAR, NULL, SCIP_CALL, SCIP_OKAY, SCIPaddBoolParam(), SCIPincludeConshdlrBasic(), SCIPsetConshdlrCopy(), SCIPsetConshdlrDelete(), SCIPsetConshdlrFree(), SCIPsetConshdlrGetNVars(), SCIPsetConshdlrGetVars(), SCIPsetConshdlrInit(), SCIPsetConshdlrInitpre(), SCIPsetConshdlrPresol(), SCIPsetConshdlrPrint(), SCIPsetConshdlrTrans(), and TRUE.
Referenced by SCIP_DECL_CONSHDLRCOPY(), and SCIPincludeDefaultPlugins().
SCIP_RETCODE SCIPcreateConsPseudobooleanWithConss |
( |
SCIP * |
scip, |
|
|
SCIP_CONS ** |
cons, |
|
|
const char * |
name, |
|
|
SCIP_CONS * |
lincons, |
|
|
SCIP_LINEARCONSTYPE |
linconstype, |
|
|
SCIP_CONS ** |
andconss, |
|
|
SCIP_Real * |
andcoefs, |
|
|
int |
nandconss, |
|
|
SCIP_VAR * |
indvar, |
|
|
SCIP_Real |
weight, |
|
|
SCIP_Bool |
issoftcons, |
|
|
SCIP_VAR * |
intvar, |
|
|
SCIP_Real |
lhs, |
|
|
SCIP_Real |
rhs, |
|
|
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 pseudoboolean constraint, with given linear and and-constraints
- Parameters
-
scip | SCIP data structure |
cons | pointer to hold the created constraint |
name | name of constraint |
lincons | associated linear constraint |
linconstype | linear constraint type of associated linear constraint |
andconss | associated and-constraints |
andcoefs | associated coefficients of and-constraints |
nandconss | number of associated and-constraints |
indvar | indicator variable if it's a soft constraint, or NULL |
weight | weight of the soft constraint, if it is one |
issoftcons | is this a soft constraint |
intvar | a artificial variable which was added only for the objective function, if this variable is not NULL this constraint (without this integer variable) describes the objective funktion |
lhs | left hand side of constraint |
rhs | right hand side of constraint |
initial | should the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'. |
separate | should the constraint be separated during LP processing? Usually set to TRUE. |
enforce | should the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints. |
check | should the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints. |
propagate | should the constraint be propagated during node processing? Usually set to TRUE. |
local | is constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. |
modifiable | is constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint. |
dynamic | is constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are seperated as constraints. |
removable | should the relaxation be removed from the LP due to aging or cleanup? Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. |
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? Usually set to FALSE. Set to TRUE to for constraints that represent node data. |
Definition at line 8562 of file cons_pseudoboolean.c.
References BMScopyMemoryArray, ConsAndData::cons, consdataCreate(), CONSHDLR_NAME, FALSE, inithashmapandtable(), ConsAndData::isoriginal, ConsAndData::istransformed, ConsAndData::newvars, ConsAndData::nnewvars, ConsAndData::noriguses, NULL, ConsAndData::nuses, ConsAndData::nvars, ConsAndData::origcons, SCIP_Bool, SCIP_CALL, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIPallocBlockMemory, SCIPcalcMemGrowSize(), SCIPcaptureCons(), SCIPcaptureVar(), SCIPconsAddUpgradeLocks(), SCIPconshdlrGetData(), SCIPconsIsTransformed(), SCIPcreateCons(), SCIPduplicateBlockMemoryArray, SCIPensureBlockMemoryArray, SCIPerrorMessage, SCIPfindConshdlr(), SCIPfreeBlockMemory, SCIPfreeBlockMemoryArray, SCIPgetNVarsAnd(), SCIPgetResultantAnd(), SCIPgetVarsAnd(), SCIPhashmapExists(), SCIPhashmapInsert(), SCIPhashtableInsert(), SCIPhashtableRetrieve(), SCIPinfinity(), SCIPisInfinity(), SCIPsortPtr(), SCIPwarningMessage(), ConsAndData::snewvars, ConsAndData::svars, TRUE, and ConsAndData::vars.
Referenced by copyConsPseudoboolean().
SCIP_RETCODE SCIPcreateConsPseudoboolean |
( |
SCIP * |
scip, |
|
|
SCIP_CONS ** |
cons, |
|
|
const char * |
name, |
|
|
SCIP_VAR ** |
linvars, |
|
|
int |
nlinvars, |
|
|
SCIP_Real * |
linvals, |
|
|
SCIP_VAR *** |
terms, |
|
|
int |
nterms, |
|
|
int * |
ntermvars, |
|
|
SCIP_Real * |
termvals, |
|
|
SCIP_VAR * |
indvar, |
|
|
SCIP_Real |
weight, |
|
|
SCIP_Bool |
issoftcons, |
|
|
SCIP_VAR * |
intvar, |
|
|
SCIP_Real |
lhs, |
|
|
SCIP_Real |
rhs, |
|
|
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 pseudoboolean constraint
- Note
- linear and nonlinear terms can be added using SCIPaddCoefPseudoboolean() and SCIPaddTermPseudoboolean(), respectively
-
the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
- Parameters
-
scip | SCIP data structure |
cons | pointer to hold the created constraint |
name | name of constraint |
linvars | variables of the linear part, or NULL |
nlinvars | number of variables of the linear part |
linvals | coefficients of linear part, or NULL |
terms | nonlinear terms of variables, or NULL |
nterms | number of terms of variables of nonlinear term |
ntermvars | number of variables in nonlinear terms, or NULL |
termvals | coefficients of nonlinear parts, or NULL |
indvar | indicator variable if it's a soft constraint, or NULL |
weight | weight of the soft constraint, if it is one |
issoftcons | is this a soft constraint |
intvar | a artificial variable which was added only for the objective function, if this variable is not NULL this constraint (without this integer variable) describes the objective function |
lhs | left hand side of constraint |
rhs | right hand side of constraint |
initial | should the LP relaxation of constraint be in the initial LP? Usually set to TRUE. Set to FALSE for 'lazy constraints'. |
separate | should the constraint be separated during LP processing? Usually set to TRUE. |
enforce | should the constraint be enforced during node processing? TRUE for model constraints, FALSE for additional, redundant constraints. |
check | should the constraint be checked for feasibility? TRUE for model constraints, FALSE for additional, redundant constraints. |
propagate | should the constraint be propagated during node processing? Usually set to TRUE. |
local | is constraint only valid locally? Usually set to FALSE. Has to be set to TRUE, e.g., for branching constraints. |
modifiable | is constraint modifiable (subject to column generation)? Usually set to FALSE. In column generation applications, set to TRUE if pricing adds coefficients to this constraint. |
dynamic | is constraint subject to aging? Usually set to FALSE. Set to TRUE for own cuts which are separated as constraints. |
removable | should the relaxation be removed from the LP due to aging or cleanup? Usually set to FALSE. Set to TRUE for 'lazy constraints' and 'user cuts'. |
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? Usually set to FALSE. Set to TRUE to for constraints that represent node data. |
Definition at line 8827 of file cons_pseudoboolean.c.
References consdataCreate(), CONSHDLR_NAME, createAndAddAnds(), createAndAddLinearCons(), FALSE, inithashmapandtable(), NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_OKAY, SCIP_PLUGINNOTFOUND, SCIP_Real, SCIPallocBufferArray, SCIPconshdlrGetData(), SCIPcreateCons(), SCIPerrorMessage, SCIPfindConshdlr(), SCIPfreeBufferArray, SCIPgetResultantAnd(), SCIPinfinity(), and SCIPisInfinity().
Referenced by readConstraints(), SCIPcreateConsBasicPseudoboolean(), and setObjective().
SCIP_RETCODE SCIPcreateConsBasicPseudoboolean |
( |
SCIP * |
scip, |
|
|
SCIP_CONS ** |
cons, |
|
|
const char * |
name, |
|
|
SCIP_VAR ** |
linvars, |
|
|
int |
nlinvars, |
|
|
SCIP_Real * |
linvals, |
|
|
SCIP_VAR *** |
terms, |
|
|
int |
nterms, |
|
|
int * |
ntermvars, |
|
|
SCIP_Real * |
termvals, |
|
|
SCIP_VAR * |
indvar, |
|
|
SCIP_Real |
weight, |
|
|
SCIP_Bool |
issoftcons, |
|
|
SCIP_VAR * |
intvar, |
|
|
SCIP_Real |
lhs, |
|
|
SCIP_Real |
rhs |
|
) |
| |
creates and captures a pseudoboolean constraint in its most basic variant, i. e., with all constraint flags set to their default values, which can be set afterwards using SCIPsetConsFLAGNAME() in scip.h
- See Also
- SCIPcreateConsPseudoboolean() for the default constraint flag configuration
- Note
- the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
creates and captures a pseudoboolean constraint in its most basic variant, i. e., with all constraint flags set to their default values
- Note
- the constraint gets captured, hence at one point you have to release it using the method SCIPreleaseCons()
- Parameters
-
scip | SCIP data structure |
cons | pointer to hold the created constraint |
name | name of constraint |
linvars | variables of the linear part, or NULL |
nlinvars | number of variables of the linear part |
linvals | coefficients of linear part, or NULL |
terms | nonlinear terms of variables, or NULL |
nterms | number of terms of variables of nonlinear term |
ntermvars | number of variables in nonlinear terms, or NULL |
termvals | coefficients of nonlinear parts, or NULL |
indvar | indicator variable if it's a soft constraint, or NULL |
weight | weight of the soft constraint, if it is one |
issoftcons | is this a soft constraint |
intvar | a artificial variable which was added only for the objective function, if this variable is not NULL this constraint (without this integer variable) describes the objective function |
lhs | left hand side of constraint |
rhs | right hand side of constraint |
Definition at line 8971 of file cons_pseudoboolean.c.
References FALSE, SCIP_CALL, SCIP_OKAY, SCIPcreateConsPseudoboolean(), and TRUE.
adds linear term pseudo boolean constraint (if it is not zero)
- Note
- you can only add a coefficient if the special type of linear constraint won't changed
adds a variable to the pseudo boolean constraint (if it is not zero)
- Note
- you can only add a coefficient if the special type of linear constraint won't changed
- Parameters
-
scip | SCIP data structure |
cons | constraint data |
var | variable of constraint entry |
val | coefficient of constraint entry |
Definition at line 9006 of file cons_pseudoboolean.c.
References CONSHDLR_NAME, FALSE, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_Longint, SCIP_OKAY, SCIPABORT, SCIPaddCoefKnapsack(), SCIPaddCoefLinear(), SCIPaddCoefLogicor(), SCIPaddCoefSetppc(), SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPerrorMessage, SCIPisEQ(), SCIPisIntegral(), SCIPisPositive(), and SCIPisZero().
int SCIPgetNLinVarsWithoutAndPseudoboolean |
( |
SCIP *const |
scip, |
|
|
SCIP_CONS *const |
cons |
|
) |
| |
gets linear constraint of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
linvars | array to store and-constraints |
lincoefs | array to store and-coefficients |
nlinvars | pointer to store the required array size for and-constraints, have to be initialized with size of given array |
Definition at line 9213 of file cons_pseudoboolean.c.
References CONSHDLR_NAME, getLinearConsNVars(), getLinearConsVarsData(), getLinVarsAndAndRess(), NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIP_Real, SCIPABORT, SCIPallocBufferArray, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPerrorMessage, and SCIPfreeBufferArray.
Referenced by writeOpbConstraints().
gets and-constraints of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
andconss | array to store and-constraints |
andcoefs | array to store and-coefficients |
nandconss | pointer to store the required array size for and-constraints, have to be initialized with size of given array |
Definition at line 9275 of file cons_pseudoboolean.c.
References CONSHDLR_NAME, NULL, SCIP_Bool, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPABORT, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), SCIPconsIsOriginal(), SCIPerrorMessage, and TRUE.
Referenced by writeOpbConstraints().
int SCIPgetNAndsPseudoboolean |
( |
SCIP *const |
scip, |
|
|
SCIP_CONS *const |
cons |
|
) |
| |
changes left hand side of pseudoboolean constraint
- Note
- you can only change the left hand side if the special type of linear constraint won't changed
changes left hand side of pseudoboolean constraint
- Note
- you can only change the left hand side if the special type of linear constraint won't changed
- Parameters
-
scip | SCIP data structure |
cons | constraint data |
lhs | new left hand side |
Definition at line 9376 of file cons_pseudoboolean.c.
References chgLhs(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.
changes right hand side of pseudoboolean constraint
- Note
- you can only change the right hand side if the special type of linear constraint won't changed
changes right hand side of pseudoboolean constraint
- Note
- you can only change the right hand side if the special type of linear constraint won't changed
- Parameters
-
scip | SCIP data structure |
cons | constraint data |
rhs | new right hand side |
Definition at line 9429 of file cons_pseudoboolean.c.
References chgRhs(), CONSHDLR_NAME, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_LINEARCONSTYPE_INVALIDCONS, SCIP_LINEARCONSTYPE_KNAPSACK, SCIP_LINEARCONSTYPE_LINEAR, SCIP_LINEARCONSTYPE_LOGICOR, SCIP_LINEARCONSTYPE_SETPPC, SCIP_OKAY, SCIPconsGetData(), SCIPconsGetHdlr(), SCIPconshdlrGetName(), and SCIPerrorMessage.
|