Hexa Scholar

Quadratic programming over a polygon

A shallow wooden bowl with three pale rails tracing a triangle on its curved surface.
The rails mark out an allowed region on the surface of a bowl.

The question

When your target lies outside a triangle with a cap, where is the best point you can actually choose?

  1. 1 SeePlace a point and choose its constraints.
  2. 2 TryChange the curvature and compare the answers.
  3. 3 ProveBuild a certificate of optimality.
  4. 4 ApplySolve problems with edges and corners.
Before you start · 3 quick checks on inequalities, dot products, and curvature, about 3 min

Two ideas before you start

2 ideas

The constraints mark out the polygon

The feasible triangle lies above and to the right of the axes and below a diagonal line.

Point

Switch points to compare them with the cap.

A point is feasible when it meets all the inequalities, including equality at a boundary. An inequality is active at a point when it holds with equality there.

Exact definition

Write each constraint as \(a_i^\mathsf{T}z \le b_i\), where \(z=(x,y)\) and \(a_i\) is a nonzero outward normal to its boundary line. The feasible set is the intersection of these closed half-planes. If this intersection is bounded and has interior, it is a filled convex polygon.

The slack at a point \(z\) is \(b_i-a_i^\mathsf{T}z\). Feasibility means all slacks are nonnegative. An active constraint has zero slack. The lesson on separating hyperplanes works with the same half-planes and their normals.

Each contour has one objective value

A contour around the origin narrows horizontally when horizontal errors receive a higher weight.

Horizontal penalty

Each curve shows all points with the same objective value. Giving one coordinate a higher penalty makes the curve narrower in that direction.

Exact definition

A quadratic program minimizes a quadratic objective under linear constraints. Let \(H\) be a real symmetric matrix, \(c\) a vector, and \(r\) a constant. The objective is

\[f(z)=\tfrac12 z^\mathsf{T}Hz+c^\mathsf{T}z+r.\]

The factor \(\tfrac12\) makes the gradient \(Hz+c\) and the Hessian (the matrix of second derivatives) \(H\). Positive semidefinite means \(d^\mathsf{T}Hd\ge0\) for all vectors \(d\). Positive definite means \(d^\mathsf{T}Hd\gt0\) for every nonzero \(d\). See positive semidefinite matrices for the directional quadratic form.

Fine print about the bowl

The interactive examples use a diagonal Hessian with positive entries. Think of each term as a penalty for missing a coordinate of a target. The target minimizes the objective over the whole plane, since both squared misses vanish there. The feasible polygon is independent of the target and the penalties.

A positive definite Hessian can also include a cross term, which can rotate the ellipses. If the Hessian is positive semidefinite and singular, it has a direction of zero curvature. The full objective is flat along that direction when its linear component there vanishes.

1 See

Place the minimizer and pick its active constraints

2 Try

The same cap with different penalties

Keep the feasible triangle and target fixed while you change the price of missing the horizontal coordinate.

The explorer opens after you check your prediction.

3 Prove

Certify the point over the whole region

Theorem

Let \(f\) be the quadratic from the setup, with \(H\) symmetric positive definite. Let \(p\) be feasible for a finite collection of linear inequalities \(a_i^\mathsf{T}z\le b_i\). Suppose the real multipliers \(\lambda_i\) satisfy the following conditions.

  • Dual feasibility means \(\lambda_i\ge0\) for each \(i\).
  • Stationarity means \(\nabla f(p)+\sum_i\lambda_i a_i=0\).
  • Complementary slackness means \(\lambda_i(b_i-a_i^\mathsf{T}p)=0\) for each \(i\).

Then \(p\) is the unique global minimizer on the feasible set. The sums run over the listed inequalities. Fix another feasible point \(q\ne p\), if there is one, and write \(d=q-p\). Build the comparison with \(f(p)\) for this \(q\).

4 Apply

Solve and certify

Enter a decimal or a fraction. Each problem gives its grading precision and has hints and a worked solution.

Key point Test the target, then examine the edges when it lies outside. For a proposed optimum, check feasibility before using the active normals. Nonnegative multipliers that pass stationarity and complementary slackness certify the point for a convex quadratic.
Level Intermediate undergraduate Prerequisites Linear inequalities, dot products, partial derivatives, and quadratic forms Time ~35 min

Further reading