



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















- Notes for EE364b, Stanford University, Winter 2006- Stephen Boyd and Almir Mutapcic - January 23, The subgradient method is a very simple algorithm for minimizing a nondifferentiable convex function. The method looks very much like the ordinary gradient method for differentiable functions, but with several notable exceptions:
The subgradient method is readily extended to handle problems with constraints. Subgradient methods can be much slower than interior-point methods (or Newton’s method in the unconstrained case). In particular, they are first-order methods; their perfor- mance depends very much on the problem scaling and conditioning. (In contrast, Newton and interior-point methods are second-order methods, not affected by problem scaling.) However, subgradient methods do have some advantages over interior-point and New- ton methods. They can be immediately applied to a far wider variety of problems than interior-point or Newton methods. The memory requirement of subgradient methods can be much smaller than an interior-point or Newton method, which means it can be used for extremely large problems for which interior-point or Newton methods cannot be used. Mor- ever, by combining the subgradient method with primal or dual decomposition techniques, it is sometimes possible to develop a simple distributed algorithm for a problem. In any case, subgradient methods are well worth knowing about. The subgradient method was originally developed by Shor and others in the Soviet Union in the 1960s and 1970s. A basic reference on subgradient methods is his book [Sho85]; a very clear discussion can be found in chapter 5 of Polyak’s book [Pol87]. Bertsekas [Ber99] is another good reference on the subgradient method, in particular, on how to combine it with primal and dual decomposition. Other book treatments of the topic are in Ruszczyn- ski [Rus06, §7.1], Nesterov [Nes04, Chap. 3], Akgul [Akg84], Yudin and Nemirovski [NY83], Censor and Zenios [CZ97], and Shor [Sho98, Chap. 2]. Some interesting recent research papers on subgradient methods are [NB01] and [Nes05].
We start with the unconstrained case, where the goal is to minimize f : Rn^ → R, which is convex and has domain Rn^ (for now). To do this, the subgradient method uses the simple iteration x(k+1)^ = x(k)^ − αkg(k).
αk ≥ 0 , lim k→∞
αk = 0,
∑^ ∞
k=
αk = ∞.
Step sizes that satisfy this condition are called diminishing step size rules. A typical example is αk = a/
k, where a > 0.
∑^ ∞
k=
γk = ∞.
There are still other choices, and many variations on these choices. In §4.1 we will encounter another step size rule that requires knowledge of the optimal value f ⋆. The most interesting feature of these choices is that they are determined before the al- gorithm is run; they do not depend on any data computed during the algorithm. This is very different from the step size rules found in standard descent methods, which very much depend on the current point and search direction.
There are many results on convergence of the subgradient method. For constant step size and constant step length, the subgradient algorithm is guaranteed to converge to within some range of the optimal value, i.e., we have
lim k→∞ f (^) best(k) − f ⋆^ < ǫ,
where f ⋆^ denotes the optimal value of the problem, i.e., f ⋆^ = infx f (x). (This implies that the subgradient method finds an ǫ-suboptimal point within a finite number of steps.) The number ǫ is a function of the step size parameter h, and decreases with it. For the diminishing step size and step length rules (and therefore also the square summable but not summable step size rule), the algorithm is guaranteed to converge to the optimal value, i.e., we have limk→∞ f (x(k)) = f ⋆. It’s remarkable that such a simple algorithm can be used to minimize any convex function for which you can compute a subgradient at each point. We’ll also see that the convergence proof is also simple. When the function f is differentiable, we can say a bit more about the convergence. In this case, the subgradient method with constant step size yields convergence to the optimal value, provided the parameter α is small enough.
Here we give a proof of some typical convergence results for the subgradient method. We assume that there is a minimizer of f , say x⋆. We also make one other assumption on f :
We will assume that the norm of the subgradients is bounded, i.e., there is a G such that ‖g(k)‖ 2 ≤ G for all k. This will be the case if, for example, f satisfies the Lipschitz condition
|f (u) − f (v)| ≤ G‖u − v‖ 2 ,
for all u, v, because then ‖g‖ 2 ≤ G for any g ∈ ∂f (x), and any x. In fact, some versions of the subgradient method (e.g., diminishing nonsummable step lengths) work when this assumption doesn’t hold; see [Sho85] or [Pol87]. We’ll also assume that a number R is known that satisfies R ≥ ‖x(1)^ − x⋆‖ 2. We can interpret R as an upper bound on dist(x(1), X⋆), the distance of the initial point to the optimal set.
For the standard gradient descent method, the convergence proof is based on the function value decreasing at each step. In the subgradient method, the key quantity is not the function value (which often increases); it is the Euclidean distance to the optimal set. Recall that x⋆^ is a point that minimizes f , i.e., it is an arbitrary optimal point. We have
‖x(k+1)^ − x⋆‖^22 = ‖x(k)^ − αkg(k)^ − x⋆‖^22 = ‖x(k)^ − x⋆‖^22 − 2 αkg(k)T^ (x(k)^ − x⋆) + α k^2 ‖g(k)‖^22 ≤ ‖x(k)^ − x⋆‖^22 − 2 αk(f (x(k)) − f ⋆) + α^2 k‖g(k)‖^22 ,
where f ⋆^ = f (x⋆). The last line follows from the definition of subgradient, which gives
f (x⋆) ≥ f (x(k)) + g(k)T^ (x⋆^ − x(k)).
Applying the inequality above recursively, we have
‖x(k+1)^ − x⋆‖^22 ≤ ‖x(1)^ − x⋆‖^22 − 2
∑^ k
i=
αi(f (x(i)) − f ⋆) +
∑^ k
i=
α^2 i ‖g(i)‖^22.
Using ‖x(k+1)^ − x⋆‖^22 ≥ 0 and ‖x(1)^ − x⋆‖ 2 ≤ R we have
∑^ k i=
αi(f (x(i)) − f ⋆) ≤ R^2 +
∑^ k i=
α^2 i ‖g(i)‖^22. (1)
Combining this with
∑^ k
i=
αi(f (x(i)) − f ⋆) ≥
( (^) k ∑
i=
αi
) min i=1,...,k (f (x(i)) − f ⋆) =
( (^) k ∑
i=
αi
) (f (^) best(k) − f ⋆),
we have the inequality
f (^) best(k) − f ⋆^ = min i=1,...,k
f (x(i)) − f ⋆^ ≤
∑k i=1 α 2 i ‖g (i)‖ 2 2 2
∑k i=1 αi
since
∑∞ i=1 αi^ =^ ∞. Let^ N^ = max{N^1 , N^2 }. Then for^ k > N, we have
R^2 + G^2
∑k i=1 α 2 i 2
∑k i=1 αi
∑N 1 i=1 α 2 i 2
∑k i=1 αi
∑k i=N 1 +1 α 2 i 2
∑N 1 i=1 αi^ + 2^
∑k i=N 1 +1 αi
≤
∑N 1 i=1 α 2 i (2/ǫ)
( R^2 + G^2
∑N 1 i=1 α 2 i
∑k i=N 1 +1(ǫαi/G
∑k i=N 1 +1 αi
=
ǫ 2
ǫ 2
= ǫ.
Nonsummable diminishing step lengths. Finally, suppose that αk = γk/‖g(k)‖ 2 , with γk nonsummable and converging to zero. The inequality (2) becomes
f (^) best(k) − f ⋆^ ≤
∑k i=1 γ 2 k 2
∑k i=1 αi
∑k i=1 γ 2 k (2/G)
∑k i=1 γi
which converges to zero as k → 0.
It’s interesting to ask the question, what sequence of step sizes minimizes the righthand side of (3)? In other words, how do we choose positive α 1 ,... , αk so that
R^2 + G^2
∑k i=1 α 2 i 2
∑k i=1 αi
(which is an upper bound on f (k) best −^ f^
⋆) is minimized? This is a convex and symmetric
function of α 1 ,... , αk, so we conclude the optimal occurs when all αi are equal (to, say, α). This reduces our suboptimality bound to
R^2 + G^2 kα^2 2 kα
which is minimized by α = (R/G)/
k. In other words, the choice of α 1 ,... , αk that minimizes the suboptimality bound (3) is given by αi = (R/G)/
k, i = 1,... , k.
This choice of constant step size yields the suboptimality bound
f (^) best(k) − f ⋆^ ≤ RG/
k.
Put another way, we can say that for any choice of step sizes, the suboptimality bound (3) must be at least as large as RG/
k. If we use (3) as our stopping criterion, then the number of steps to achieve a guaranteed accuracy of ǫ will be at least (RG/ǫ)^2 , no matter what step sizes we use. (It will be this number if we use the step size αk = (R/G)/
k).
Note that RG has a simple interpretation as an initial bound on f (x(1)) − f ⋆, based on ‖x(1)^ − x⋆‖ 2 ≤ R and the Lipschitz constant G for f. Thus (RG)/ǫ is the ratio of initial uncertainty in f ⋆^ to final uncertainty in f ⋆. If we square this number, we get the minimum number of steps it will take to achieve this reduction in uncertainty. This tells us that the subgradient method is going to be very slow, if we use (3) as our stopping criterion. To reduce the initial uncertainty by a factor of 1000, say, it will require at least 10^6 iterations.
We can use (1) to find a lower bound on f ⋆^ that is sharper than the lower bounds (2) and (3), and can be used as a stopping criterion. Re-arranging (1) and using R ≥ ‖x(1)^ − x⋆‖ 2. we get
f ⋆^ ≥ lk =
∑k i=1 αif^ (x (i)) − R (^2) − ∑k i=1 α 2 i ‖g (i)‖ 2 2 2
∑k i=1 αi
which can be computed after the kth step. The sequence l 1 , l 2 ,... need not increase, so we can keep track of the best lower bound on f ⋆^ found so far,
l(bestk) = max{l 1 ,... , lk}.
We can terminate the algorithm when f (^) best(k) − l(bestk) is smaller than some threshold. This bound is better than (3), and doesn’t depend on G, but it too goes to zero very slowly. For this reason, the subgradient method is usually used without any formal stopping criterion.
We consider the problem of minimizing a piecewise linear function:
minimize f (x) = maxi=1,...,m(aTi x + bi),
with variable x ∈ Rn. Of course this problem is readily (and efficiently) solved via linear programming. Finding a subgradient of f is easy: given x, we first find an index j for which
aTj x + bj = max i=1,...,m (aTi x + bi).
Then we can take as subgradient g = aj. We can take G = maxi=1,...,m ‖ai‖ 2. We illustrate the subgradient method with a specific problem instance with n = 20 variables and m = 100 terms, with problem data ai and bi generated from a unit normal distribution. We start with x(1)^ = 0. There is no simple way to find a justifiable value for R (i.e., a value of R for which we can prove that ‖x(1)^ −x⋆‖ 2 ≤ R holds) so we take R = 10. For our particular problem instance, it turns out that ‖x(1)^ − x⋆‖ 2 = 0.91, where we computed an optimal point and the optimal value f ⋆^ ≈ 1 .1 using linear programming.
500 1000 1500 2000 2500 3000 10 −
10 −
10 −
100
k
f^ (k
) best
f
⋆
γ = 0. 05 γ = 0. 01 γ = 0. 005
Figure 1: The value of f (^) best(k) − f ⋆^ versus iteration number k, for the subgradient method with constant step length γ.
20 40 60 80 100 10 −
100
k
f^ (k
f
⋆
γ = 0. 05 γ = 0. 01 γ = 0. 005
Figure 2: The value of f (k)^ − f ⋆^ versus iteration number k, for the subgradient method with constant step length γ.
(^100 500 1000 1500 2000 2500 ) −
10 −
10 −
100
101
k
f^ (k
) best
f
⋆
αk = 0. 1 /
k αk = 1/k
Figure 3: The value of f (^) best(k) − f ⋆^ versus iteration number k, for the subgradient method with diminishing step rule αk = 0. 1 /
√ k, and square summable step size rule αk = 1/k.
so ∑k
i=
(f (x(i)) − f ⋆)^2 ‖g(i)‖^22
Using ‖g(i)‖ 2 ≤ G we get ∑k
i=
(f (x(i)) − f ⋆)^2 ≤ R^2 G^2.
We conclude that f (x(k)) → f ⋆. The number of steps needed before we can guarantee suboptimality ǫ is k = (RG/ǫ)^2 , which is optimal from our analysis above. Figure 4 shows the progress of the subgradient method with Polyak’s step size for the piecewise linear example from §3.5. Of course this isn’t fair, since we don’t know f ⋆^ before solving the problem. (However, we can estimate f ⋆.) But this plot shows that even with this unfair advantage in choosing step lengths, the subgradient method is pretty slow.
Suppose we want to find a point in
C = C 1 ∩ · · · ∩ Cm,
Here we use ‖g(k)‖ 2 = 1 and f ⋆^ = 0 in the second line, and
f (x(k)) = dist(x(k), Cj ) = ‖x(k)^ − PCj (x(k))‖ 2
in the third line. The algorithm is very simple: at each step, we simply project the current point onto the farthest set. This is an extension of the famous alternating projections algorithm. (When there are just two sets, then at each step you project the current point onto the other set. Thus the projections simply alternate.) We are only guaranteed that f (x(k)) → f ⋆^ = 0. In other words, a subsequence of our points approaches a point in C; we are not guaranteed to actually find a point in C (except in the limit). This can be addressed several ways. One way is to run the algorithm using closed sets C˜i ⊆ int Ci, so that x(k)^ → C˜ = C˜ 1 ∩ · · · ∩ C˜m. Then we are guaranteed that x(k)^ ∈ C for some (finite) k. Another method is to do over-projection at each step. Suppose we know the intersection of the sets contains a Euclidean ball of radius ǫ. Its center is a point that is ǫ-deep in all the sets. Then we can over project by ǫ, which roughly speaking means we project the current point to the farthest set, and then keep moving a distance ǫ:
x(k+1)^ = PCj (x(k)) − ǫ
x(k)^ − PCj (x(k)) ‖x(k)^ − PCj (x(k))‖ 2
Alternating projections is usually (but not always) applied when projection onto the sets is simple. This is the case, for example, for the following sets.
Alternating projections can be used, of course, in cases where a bit more computation is needed to compute the Euclidean projection, e.g., for a polyhedron (which can be done by solving a QP).
We want to find a point that satisfies fi(x) ≤ 0, i = 1,... , m. (We assume we can find a subgradient of each function, at any point.) To solve this set of convex inequalities, we can minimize the unconstrained function f (x) = maxi fi(x) using the subgradient method. If the set of inequalities is strictly feasible, then f ⋆^ is negative, and in a finite number of steps we’ll find a point with f (x) ≤ 0, i.e., a feasible point. We can also use the step size that uses knowledge of the optimal value, applied to the function f (x) = max{f 1 (x),... , fm(x), −ǫ},
where ǫ > 0 is a tolerance. Assuming there exists a point with fi(x) ≤ −ǫ, we can use the step length
α =
f (x) + ǫ ‖g‖^22
We can give a simple interpretation of this step length, taking the case ǫ = 0 for simplicity. Suppose the current point is x, and that fi(x) = f (x) > 0, with g ∈ ∂fi(x). Let x⋆^ be any point with fi(x⋆) ≤ 0. Then we have
0 ≥ fi(x⋆) ≥ fi(x) + gT^ (x⋆^ − x),
i.e., x⋆^ is in the halfspace
H = {z | 0 ≥ fi(x) + gT^ (z − x)}.
The subgradient update at x, using Polyak’s step length, is just projection of x onto the halfspace H. As an example we consider finding a point x ∈ Rn^ that satisfies a set of linear inequalities aTi x ≤ bi, i = 1,... , m. With ǫ = 0, the subgradient method is very simple: at each step, we find the most violated inequality. Then we project the current point onto the set (halfspace) of points that satisfy this particular inequality:
x(k+1)^ = x(k)^ −
aTi x − bi ‖ai‖^22
ai,
where i is the index of the most violated inequality at x(k). We take a problem instance with n = 100 variables and m = 1000 inequalities, and randomly generate the data, making sure that the set of inequalities is feasible. We use the step size rule (6) with three different values of ǫ. Figure 5 shows the convergence for ǫ = 0, ǫ = 0.01, and ǫ = 0.1. (We terminate the algorithm when we find a point that satisfies the inequalities.)
between the current matrix and its projection onto one of the sets, i.e., ‖X(k+1)^ − X(k)‖F. In the case of the projection onto the set of positive semidefinite matrices, this value is the squareroot of the sum of the squares of the negative eigenvalues of X(k). In the case of the other projection, it is the squareroot of the sum of the squares of the adjustments made to the fixed entries of X(k). In each case, this distance gives an upper bound on the distance to the intersection of the two sets, i.e., the distance to the nearest positive semidefinite completion. The plot is shown in figure 7. We can see that the unknown entries are converging to a positive semidefinite completion. By overprojecting onto Sn +, we could have found an actual positive semidefinite completion in a finite number of steps.
One extension of the subgradient method is the projected subgradient method, which solves the constrained convex optimization problem
minimize f (x) subject to x ∈ C,
where C is a convex set. The projected subgradient method is given by
x(k+1)^ = P
( x(k)^ − αkg(k)
) ,
where P is (Euclidean) projection on C, and g(k)^ is any subgradient of f at x(k). The step size rules described before can be used here, with similar convergence results. Note that x(k)^ ∈ C, i.e., x(k)^ is feasible. The convergence proofs for the subgradient method are readily extended to handle the projected subgradient method. Let z(k+1)^ = x(k)−αkg(k), i.e., a standard subgradient update, before the projection back onto C. As in the subgradient method, we have
‖z(k+1)^ − x⋆‖^22 = ‖x(k)^ − αkg(k)^ − x⋆‖^22 = ‖x(k)^ − x⋆‖^22 − 2 αkg(k)T^ (x(k)^ − x⋆) + α^2 k‖g(k)‖^22 ≤ ‖x(k)^ − x⋆‖^22 − 2 αk(f (x(k)) − f ⋆) + α^2 k‖g(k)‖^22.
Now we observe that
‖x(k+1)^ − x⋆‖ 2 = ‖P (z(k+1)) − x⋆‖ 2 ≤ ‖z(k+1)^ − x⋆‖ 2 ,
i.e., when we project a point onto C, we move closer to every point in C, and in particular, any optimal point. Combining this with the inequality above we get
‖x(k+1)^ − x⋆‖^22 ≤ ‖x(k)^ − x⋆‖^22 − 2 αk(f (x(k)) − f ⋆) + α k^2 ‖g(k)‖^22 ,
and the proof proceeds exactly as in the ordinary subgradient method.
Figure 6: Sparsity pattern of the given matrix with blue entries corresponding to fixed values and white entries corresponding to missing values.
0 20 40 60 80 100
10 −
10 −
10 −
10 0
10 2
k
(k
+1)
(k
F
Figure 7: Convergence of the subgradient method for a matrix completion problem.
(^100 500 1000 1500 2000 2500 ) −
10 −
100
101
k
f^ (k
) best
f
⋆
Figure 8: The value of f (^) best(k) − f ⋆^ versus iteration number k, for the subgradient method with square summable step size rule αk = 0. 1 /k.
has a unique minimizer over x, which we denote x∗(λ). The dual function is then
g(λ) = infx L(x, λ) = f 0 (x∗(λ)) +
∑^ m
i=
λifi(x∗(λ))
(for λ 0). The dual problem is
maximize g(λ) subject to λ 0.
We’ll assume that Slater’s condition holds (again, for simplicity), so we can solve the primal problem by finding an optimal point λ⋆^ of the dual, and then taking x⋆^ = x∗(λ⋆). (For a discussion of solving the primal problem via the dual, see [BV04, §5.5.5].) We will solve the dual problem using the projected subgradient method,
λ(k+1)^ =
( λ(k)^ − αkh
)
(k)).
Let’s now work out a subgradient of the negative dual function. Since −g is a supremum of a family of affine functions of λ, indexed by x, we can find a subgradient by finding one of these functions that achieves the supremum. But there is just one, and it is
−f 0 (x∗(λ)) −
∑^ m
i=
λifi(x∗(λ)),
which has gradient (with respect to λ)
h = −(f 1 (x∗(λ)),... , fm(x∗(λ)) ∈ ∂(−g)(λ).
(Our assumptions imply that −g has only one element in its subdifferential, which means g is differentiable. Differentiability means that a small enough constant step size will yield convergence. In any case, the projected subgradient method can be used in cases where the dual is nondifferentiable.) The projected subgradient method for the dual has the form
x(k)^ = x∗(λ(k)), λ( ik +1)=
( λ( ik )+ αkfi(x(k))
)
In this algorithm, the primal iterates x(k)^ are not feasible, but become feasible only in the limit. (Sometimes we can find a method for constructing a feasible, suboptimal ˜x(k) from x(k).) The dual function values g(λ(k)), as well as the primal function values f 0 (x(k)), converge to f ⋆^ = f 0 (x⋆). We can give a simple interpretation of the algorithm (9). We interpret λi as the price for a ‘resource’ with usage measured by fi(x). When we calculate x∗(λ), we are finding the x that minimizes the total cost, i.e., the objective plus the total bill (or revenue) for the resources used. The goal is to adjust the prices so that the resource usage is within budget (i.e., fi(x) ≤ 0). At each step, we increase the price λi if resource i is over-utilized (i.e., fi(x) > 0), and we decrease the price λi if resource i is under-utilized (i.e., fi(x) < 0). But we never let prices get negative (which would encourage, rather than discourage, resource usage). In general, there is no reason to solve the dual instead of the primal. But for specific problems there can be an advantage. We will see later that the projected subgradient dual algorithm (9) is, in some cases, a decentralized algorithm.
We consider the problem of minimizing a strictly convex quadratic function over the unit box: minimize (1/2)xT^ P x − qT^ x subject to x^2 i ≤ 1 , i = 1,... , n,
where P ≻ 0. The Lagrangian is
L(x, λ) = (1/2)xT^ (P + diag(2λ))x − qT^ x − 1 T^ λ,
so x∗(λ) = (P + diag(2λ))−^1 q. The projected subgradient algorithm for the dual is
x(k)^ = (P + diag(2λ(k)))−^1 q, λ( ik +1)=
( λ( ik )+ αk((x(k))^2 − 1)
)
The dual function is differentiable, so we can use a fixed size α (provided it is small enough).