Constrained Optimization Using Lagrange Multipliers CEE 201L. Uncertainty, Design, and Optimization Department of Civil and Environmental Engineering Duke University Henri P. Gavin and Jeffrey T. Scruggs Spring 2020
In optimal design problems, values for a set of n design variables, (x1, x2, ··· xn), are to be found that minimize a scalar-valued objective function of the design variables, such that a set of m inequality constraints, are satisfied. Constrained optimization problems are generally expressed as
g1(x1, x2, ··· , xn) ≤ 0 g2(x1, x2, ··· , xn) ≤ 0 min J = f(x1, x2, ··· , xn) such that . (1) x1,x2,··· ,xn . gm(x1, x2, ··· , xn) ≤ 0 If the objective function is quadratic in the design variables and the constraint equations are linearly independent, the optimization problem has a unique solution. Consider the simplest constrained minimization problem: 1 min kx2 where k > 0 such that x ≥ b . (2) x 2 1 2 This problem has a single design variable, the objective function is quadratic (J = 2 kx ), there is a single constraint inequality, and it is linear in x (g(x) = b − x). If g > 0, the constraint equation constrains the optimum and the optimal solution, x∗, is given by x∗ = b. If g ≤ 0, the constraint equation does not constrain the optimum and the optimal solution is given by x∗ = 0. Not all optimization problems are so easy; most optimization methods require more advanced methods. The methods of Lagrange multipliers is one such method, and will be applied to this simple problem. Lagrange multiplier methods involve the modification of the objective function through the addition of terms that describe the constraints. The objective function J = f(x) is augmented by the constraint equations through a set of non-negative multiplicative Lagrange multipliers, λj ≥ 0. The augmented objective function, JA(x), is a function of the n design variables and m Lagrange multipliers,
m X JA(x1, x2, ··· , xn, λ1, λ2, ··· , λm) = f(x1, x2, ··· , xn) + λj gj(x1, x2, ··· , xn) (3) j=1 For the problem of equation (2), n = 1 and m = 1, so 1 1 J (x, λ) = kx2 + λ (b − x) = kx2 − λx + λb (4) A 2 2 The Lagrange multiplier, λ, serves the purpose of modifying (augmenting) the objective 1 2 1 2 function from one quadratic ( 2 kx ) to another quadratic ( 2 kx − λx + λb) so that the minimum of the modified quadratic satisfies the constraint (x ≥ b). 2 CEE 201L. Uncertainty, Design, and Optimization – Duke – Spring 2020 – Gavin and Scruggs
Case 1: b = 1 1 2 If b = 1 then the minimum of 2 kx is constrained by the inequality x ≥ b, and the optimal value of λ should minimize JA(x, λ) at x = b. Figure1(a) plots JA(x, λ) for a few non-negative values of λ and Figure1(b) plots contours of JA(x, λ).
12 4
3.5 (b) 10 (a) λ=4 3
8 λ (x) A 2.5 33 6 2 2 * 4 1.5 Lagrange multiplier, augmented cost, J 1 2 b=1 1
0.5 0 λ = 0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 0 design variable, x -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 design variable, x
4 3.5 3 2.5
JA 2 1.5 1 0.5 4 3.5 3 2.5 00 2 0.5 1.5Lagrange multiplier, λ 1 1 1.5 0.5 design variable, x 2 0
1 2 ∗ ∗ Figure 1. JA(x, λ) = 2 kx − λx + λb for b = 1 and k = 2. (x , λ ) = (1, 2)
CC BY-NC-ND HPG, JTS July 10, 2020 Constrained Optimization using Lagrange Multipliers 3
Figure1 shows that:
• JA(x, λ) is independent of λ at x = b,
∗ ∗ • JA(x, λ) is minimized at x = b for λ = 2,
• the surface JA(x, λ) is a saddle shape, • the point (x∗, λ∗) = (1, 2) is a saddle point,
∗ ∗ ∗ ∗ • JA(x , λ) ≤ JA(x , λ ) ≤ JA(x, λ ),
∗ ∗ ∗ ∗ • min JA(x, λ ) = max JA(x , λ) = JA(x , λ ) x λ Saddle points have no slope.
∂J (x, λ) A = 0 (5a) ∗ ∂x x = x λ = λ∗
∂J (x, λ) A = 0 (5b) ∗ ∂λ x = x λ = λ∗ (5c)
For this problem,
∂J (x, λ) A = 0 ⇒ kx∗ − λ∗ = 0 ⇒ λ∗ = kx∗ (6a) ∗ ∂x x = x λ = λ∗
∂J (x, λ) A = 0 ⇒ −x∗ + b = 0 ⇒ x∗ = b (6b) ∗ ∂λ x = x λ = λ∗
1 2 This example has a physical interpretation. The objective function J = 2 kx represents the potential energy in a spring. The minimum potential energy in a spring corresponds to a stretch of zero (x∗ = 0). The constrained problem: 1 min kx2 such that x ≥ 1 x 2 means “minimize the potential energy in the spring such that the stretch in the spring is greater than or equal to 1.” The solution to this problem is to set the stretch in the spring equal to the smallest allowable value (x∗ = 1). The force applied to the spring in order to achieve this objective is f = kx∗. This force is the Lagrange multiplier for this problem, (λ∗ = kx∗).
The Lagrange multiplier is the force required to enforce the constraint.
CC BY-NC-ND HPG, JTS July 10, 2020 4 CEE 201L. Uncertainty, Design, and Optimization – Duke – Spring 2020 – Gavin and Scruggs
Case 2: b = −1 1 2 If b = −1 then the minimum of 2 kx is not constrained by the inequality x ≥ b. The derivation above would give x∗ = −1, with λ∗ = −k. The negative value of λ∗ indicates that the constraint does not affect the optimal solution, and λ∗ should therefore be set to ∗ ∗ zero. Setting λ = 0, JA(x, λ) is minimized at x = 0. Figure2(a) plots JA(x, λ) for a few negative values of λ and Figure2(b) plots contours of JA(x, λ).
12 0 * -0.5 (b) 10 (a) λ=-4 -1
8 λ (x) A -1.5 -3 6 -2 -2 4 -2.5 Lagrange multiplier, augmented cost, J -1 2 b=-1 -3
-3.5 0 λ = 0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 -4 design variable, x -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 design variable, x
4 3.5 3 2.5
JA 2 1.5 1 0.5 0 -0.5 -1 -1.5 0-2 -2 -1.5 -2.5Lagrange multiplier, λ -1 -3 -0.5 -3.5 design variable, x 0 -4
1 2 ∗ ∗ Figure 2. JA(x, λ) = 2 kx − λx + λb for b = −1 and k = 2. (x , λ ) = (0, 0)
CC BY-NC-ND HPG, JTS July 10, 2020 Constrained Optimization using Lagrange Multipliers 5
Figure2 shows that:
• JA(x, λ) is independent of λ at x = b,
• the saddle point of JA(x, λ) occurs at a negative value of λ, so ∂JA/∂λ 6= 0 for any λ ≥ 0.
• The constraint x ≥ −1 does not affect the solution, and is called a non-binding or an inactive constraint.
• The Lagrange multipliers associated with non-binding inequality constraints are nega- tive.
• If a Lagrange multiplier corresponding to an inequality constraint has a negative value at the saddle point, it is set to zero, thereby removing the inactive constraint from the calculation of the augmented objective function.
Summary In summary, if the inequality g(x) ≤ 0 constrains the minimum of f(x) then the optimum point of the augmented objective JA(x, λ) = f(x)+λg(x) is minimized with respect to x and maximized with respect to λ. The optimization problem of equation (1) may be written in terms of the augmented objective function (equation (3)),
max min JA(x1, x2, ··· , xn, λ1, λ2, ··· , λm) such that λj ≥ 0 ∀ j (7) λ1,λ2,··· ,λm x1,x2,··· ,xn The necessary conditions for optimality are:
∂J A = 0 (8a) ∗ ∂xk xi = xi ∗ λj = λj
∂J A = 0 (8b) ∗ ∂λk xi = xi ∗ λj = λj
λj ≥ 0 (8c)
These equations define the relations used to derive expressions for, or compute values of, the ∗ optimal design variables xi . Lagrange multipliers for inequality constraints, gj(x1, ··· , xn) ≤ 0, are non-negative. If an inequality gj(x1, ··· , xn) ≤ 0 constrains the optimum point, the cor- responding Lagrange multiplier, λj, is positive. If an inequality gj(x1, ··· , xn) ≤ 0 does not constrain the optimum point, the corresponding Lagrange multiplier, λj, is set to zero.
CC BY-NC-ND HPG, JTS July 10, 2020 6 CEE 201L. Uncertainty, Design, and Optimization – Duke – Spring 2020 – Gavin and Scruggs
Sensitivity to Changes in the Constraints and Redundant Constraints Once a constrained optimization problem has been solved, it is sometimes useful to consider how changes in each constraint would affect the optimized cost. If the minimum of f(x) (where x = (x1, ··· , xn)) is constrained by the inequality gj(x) ≤ 0, then at the ∗ ∗ ∗ ∗ optimum point x , gj(x ) = 0 and λj > 0. Likewise, if another constraint gk(x ) does not ∗ ∗ constrain the minimum, then gk(x ) < 0 and λk = 0. A small change in the j-th constraint, ∗ ∗ ∗ from gj to gj + δgj, changes the constrained objective function from f(x ) to f(x ) + λj δgj. ∗ However, since the k-th constraint gk(x ) does not affect the solution, neither will a small ∗ change to gk, λk = 0. In other words, a small change in the j-th constraint, δgj, corresponds to a proportional change in the optimized cost, δf(x∗), and the constant of proportionality ∗ is the Lagrange multiplier of the optimized solution, λj .
m ∗ X ∗ δf(x ) = λj δgj (9) j=1
The value of the Lagrange multiplier is the sensitivity of the constrained objective to (small) changes in the constraint δg. If λj > 0 then the inequality gj(x) ≤ 0 constrains the optimum ∗ point and a small increase of the constraint gj(x ) increases the cost. If λj < 0 then ∗ gj(x ) < 0 and does not constrain the solution. A small change of this constraint should not affect the cost. So if a Lagrange multiplier associated with an inequality constraint ∗ gj(x ) ≤ 0 is computed as a negative value, it is subsequently set to zero. Such constraints are called non-binding or inactive constraints.
f(x) f(x)
δ f = λ δ g λ<0
λ>0