XPRSaddgencons, XPRSaddgencons64
XPRSaddgencons, XPRSaddgencons64 |
Purpose
Adds one or more general constraints to the problem. Each general constraint
y = f(x1, ..., xn, c1, ..., cn) consists of one or more (input) columns xi, zero or more constant values ci and a resultant (output column) y, different from all xi. General constraints include
maximum and
minimum (arbitrary number of input columns of any type and arbitrary number of input values, at least one total),
and and
or (at least one binary input column, no constant values, binary resultant) and
absolute value (exactly one input column of arbitrary type, no constant values).
Synopsis
int XPRS_CC XPRSaddgencons(XPRSprob prob, int ngencons, int ncols, int nvals, const int type[], const int resultant[], const int colstart[], const int col[], const int valstart[], const double val[]);
int XPRS_CC XPRSaddgencons64(XPRSprob prob, int ngencons, XPRSint64 ncols, XPRSint64 nvals, const int type[], const int resultant[], const XPRSint64 colstart[], const int col[], const XPRSint64 valstart[], const double val[]);
Arguments
prob
|
The current problem.
|
||||||||||
ngencons
|
The number of general constraints to add.
|
||||||||||
ncols
|
The total number of input variables in general constraints that should be added.
|
||||||||||
nvals
|
The total number of constant values in general constraints that should be added.
|
||||||||||
type
|
Integer array of length
ngencons containing the types of the general constraints:
|
||||||||||
resultant
|
Integer array of length
ngencons containing the indices of the output variables of the general constraints.
|
||||||||||
colstart
|
Integer array of length
ngencons containing the start index of each general constraint in the
col array.
|
||||||||||
col
|
Integer array of length
ncols containing the input variables in all general constraints.
|
||||||||||
valstart
|
Integer array of length
ngencons containing the start index of each general constraint in the
val array (may be
NULL if
nvals = 0).
|
||||||||||
val
|
Double array of length
nvals containing the constant values in all general constraints (may be
NULL if
nvals = 0).
|
Related controls
Integer
Controls whether dual reductions may be applied to reduce the number of added variables and constraints.
|
Example
This adds two new general constraints
x2 = max(x0, x1, 5) and
x3 = |x1|:
int type[] = {XPRS_GENCONS_MAX, XPRS_GENCONS_ABS}; int resultant[] = {2, 3}; int colstart[] = {0, 2}; int col[] = {0, 1, 1}; int valstart[] = {0, 1}; double val[] = {5.0}; ... XPRSaddgencons(prob, 2, 3, 1, type, resultant, colstart, col, valstart, val); XPRSmipoptimize(prob,"");
Further information
General constraints must be set up before solving the problem. They are converted to additional binary variables, indicator and linear constraints with the exact formulation and number of added entities depending on the performed presolving. Note that using non-binary variables in
and/
or constraints or adding constant values to them or
absolute value constraints will give an error at solve time.
Related topics