object function iteration gets stuck
3 次查看(过去 30 天)
显示 更早的评论
Help!!!I'm comfused!!! why it always get stuck when I tried a iteration of the object function ?both in the optimization tool and command window?
As in the title,I'm calculating the minimum values of a 6 parameters-function with the
fminsearch function, both tried in the tool box and the commmand window,and it always get seized up and be no responsible at all, and the 'stop'and 'pause' buttons will not work at all. Did anyone has met the same problem?
Thank you!
And part of the function codes:
options=optimset('OutputFcn',@outf,'Display','iter','MaxIter',20);
hold on
objfun=@fitmeson;
[x,fval,exitflag,output]=fminsearch(objfun,[0.0021,0.062,0.329,0.875,0.394,10.009],options)
hold off
and the results screenshots:
>> OutputFcn
r = 0.0021 0.0698836 0.289626 0.8604 0.4159 10
Iteration Func-count min f(x) Procedure
0 1 0.102388
r = 0.0021 0.0698836 0.289626 0.8604 0.4159 10
1 7 0.0980085 initial simplex
r = 0.0021 0.0698836 0.304107 0.8604 0.4159 10
2 9 0.0832537 reflect
r = 0.002135 0.0710483 0.294453 0.87474 0.395105 10.1667
3 10 0.0832537 reflect
r = 0.002135 0.0710483 0.294453 0.87474 0.395105 10.1667
4 11 0.0832537 reflect
r = 0.002135 0.0710483 0.294453 0.87474 0.395105 10.1667
5 13 0.0753749 expand
r = 0.00196194 0.0685895 0.306789 0.911387 0.397416 10.0093
6 15 0.0753749 contract inside
r = 0.00196194 0.0685895 0.306789 0.911387 0.397416 10.0093
7 16 0.0753749 reflect
r = 0.00196194 0.0685895 0.306789 0.911387 0.397416 10.0093
8 17 0.0753749 reflect
r = 0.00196194 0.0685895 0.306789 0.911387 0.397416 10.0093
9 19 0.0753621 reflect
r = 0.0021031 0.0678226 0.305696 0.896988 0.386462 10.0147
10 20 0.0753621 reflect
r = 0.0021031 0.0678226 0.305696 0.896988 0.386462 10.0147
11 28 0.0743308 shrink
r = 0.00203252 0.068206 0.306243 0.904187 0.391939 10.012
12 30 0.0743308 contract outside
r = 0.00203252 0.068206 0.306243 0.904187 0.391939 10.012
13 31 0.0743308 reflect
r = 0.00203252 0.068206 0.306243 0.904187 0.391939 10.012
14 33 0.0736525 reflect
r = 0.00207703 0.0665389 0.305426 0.895153 0.391695 10.1499
15 35 0.0729338 reflect
r = 0.0020862 0.066819 0.30623 0.89782 0.39315 9.9468
16 37 0.0729338 contract inside
r = 0.0020862 0.066819 0.30623 0.89782 0.39315 9.9468
17 38 0.0729338 reflect
r = 0.0020862 0.066819 0.30623 0.89782 0.39315 9.9468
18 39 0.0729338 reflect
r = 0.0020862 0.066819 0.30623 0.89782 0.39315 9.9468
And whatever I set the iteration as 100 or 40 or some other values,it will stuck here at 18th iteration~!!!!
0 个评论
回答(2 个)
Titus Edelhofer
2012-3-5
Hi,
what happens If you hit Ctrl-C? Do you see an error message that tells you, where you interupted the calculation? If yes, set a breakpoint there and start again. When you come to the 18th iteration, take a look at the sizes of variables ...
Titus
Titus Edelhofer
2012-3-7
Hi,
what you see is the stack trace, i.e., fminsearch calls fitmeson, fitmeson calls massp etc. Take a look at the top most lines:
In propagate_solution (line 193)
[theta0,theta1] = prufer(y(1),y(2),y1(1),y1(2),e,vbar,h,S);
In locate_eigenvalue (line 39)
[yr,yer,theta] =
propagate_solution(eold,yf,yef,part.imatch+1,truncb,part,Vmatch,false);
In calculate_eigenvalues>init_ev (line 454)
[prufc,enew] = locate_eigenvalue(ec,part,vmin,trunca,truncb);
What happens here in the functions? Is there perhaps some loop in the locate_eigenvalue function that does not terminate? Or in propage_solution? When you stopped there, use the debugger to identify loop counters (if there) or other variables that might diagnose what happens ...
Titus
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MPC Design 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!