From APMonitor Documentation

Main: Slack Variable Tutorial

Slack Variables

Slack variables are defined to transform an inequality expression into an equality expression with an added slack variable. The slack variable is defined by setting a lower bound of zero (>0).

Inequality Constraint Form

x > b

Equality Constraint Form with Slack Variable

x = b + slack
slack > 0

Example Problem

Click to Solve a Slack Variable Optimization Problem

Inequality Constraints in APM

In APMonitor Modeling Language, inequality constraints are automatically translated into equality constraints with slack variables. Slack variables can also be defined by starting a variable name with slk. When the model is parsed at run-time, any variable beginning with slk is automatically assigned a lower value of zero. Alternatively, inequality constraints will be automatically converted to equality constraints with a slack variable.

Logical Conditions in Optimization

Slack variables are also useful for optimization problems with non-smooth or discontinuous functions. The following tutorial demonstrates the use of slack variables in reformulating the ABS() function, IF statements, and others.

Retrieved from
Page last modified on April 14, 2017, at 08:26 PM