Visualizes KKT for an inequality-constrained optimization: a point x moves toward the feasible set (inside a circle). The left panel shows the feasible region and vectors for -∇f (unconstrained descent), μ∇g (constraint push), and the stationarity residual ∇f+μ∇g shrinking near the solution. The right panel is a live KKT checklist with gauges for primal feasibility g(x)≤0, multiplier μ≥0, and complementary slackness μ·g(x)=0.
Uses a simple 2D toy problem with one inequality constraint g(x)=x1^2+x2^2−1≤0. The animated point follows a preset path and is smoothly projected to the boundary when outside to illustrate feasibility. μ is computed each frame via least-squares stationarity μ* = −(∇f·∇g)/||∇g||^2 clamped to μ≥0; complementary slackness is shown as the product μ·g(x). All drawing is grid-snapped for a blocky aesthetic and scales with canvas size.