Continuous variables
All through this chapter we have worked with the decision variable type cpvar (discrete variables). A second variable type in Xpress Kalis are continuous variables (type cpfloatvar). Such variables are used in a similar way to what we have seen above for discrete variables, for example:
setparam("KALIS_DEFAULT_CONTINUOUS_LB", 0) setparam("KALIS_DEFAULT_CONTINUOUS_UB", 10) declarations x,y: cpfloatvar end-declarations x >= y ! Define a constraint ! Retrieve information about continuous variables writeln(getname(x), ":", getsol(x)) writeln(getlb(y), " ", getub(y))
A few differences in the use of the two decision variable types exist:
- Constraints involving cpfloatvar cannot be strict inequalities (that is, only the operators <=, >=, and = may be used).
- Most global constraints (see Chapter Constraints) only apply to cpvar; also applicable to cpfloatvar are maximum and minimum relations.
- Search strategies enumerating the values in a variable's domain can only be used with cpvar; with cpfloatvar domain splitting must be used (see Chapter Enumeration).
- Access functions for enumerating domain values such getnext are not applicable to cpfloatvar.