Decision variables
Decision variables are represented in Xpress Kalis by the types cpvar and cpfloatvar. They correspond respectively to finite domain variables taking their values in a given interval, or set of integers, called a domain and to continuous domain variables represented by real valued intervals. Conceptually the variables can be represented in the following way:

Figure 2.1: Conceptual representation of finite domain variables

Figure 2.2: Conceptual representation of continuous variables
Decision variables are declared by using the standard Mosel syntax. For instance, the following code extract shows how to create a finite domain variable my_cpvar, a static array of cpvar cpvar_array, and a dynamic array of cpfloatvar dyn_cpfloatvar_array:
declarations my_cpvar : cpvar cpvar_array : array(1..10) of cpvar dyn_cpfloatvar_array : array(range) of cpfloatvar end-declarations
Note that entries of dynamic arrays of domain variables (arrays declared as dynamic at their creation or arrays for which some or all of the index sets are not known at the declaration like dyn_cpfloatvar_array in the example above) must be created explicitly using the Mosel procedure create:
declarations dyn_cpfloatvar_array : array(range) of cpfloatvar end-declarations forall(i in 3..30) create(dyn_cpvar_array(i))
After its declaration, the second step in the creation of a domain variable consists of defining its domain with the procedure setdomain.
Domain variables are also used in the definition of constraints and search strategy.
Xpress Kalis defines a set of functions for accessing and modifying cpvar and cpfloatvar states:
contains |
Tests if a value is in the domain of a variable
|
cp_show_var |
Shows the current domain of the variable
|
getdegree |
Returns the degree of a variable
|
getlb |
Returns the current lower bound of a variable
|
getmiddle |
Returns the middle value of a variable
|
getnext |
Gets the next value in the domain of a finite domain variable
|
getprev |
Gets the previous value in the domain of a finite domain variable
|
getrand |
Returns a random value belonging to the domain of a variable
|
getsize |
Returns the cardinality of the variable domain
|
gettarget |
Returns the target value of a variable
|
getub |
Returns the current upper bound of a variable
|
getval |
Returns the instantiation value of a variable
|
is_equal |
Tests if two variable domains are equal
|
is_fixed |
Tests if the variable passed in argument is instantiated
|
is_same |
Tests if two decision variables represent the same variable
|
setdomain |
Sets the domain of a variable
|
setlb |
Sets the lower bound of a variable
|
setprecision |
Sets the precision relativity and value of a continuous variable
|
settarget |
Sets the target value of a variable
|
setub |
Sets the upper bound of a variable
|
setval |
Instantiate the value of a variable
|
© 2001-2019 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.