Purpose
Declare a single variable.
Synopsis
XPRBvar XPRBnewvar(XPRBprob prob, int type, const char *name, double bdl, double bdu);
Arguments
prob
|
Reference to a problem.
|
type
|
The variable type, which may be one of:
XPRB_PL
|
|
XPRB_BV
|
|
XPRB_UI
|
|
XPRB_PI
|
|
XPRB_SC
|
|
XPRB_SI
|
|
|
name
|
The variable name (of unlimited length). May be NULL if not required.
|
bdl
|
The variable's lower bound
|
bdu
|
The variable's upper bound
|
Return value
Reference to the new variable if function executed successfully, NULL otherwise.
Example
XPRBprob prob;
XPRBvar x1, x2;
...
x1 = XPRBnewvar(prob, XPRB_UI, "abc3", 1, 100);
x2 = XPRBnewvar(prob, XPRB_SC, "klm2", 0, 20);
This defines an integer variable x1, taking values between 1 and 100, with the name abc3, and a semi-continuous variable x2, taking the value 0 or values between 1 and 20, with the name klm2.
Further information
1. The creation of a variable in BCL involves not only its name but also its type and bounds (which may be infinite, defined
by the corresponding Xpress-MP constants). The function returns the BCL reference to the variable (
i.e. a model variable). If the indicated name is already in use, BCL adds an index to it. If no variable name is given, BCL generates
a default name starting with
VAR. If a partial integer, semi-continuous, or semi-continuous integer variable is being created, the integer or semi-continuous
limit (
i.e. the lower bound of the continuous part for partial integer and semi-continuous, and of the semi-continuous integer part for
semi-continuous integer) is set to the maximum of
1 and
bdl. This value can be subsequently modified with the function
XPRBsetlim.
2. The lower and upper bounds may take values of -XPRB_INFINITY and XPRB_INFINITY for minus and plus infinity respectively.
Related topics
If you have any comments or suggestions about these pages,
please send mail to docs@dashoptimization.com.