a basic question about subgradient method
Show older comments
greetings, hi... here is what i'm dealing with...
- i need to test a program for subgradient method with several value of alpha.
- i have the program but i need to modify it a little bit..
- this is my template
function [x,hist] = sgm_pwl_nonsum_dimin(A,b,x1,a,MAX_ITERS)
% subgradient method for linear piecewise minimization
% uses nonsummable diminishing step size rule, **alpha_k = a/sqrt(k)**
f = [+Inf]; fbest = [+Inf];
k = 0;
x = x0;
while k < MAX_ITERS
% subgradient calculation
[fval,ind] = max(A*x+b);
g = A(ind,:)';
% step size selection
alpha = a/sqrt(k);
% store objective values
f(end+1) = fval;
fbest(end+1) = min( fval, fbest(end) );
% subgradient update
x = x - alpha*g; k = k + 1;
end
% collect history information
hist{1} = f; hist{2} = fbest;
My questions are
- I need to update the value of x (x_new=x_old-alpha*g)
- I need to find the difference between x_new and x_old
- Since the difference is in matrix and have a few elements, I need to find the min of x_new-x_old
- Same goes to subgradient, after finding one, I need to find the difference and find the max value .
How can I do that? thx
Answers (0)
Categories
Find more on Optics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!