It seems that patternsearch does not use my initial guess.

2 Ansichten (letzte 30 Tage)
Greetings,
I am working on a optimization problem by patternseach. I have a initial guess vector whose objective function is about 13.5. However, when I used the patterensearch, the objective function is 63.59 far from my initial guess; even after 2200 iterations, it is still far from my inital guess. I checked the x0 of patteren search at iter 0 and found it used [1 0 0...] as x0, instead of my inital guess vector or (my inital guess vector + [1 0 0 ...]).
I wish it can search from my initial guess and the range I provided. Are there any good suggestions?

Akzeptierte Antwort

Stephane Dauvillier
Stephane Dauvillier am 16 Jul. 2019
Hi,
After checking your code I've seen your write to time lb(222) and the second time you specify lb(222)=0 BUT your initial guess doesn't meet the lower bound (para0(222) = -0.0098). That's why patternsearch was changing your initial guess
  1 Kommentar
Xin Shen
Xin Shen am 16 Jul. 2019
Thank you so much!!! I cannot find the bug for several days. I will redo my optimization again!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Stephane Dauvillier
Stephane Dauvillier am 15 Jul. 2019
Can you provided your coe ?
Is there any constaints for your oproblem and the initakl guess doesn't fit the constraint ?
  1 Kommentar
Xin Shen
Xin Shen am 15 Jul. 2019
Bearbeitet: Xin Shen am 15 Jul. 2019
My decision variable vector is para, which includes w vector and other decision variables. In terms of constraints, I used a equality constratint sum(w) = 1 and lb & ub constraints in my code. And I think initial guess satisfy all constraints.
% w is a decicison vector initialized by value 1/220
% sum(w) = 1 is the only one equality constraint used in optimization
w = 1/220 * ones(220,1);
% other decision variables and initial guess
Vm=2.2*4e-5;dtyr=-0.0098; dile=-0.0344; darg=-0.00418;Km=1.5;dthr=-0.0949;dglu=-3.4032; dasp=-0.2327;
bspec=[1e-3;2e-4;1e-3;1e-3;1e-3;1e-3;1e-4;1e-3;1e-3;1e-3;1e-3;1e-5;1e-4;1;1e-5;1e-3;1e3];
% initial guess vector
para0 = [w;Vm;dtyr; dile; darg;Km;dthr;dglu; dasp; bspec];
% lb and ub constraints used in optimization
lb = zeros(size(para0));
ub = zeros(size(para0));
lb(1:220) = 0; lb(221) = 0; lb(222) = -0.9; lb(223) = -3.4; lb(224) = -0.42;
lb(225) = 0; lb(226) = -9.5; lb(227) = -340; lb(228) = -23; lb(229:245) = 0;
lb(222) = 0; lb(245) = 0;
ub(1:220) = 1; ub(221) = 0.01; ub(222) = 0; ub(223) = 0; ub(224) = 0;
ub(225) = 150; ub(226) = 0; ub(227) = 0; ub(228) = 0; ub(229:245) = 0.1;
ub(242) = 100; ub(245) = 1e5;
options = optimoptions('patternsearch','UseParallel',false,'PlotFcn',{@psplotbestf,@psplotbestx},'Display','iter',...
'MeshTolerance',1e-6,'OutputFcns',@(optimvalues,options,flag)custom(optimvalues,options,flag,data_exp));
% sum(w) = 1 is the only one equality constraint used in optimization
para_opt = patternsearch(@(para)CostFun(para,data_exp),para0,[],[],...
[ones(1,size(w,1)) zeros(1,length(para0)-length(w))],1,lb,ub,[],options);

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by