fmincon and patternsearch initial point
Show older comments
I had initially planned to use fmincon as my optimization method, but as I varied initial points, I was receiving enough variation in output that I thought perhaps there were several local minima. While this didn't entirely make sense, I tried using patternsearch to find a global solution.
clc
clear
%options=optimoptions('fmincon', 'Display', 'iter', 'OptimalityTolerance', 10.0000e-06, 'StepTolerance', 10.0000e-10)
Lmax=.25;
r=.03;
Xfix=.5;
p=.35;
w=40000;
year=80;
growa=12.91;
growb=223.71;
C=20000;
A=[-1 0;0 -1];
b=[0;0];
Aeq=[-1 0];
beq=[-.25];
z=[];
h=[];
iteration=[];
%for m=1:5;
x0=[.1 40];
for n=1:9
utility=@(x)-1*((Lmax-x(1)/(1-exp(-r*x(2))))^(.1*n)*((w*year*Xfix)/r+x(1)*((exp(-r*x(2))*p*exp(growa-growb/x(2))-C)/(1-exp(-r*x(2)))))^(1-.1*n));
[y,fval]=fmincon(utility,x0,A,b,Aeq,beq);
%[y,fval]=patternsearch(utility,x0,A,b,Aeq,beq);
z=[z;y];
h=[h;fval];
iteration=[iteration;n];
end
g=[iteration z h];
min(fval);
i=[z(:,1)];
j=[z(:,2)];
%plot3(i,j,h)
%end
format long g;
g
pattersearch appears to only returns an answer when initial point is [0 0]. And by my math, it doesn't seem to be returning a minimum. There is definitely something I'm missing.
Answers (0)
Categories
Find more on Surrogate Optimization 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!