getprev
| getprev | 
  Purpose
 
 Returns the value nearest to and lower than 'val' in the domain of a variable passed in argument. This function is useful to enumerate the values of the domain of a variable from the highest to the lowest value; note that if 'val' is below the lower bound of x domain, the lower bound will be returned.
 
  Synopsis
 
function getprev(x:cpvar,val:integer) : integer
 
  Arguments
 
| 
     x 
     | 
     the decision variable
     | 
| 
     val 
     | 
     a value in the domain of the variable
     | 
  Return value
 
 The previous value in the domain of x
  Example
 
 The following example shows how to enumerate in decreasing order the values in the domain of a cpvar
 x
 
curVal := getub(x)
while (curVal > getlb(x)) do
   curVal := getprev(x, curVal)
   writeln("curVal= ",curVal)
end-do
  Related topics
 
 
