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.
© 2001-2020 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.