Variable Constraints

Constraints serve to bound a parameter or variable with upper and lower limits. Variable constraints may be expressed as absolute numbers or functions of parameters or variable initial conditions. A variable constraint is included in the variable declarations section along with the initial condition. The constraints less than or equal (<=) or simply less than (<) are considered to be equivalent for numerical solutions. Likewise, greater than or equal (>=) and greater than (>) are equivalent.

Infeasible Solution

Variable constraints may lead to infeasible solutions. For square problems (nvar=neqn), the constraints are generally not needed but may help guide the solver to a feasible solution. Constraints are particularly advantageous to keep variable values away from strongly non-linear regions of the equation residuals. Good solvers correctly identify infeasible solutions and terminate with an appropriate message.

Example

 ! Example model that demonstrates parameter declarations
 Model example
   Parameters
     p1 = 1, >=0, < 2
     p2 <= 5
   End Parameters

   Variables
     v1 = 0, >-1, <1
     v2 = 1, >=p1, <=p5*p1
   End Variables

   Equations
     v1 * v2 = p2
     v1 + v2 = p1
   End Equations
 End Model