You must declare a constrained floating-point variable before you use it, just as you do for other constrained variables in Solver. To create a floating-point variable, you create an IloNumVar of type Float.
Here is a constructor for IloNumVar:
IloNumVar(const IloEnv env,
IloNum lowerBound = 0.0,
IloNum upperBound = IloInfinity,
Type type = Float,
const char* name = 0);
|
An instance of this class represents a numeric variable in a model. A numeric variable may be an integer variable, a Boolean variable, or a floating-point variable; that is, a numeric variable has a type, a value of the nested enumeration IloNumVar::Type, which can be Bool, Int, or Float. By default, its type is Float. It also has a lower and upper bound. A numeric variable cannot assume values less than its lower bound, nor greater than its upper bound.
| Note |
If you are looking for a class of variables that can assume only constrained integer values, consider the class IloIntVar. If you are looking for a class of binary decision variables that can assume only the values 0 (zero) or 1 (one), then consider the class IloBoolVar.
|