Slack variable

Power Flow & Analysis Updated: 2026-11-29

A slack variable is an additional variable used to express or modify a constraint in an optimization problem. In the standard conversion of a less-than-or-equal inequality to an equality, a nonnegative slack measures unused allowance. That mathematical slack is different from an added violation variable that deliberately relaxes a requirement.

Interpretation and study use

For example, a flow of 80 MW against a 100 MW upper bound leaves 20 MW of unused allowance. By contrast, permitting 5 MW above that bound through a penalized variable represents a violation of the original limit. Both quantities may be called slack in software interfaces, so the equation and sign convention must be checked.

Load shedding, generation shedding and overload relaxations can help diagnose a model, but a solution using them may not satisfy the original operating requirements. Slacks with different physical units should not be added into one unexplained severity score. A slack variable is also distinct from the slack bus used to balance a power-flow calculation.

Related concepts

Binding constraint, Slack Bus / Swing Bus.

Sources

VeraGrid linear OPF formulation; VeraGrid OPF result definitions.

Related Keywords

Slack variableslack variableVeraGrid