General Description:
CoMirror descent for solving problems of the form
Assumptions:
The settings of l2-norm ball and box also handle the situation of matricial decision variables. In this case, the function operates on mxn matrices in the same way it operates on the corresponding m*n-length column vector.
Available oracles:
(the function value of f is not required in the economical setting)
Usage:
out = comd(Ffun,Ffun_sgrad,Gfun,Gfun_sgrad,set,startx,[par]) [out,fmin] = comd(Ffun,Ffun_sgrad,Gfun,Gfun_sgrad,set,startx,[par]) [out,fmin,parout] = comd(Ffun,Ffun_sgrad,Gfun,Gfun_sgrad,set,startx,[par]) Important remark: comd can be run without constraints. In such cases, Gfun and Gfun_sgrad should be replaced by []
Input:
Ffun - function handle for the objective function f Ffun_sgrad - function handle for the subgradient of the objective function f Gfun - function handle for the constraint function g Gfun_sgrad - function handle for the subgradients of the components of the constraint function (arranged in columns) set - underlying set; allowed values: 'simplex', 'ball','box','spectahedron' startx - starting vector par - struct containing different values required for the operation of comd:
Output:out - optimal solution (up to a tolerance) fmin - optimal value (up to a tolerance) parout - a struct containing containing additional information related to the convergence. The fields of parout are: iterNum - number of performed iterations
Method Description:
Employs the CoMirror method for solving
using the following update scheme:
where tk is a stepsize and
The function
The method stops when at least one of the following conditions hold: (1) the number of iterations exceeded max_iter (2) the function value at feasible points did not improve in stuck_iter iterations.
References:
Example 1:
Consider the problem
where A and b are generated by the commands
>> randn('seed',315); >> A=randn(40,100); >> b=randn(40,1); An optimal solution of the problem can be found by the CoMirror method by the following commands
>> f = @(x)norm(A*x-b,1); >> f_grad = @(x)A'*sign(A*x-b); >> [out,fmin]=comd(f,f_grad,[],[],'simplex',zeros(100,1));
Note that we set the initial vector to be the zeros vector. In addition, the solver only prints information on iterations in which the function value improved.
The optimal solution and optimal value are stored in the output variables out and fmin
>> out out = 0.0000 0.0000 0.0000 0.0000 0.0000 0.0806 0.0000 0.0098 : 0.0000 0.0000 0.0000 >> fmin fmin = 27.2816 To plot the function values of the sequence generated by the method the following commands should be executed.
>> [out,fmin,parout]=comd(f,f_grad,[],[],'simplex',zeros(100,1)); >> plot(1:length(parout.funValVec), parout.funValVec) >> par.max_iter=10000; >> [out,fmin]=comd(f,f_grad,[],[],'simplex',zeros(100,1),par); ********************* Co-Mirror ********************* #iter fun. val. 1 34.369794 2 31.413493 3 29.956959 4 29.062173 : : 8660 27.272538 9467 27.272437 9650 27.272244 9993 27.271796 ---------------------------------- Optimal value = 27.271796 Example 2:
Consider the problem
Here A1 and A2 are 10x10 symmetric matrices. To solve the problem using comd, we first reformulate it as
c1,c2,A1,A2 are generated by the commands
>> randn('seed',316); >> A1=randn(10,10); >> A1=(A1+A1')/2; >> A2=randn(10,10); >> A2=(A2+A2')/2; >> c=[1;1]; A subgradient of g can be computed by the formula [v'*A1*v;v2'*A2*v], where v is a normalized eigenvector corresponding to the maximum eigenvalue of x(1)*A1+x(2)*A2-eye(10). This computation is performed in the following MATLAB function (written as a separate m-file)
function out=sgrad_eig(x,A1,A2); [v,d]=eigs(x(1)*A1+x(2)*A2-eye(size(A1)),1,'la'); out=[v'*A1*v;v'*A2*v]; We can now solve the problem using comd
>> f = @(x)c'*x >> f_sgrad = @(x)c >> g=@(x)eigs(x(1)*A1+x(2)*A2-eye(10),1,'la'); >> g_sgrad=@(x)sgrad_eig(x,A1,A2); >> [out,fmin]=comd(f,f_sgrad,g,g_sgrad,'ball',zeros(2,1));
The optimal solution is
>> out out = -0.1539 -0.2333 Note that that the obtained solution slightly violates the constraint (the maximum eigenvalue is 0.000009). If it is imperative that to avoid any violation of constraints we set the parameter par.feas_eps to 0.
>> clear par >> par.feas_eps=0; >> [out,fmin]=comd(f,f_sgrad,g,g_sgrad,'ball',zeros(2,1),par); ********************* Co-Mirror ********************* #iter fun. val. con. val. 2 -0.027117 -0.388949 4 -0.182910 -0.329495 6 -0.261001 -0.200118 8 -0.309909 -0.109328 : : : 664 -0.387207 -0.000009 670 -0.387208 -0.000007 676 -0.387209 -0.000005 682 -0.387209 -0.000003 688 -0.387210 -0.000001 ---------------------------------- Optimal value = -0.387210 Example 3:
Consider the problem
where C,D,C1,C2 are given by >> C = [2.5629 1.2010 0.4374 1.0687 1.2010 0.0511 0.4333 -0.5491 0.4374 0.4333 1.0602 -2.1081 1.0687 -0.5491 -2.1081 0.0795]; >> D = [0.6516 0.7271 1.0526 1.2098 0.7271 0.5108 0.9531 1.5011 1.0526 0.9531 0.3270 1.3611 1.2098 1.5011 1.3611 0.5152]; >> C1 =[0.8328 -0.1293 -0.4879 0.8372 -0.1293 0.8967 0.6505 -0.0566 -0.4879 0.6505 -0.6712 0.5950 0.8372 -0.0566 0.5950 0.3656]; >> C2 =[3.5267 0.2487 -0.6312 0.7461 0.2487 -0.6479 0.9198 -0.2510 -0.6312 0.9198 -1.0649 -0.5603 0.7461 -0.2510 -0.5603 -0.3176]; To solve the problem, we first construct the following MATLAB function (written as a separate m-file) which computes a subgradient of the objective function function out=f_sgrad(X,C,D) a=X+C; a=(a+a')/2; [v,d]=eigs(a,1,'la'); out=v*v'+D; We can now solve the problem using comd >> f=@(X)eigs((X+X')/2+C,1,'la')+trace(D*X); >> clear par >> par.specR=0.2; >> [out,fmin]=comd ( f ,@(X) f_sgrad(X,C,D) ,@(X)[trace(C1*X)-0.6;trace(C2*X)], @(X)[C1,C2],'spectahedron',ones(4,4),par) ; ********************* Co-Mirror ********************* #iter fun. val. con. val. 25 4.099380 -0.000781 26 4.098417 -0.002056 27 4.097445 -0.003327 28 4.096465 -0.004593 29 4.095478 -0.005854 30 4.094484 -0.007110 : : : 973 3.037749 0.000007 978 3.037720 -0.000028 983 3.037691 -0.000063 988 3.037663 -0.000097 993 3.037636 -0.000132 998 3.037609 -0.000166 ---------------------------------- Optimal value = 3.037609 The default for the feasibility violation is 1e-5. We can relax it to a smaller value, say 1e-3, >> par.feas_eps=1e-3 >> [out,fmin]=comd ( f ,@(X) f_sgrad(X,C,D) ,@(X)[trace(C1*X)-0.6;trace(C2*X)], @(X)[C1,C2],'spectahedron',ones(4,4),par) ; ********************* Co-Mirror ********************* #iter fun. val. con. val. 25 4.099380 -0.000781 26 4.098417 -0.002056 27 4.097445 -0.003327 28 4.096465 -0.004593 29 4.095478 -0.005854 : : : 977 3.037426 0.000994 982 3.037398 0.000957 987 3.037370 0.000921 992 3.037343 0.000884 997 3.037317 0.000849 ---------------------------------- Optimal value = 3.037317 Note that the output solution slightly violates the function constraint (by 0.000849). |
Solvers >