Initializing help system before first use

setrange

setrange


Purpose
Set the domain range of a constraint.
Synopsis
procedure setrange(c:linctr, lb:real, ub:real)
Arguments
A linear constraint expression
lb 
Lower bound
ub 
Upper bound
Example
The following sets the domain of the x variable and defines c as a range constraint.
declarations
 x,y,z: mpvar
 c: linctr
end-declarations

c:= 2*y+4*z+5
setrange(x,3,10)   ! 3<=x<=10
setrange(c,1,30)   ! -4<=2*y+4*z<=25
Further information
1. If the parameter c is a linear expression a new anonymous range constraint is added to the problem. Otherwise, the provided constraint is turned into a range constraint (and added to the problem if required).
2. This procedure changes the type of the provided constraint to CT_RNG, stores the provided lower bound as an external information and records the upper bound as the constant term of the constraint. As a consequence defining the range of a constraint modifies its constant term, this has to be taken into account if a range constraint is converted to another type or used as part of a linear expression.