Changing Stopping Criteria for MATLAB ODE113

1 view (last 30 days)
Peter
Peter on 12 Mar 2015
Edited: Peter on 12 Mar 2015
I am implementing an optimization algorithm which does the following:
1) Evaluates an objective function, its gradient, Hessian, and minimum eigenvalue. 2) Based on the size of the eigenvalue expresses the optimization method as an ODE based on the gradient descent method if the value is small, Newton, or a mix for borderline cases. 3) This ODE is passed to the optimization solver, the answer is taken from the solver, and the function starts again from (1)
The algorithm works to optimizes most of the test problems I have been working on thus far but it doesn't work for 2 and for many of them it doesn't produce similar results to what is reported in the paper.
I double checked the paper and the specifications for ODE113 are:
RelTol = 10^-8
AbsTol = 10^-9
The third option is the one that I am not entirely sure how to implement for ODE113 ( I did check the documentation page). Can someone give me input on how I might changed this to fit the parameters or if it is a default setting?
Additionally, for greater clarity I am providing my code, and how it is implemented/passed to ODE113 below.
if true
function [ F ] = zklForODE( func )
global HoldEigen HoldType;
HoldType = {0};
function [dx lambda type] = call_func(t, x)
[Fx, Gx, Hx,lambda] = feval(func.tional,x);
sigma1 = 1/(10^9);
sigma2 =1000*sigma1;
alph = @(lambda,sig1, sig2) (lambda - sig1)/(sig2 - sig1);
if lambda > sigma2
dx = -inv(Hx)*Gx;
type = 'N';
elseif lambda < sigma1
dx = -Gx;
type = 'G';
else
A = (lambda - sigma1)/(sigma2-sigma1);
B = 1-A;
dx = -A*(inv(Hx)*Gx) - B*Gx;
type = 'M';
end
HoldEigen(end+1) = lambda;
HoldType{end+1} = type;
disp({Fx, lambda,type })
end
F = @call_func;
end
end
The method is then implemented with the following lines:
global HoldEigen HoldType
HoldEigen = [0];
HoldType = {0}
tic
func.tional = functional;
odef = zkl(func);
options = odeset('RelTol', 1e-8, 'AbsTol', 1e-9, 'NormControl', 'on', 'Stats', 'on');
[t, answer] = ode113(odef, [0 100], starter',options);
endans = answer(end,:);
runtime = toc;
Thanks for your time and attention.

Answers (0)

Categories

Find more on Operating on Diagonal Matrices 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!