Reference 0019
Single-Period Optimizer Project Card
The whole course as one problem. Print this; build against it; certify with KKT, not an answer key.
The Problem
maximize αᵀw - γ( eᵀΣ_F e + Σ d_i²w_i² ) - κ‖w - w_prev‖₁
subject to 1ᵀw = 1, 0 ≤ w ≤ 0.40, βᵀw ≤ 0.80 (e = Fᵀw)
stage-1 data: α = [.09,.06,.04,.03] β = [1.5,1,.5,0] σ_f = .20
idio vol = [.10,.08,.06,.02] γ = 5 w_prev = .25 each κ = 0
The KKT Test Suite (convex ⇒ passing = proven optimal)
1. primal feasibility: 1ᵀw = 1; 0 ≤ w ≤ cap; βᵀw ≤ 0.80 2. dual signs: λ, η↓, η↑ ≥ 0 (ν free — sign convention varies) 3. comp. slackness: λ(0.80 - βᵀw) = 0; η↓_i w_i = 0; η↑_i(cap - w_i) = 0 4. stationarity: -α + 2γΣw + ν1 + λβ - η↓ + η↑ = 0 (per asset) with κ > 0, parked names satisfy 0 ∈ (push) + κ[-1,1] instead
Debug Table
symptom likely cause stationarity off by SAME amount, all assets budget dual sign flipped λ > 0 but wall slack wrong constraint's dual pasted one asset fails stationarity its bound dual missing (check w_i = 0 or cap) DCP error on the cost term maximizing +κ‖·‖₁ (Ref 0015 padding bug) solver says infeasible caps sum below 1? wall below min possible β?
Definition of Done
[] stage 1 passes all KKT checks [] κ=.02 parks a name at w_prev (say which) [] λ(wall) sweep is a step function [] wall dual = after-toll breakeven (0016) [] saw the DCP error once, on purpose
Use this page with Lesson 0019 (skeleton + live KKT checker), Reference 0007 (CVXPY template), and Reference 0004 (the conditions themselves).