MPC Constraints and the KKT Conditions
Hard operating limits enter MPC as inequality constraints; the Karush-Kuhn-Tucker conditions define the optimum and expose which limits are active.
Constraints are the point of MPC
The reason to use MPC rather than a linear regulator is that it enforces hard constraints exactly: actuator saturation, slew limits, and above all the safe operating envelope - stability margins, current and field limits, on the breeder, and stress and potential limits on the burner. The mathematics of constrained optimality is the KKT system.
KKT conditions for min f(z) s.t. g(z)<=0, h(z)=0 :
stationarity: grad f + sum mu_i grad g_i + sum nu_j grad h_j = 0
primal feas.: g_i(z) <= 0 , h_j(z) = 0
dual feas.: mu_i >= 0
compl. slack: mu_i * g_i(z) = 0
mu_i > 0 <=> constraint i is ACTIVE (binding)
Reading the multipliers
Complementary slackness says each inequality is either inactive (its multiplier zero) or active (binding, multiplier positive). The active set is exactly the set of limits currently shaping the command - which envelope boundary the plasma is riding. The stack surfaces the active constraints to operators, so it is transparent which physical limit is governing at any instant.
# inspect active constraints from an MPC solve
sol = solve_qp(H, g, A_ineq, b_ineq, A_eq, b_eq)
active = [i for i, mu in enumerate(sol.mu) if mu > tol]
# active -> the binding limits (slew, field, margin) right now
for i in active: log_binding_constraint(i, sol.mu[i])
Soft constraints and feasibility
Some limits must never be crossed (hard); others are preferences that may be relaxed to keep the problem feasible. The stack uses slack variables with steep penalties for the soft class, so MPC degrades gracefully rather than returning no solution when disturbances push against many limits at once. Hard safety limits are never softened - they remain inviolable, and beneath them the L1 failsafe still guards the machine.
- Actuator box + slew limits: hard, from hardware.
- Operating-envelope margins: mostly hard, from stability physics.
- Comfort/target constraints: soft, slack-penalized for feasibility.
- Active set = the limits currently governing; reported to operators.
The KKT structure is not just theory: it tells the operator which physical boundary is binding and gives MPC a principled way to stay feasible under stress without ever violating a safety limit.