Lesson 0004

KKT Conditions as Constraint Pressure

KKT conditions are the optimizer's way of saying: the best feasible point is where the objective's desire is exactly balanced by the constraints that block it.

The Intuition

Imagine the objective wants to put 80% of the portfolio in asset A. If the mandate caps asset A at 60%, the optimizer cannot go where the objective wants. The solution lands on the wall.

That wall is an active constraint. The force pushing against it is measured by a dual variable, also called a shadow price.

Constraint Pressure Lab

The curve is a simple objective score over the weight in asset A. The shaded area is forbidden by the max-weight constraint.

objective curve forbidden region chosen feasible point
Target
Cap
Solution
Constraint
Shadow price

Active vs Inactive

A constraint is active when it binds at the solution. A max-weight cap w_A <= 0.60 is active if the chosen weight is exactly 60%. It is inactive if the chosen weight is 45%.

Inactive constraints have no local pressure. Relaxing a cap from 60% to 61% changes nothing if the optimizer only wanted 45% anyway.

Easy test: if a constraint has slack, its shadow price should be zero. If relaxing it would improve the objective, it is probably active and has a positive shadow price.

The Four KKT Ideas

For convex problems, KKT conditions are often the certificate that a feasible solution is optimal. You do not need to memorize the full formal machinery yet; start with these four checks.

Primal feasibility

The portfolio obeys the original constraints: budget, bounds, turnover, exposure limits.

Dual feasibility

The shadow prices have legal signs. For upper-bound pressure, the price of relaxing the bound is nonnegative.

Complementary slackness

Inactive constraints have zero shadow price; nonzero shadow prices only appear on binding constraints.

Stationarity

At the solution, the objective gradient is balanced by active constraint gradients. There is no legal direction that improves the objective.

Portfolio Reading

Suppose your optimizer puts asset A exactly at its 10% cap and reports a large dual variable on that cap. The model is saying: given your expected returns, risks, and other constraints, the optimizer would benefit from being allowed to hold more A.

That does not mean you should blindly raise the cap. It means the cap is economically important in this model. The next research question is whether the inputs are trustworthy enough to justify that pressure.

If dual is large:
  the constraint is shaping the solution
  check whether the input signal is real
  check whether the constraint encodes a real mandate
  decide whether to relax, keep, or redesign the model

Retrieval Practice

A max-weight cap is active when the chosen weight is...

What does a large dual variable on a constraint suggest?

Complementary slackness says an inactive inequality constraint has...

Primary Source

Use Boyd and Vandenberghe's Convex Optimization for the formal KKT and duality treatment. Use the CVXPY quadratic-program example to see dual variables returned by a solver. Keep the KKT reference open while reading.