Constrained Optimization

Constrained optimization minimizes or maximizes f(x)f(x) subject to restrictions on the design variables xx.

General Form

min⁡xf(x)subject togi(x)=ci,i=1,…,nhj(x)≤dj,j=1,…,m\begin{aligned} \min_x \quad & f(x) \\ \text{subject to} \quad & g_i(x) = c_i, \quad i = 1, \ldots, n \\ & h_j(x) \leq d_j, \quad j = 1, \ldots, m \end{aligned}
Here:
gi(x)=cig_i(x) = c_i
equality constraints
hj(x)≤djh_j(x) \leq d_j
inequality constraints

Linear Programming

Linear programming is constrained optimization where the objective function and every constraint are linear.

Standard Form

Objective function

z=f(x)=a1x1+a2x2+⋯+anxnz = f(x) = a_1 x_1 + a_2 x_2 + \cdots + a_n x_n

Constraints

ai1x1+ai2x2+⋯+ainxn≤bia_{i1} x_1 + a_{i2} x_2 + \cdots + a_{in} x_n \leq b_i

The constraint may use ≥\geq in place of ≤\leq.

Graphical Solution

For 2 design variables:

  • Plot each constraint as a boundary line.
  • Shade the feasible region satisfying every constraint.
  • Move the objective-function line z=constantz = \text{constant} across the feasible region.
  • Evaluate the objective function at each vertex of the feasible region.

The optimum occurs at a vertex of the feasible region.

Worked Examples

Example 1

Minimize f(x,y)=x2+y2f(x, y) = x^2 + y^2 subject to x+y=2x + y = 2 and x≤1.5x \leq 1.5. Then repeat with x≥1.5x \geq 1.5 in place of x≤1.5x \leq 1.5.

Solution Reveal Hide

In the general form, g(x,y)=x+yg(x, y) = x + y with c=2c = 2.

The equality gives y=2−xy = 2 - x.

f=x2+(2−x)2=2x2−4x+4f = x^2 + (2 - x)^2 = 2x^2 - 4x + 4dfdx=4x−4=0  ⟹  x=1,y=1,f=2\frac{\text{d}f}{\text{d}x} = 4x - 4 = 0 \implies x = 1, \quad y = 1, \quad f = 2

With x≤1.5x \leq 1.5

x=1x = 1 satisfies the inequality, so the constraint is inactive.

(x,y)=(1,1),fmin⁡=2(x, y) = (1, 1), \quad f_{\min} = 2

With x≥1.5x \geq 1.5

The unconstrained optimum x=1x = 1 violates the inequality. f=2x2−4x+4f = 2x^2 - 4x + 4 increases for x>1x > 1, so the optimum lies on the boundary and the constraint is active.

x=1.5,y=0.5,fmin⁡=2.25+0.25=2.5x = 1.5, \quad y = 0.5, \quad f_{\min} = 2.25 + 0.25 = 2.5

Example 2

A factory produces heaters of types SS and LL, sold wholesale at $40 and $88 respectively. Machine M1M_1 needs 2 minutes per SS heater and 8 minutes per LL heater. Machine M2M_2 needs 5 minutes per SS heater and 2 minutes per LL heater. Both machines run 60 minutes per hour. Find the hourly production rates x1x_1 (SS) and x2x_2 (LL) maximizing hourly revenue.

Solution Reveal Hide

Objective function

z=f(x)=40x1+88x2z = f(x) = 40x_1 + 88x_2

Constraints

2x1+8x2≤605x1+2x2≤60x1≥0x2≥0\begin{aligned} 2x_1 + 8x_2 &\leq 60 \\ 5x_1 + 2x_2 &\leq 60 \\ x_1 &\geq 0 \\ x_2 &\geq 0 \end{aligned}

The constraint intersections in the first quadrant are (0,0)(0, 0), (12,0)(12, 0), (0,7.5)(0, 7.5) and (10,5)(10, 5).

VertexRevenue
(0,0)(0, 0)00
(12,0)(12, 0)480480
(0,7.5)(0, 7.5)660660
(10,5)(10, 5)840840

The optimum is (x1,x2)=(10,5)(x_1, x_2) = (10, 5).

zmax⁡=40(10)+88(5)=840z_{\max} = 40(10) + 88(5) = 840

Example 3

Maximize z=3x1+2x2z = 3x_1 + 2x_2 subject to x1+x2≤4x_1 + x_2 \leq 4, x1≤3x_1 \leq 3, x1,x2≥0x_1, x_2 \geq 0.

Solution Reveal Hide

The feasible region has vertices (0,0)(0, 0), (3,0)(3, 0), (3,1)(3, 1) and (0,4)(0, 4).

Vertexz=3x1+2x2z = 3x_1 + 2x_2
(0,0)(0, 0)00
(3,0)(3, 0)99
(3,1)(3, 1)1111
(0,4)(0, 4)88

The maximum is z=11z = 11 at (3,1)(3, 1).

Wolfram Mathematica notebook

The summary notebook defines every function used in this module, with documentation and no examples, as a starting point for your own problems.

Written by November 3, 2026 2 min read
Was this helpful?