Constrained NLP demonstrations

The browser uses the derived formulas and evaluates residuals. Run the linked Python file to execute SLSQP and compare numerical solver results.

1 Capacity and the active constraints

Minimize f=(x−3)²+(y−2)² with x+y≤b and x,y≥0.

CheckResidual

Before changing b, predict which constraints become active. The lower-bound multiplier vector shown at b=0 is one valid choice; multipliers there need not be unique.

2 A manual feasible step

Starting at (0,0), choose p=(6,4). The trial point is (6α,4α). Capacity b=3 requires α≤0.3.

This is a manual demonstration, rather than a recorded SLSQP iteration. From (1.8,1.2), the correction (0.2,−0.2) stays on the boundary and reaches (2,1).

3 Newton on a nonconvex function

q(s)=(s²−1)², s₀=0.3. Raw Newton uses p=−q′/q″. A descent direction requires q′p<0.

A positive directional derivative means sufficiently small positive steps ascend. Reducing the step size alone cannot fix that local direction test.