## Variable Constraints

## Main.VariableConstraints History

Hide minor edits - Show changes to markup

## Variable Constraints

(:table border=1 width=50% align=left bgcolor=#EEEEEE cellspacing=0:)

(:table border=1 width=100% align=left bgcolor=#EEEEEE cellspacing=0:)

Variable constraints may lead to infeasible solutions. For square problems (n_{var}=n_{eqn}), 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.

Variable constraints may lead to infeasible solutions. For square problems (n_{var}=n_{eqn}), 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.

## 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 (n_{var}=n_{eqn}), 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.

### Example

(:table border=1 width=50% align=left bgcolor=#EEEEEE cellspacing=0:) (:cellnr:)

! 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

(:tableend:)