|
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
-
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. |
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. |
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()
- 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 |
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
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
var | variable of constraint entry |
val | coefficient of constraint entry |
adds nonlinear term to 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 | pseudoboolean constraint |
vars | variables of the nonlinear term |
nvars | number of variables of the nonlinear term |
val | coefficient of constraint entry |
gets indicator variable of pseudoboolean constraint, or NULL if there is no
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
gets linear constraint of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
gets type of linear constraint of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
int SCIPgetNLinVarsWithoutAndPseudoboolean |
( |
SCIP *const |
scip, |
|
|
SCIP_CONS *const |
cons |
|
) |
| |
gets number of linear variables without artificial terms variables of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
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 |
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 |
int SCIPgetNAndsPseudoboolean |
( |
SCIP *const |
scip, |
|
|
SCIP_CONS *const |
cons |
|
) |
| |
gets number of and constraints of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
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 | pseudoboolean constraint |
lhs | new left hand side |
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 | pseudoboolean constraint |
rhs | new right hand side |
get left hand side of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
get right hand side of pseudoboolean constraint
- Parameters
-
scip | SCIP data structure |
cons | pseudoboolean constraint |
|