Initializing help system before first use

Decision variables

Decision variables are represented in the Xpress Kalis Mosel module 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:

Scheduling/cpvar.png

Figure 2.1: Conceptual representation of finite domain variables

Scheduling/cpfloatvar.png

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.

kalis defines a set of functions for accessing and modifying cpvar and cpfloatvar states:

Tests if a value is in the domain of a variable
Shows the current domain of the variable
Returns the degree of a variable
Returns the current lower bound of a variable
Returns the middle value of a variable
Gets the next value in the domain of a finite domain variable
Gets the previous value in the domain of a finite domain variable
Returns a random value belonging to the domain of a variable
Returns the cardinality of the variable domain
Returns the target value of a variable
Returns the current upper bound of a variable
Returns the instantiation value of a variable
Tests if two variable domains are equal
Tests if the variable passed in argument is instantiated
Tests if two decision variables represent the same variable
Sets the domain of a variable
Sets the lower bound of a variable
Sets the precision relativity and value of a continuous variable
Sets the target value of a variable
Sets the upper bound of a variable
Instantiate the value of a variable

© 2001-2025 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.