필터 지우기
필터 지우기

Why does Pattern Search take so long?

조회 수: 29 (최근 30일)
Igor
Igor 2014년 1월 4일
댓글: Igor 2014년 1월 12일
Hello,
Could anyone please help me figure out the following?
This is the first time I have tried the pattern search solver for my optimization problem with 29 unknowns. The problem only has lower and upper bounds. I have successfully worked with a number of local optimizers like lsqnonlin on the same problem.
I wonder why pattern search took a tremendous amount of time (compared with local solvers) for the same number of function evaluations (100,000 in this case) as with local solvers. Please look at the options I am using:
opts = psoptimset( 'Cache','on', 'CompletePoll','on', 'InitialMeshSize',0.1, ...
'MaxIter',1e4, 'MaxFunEvals',1e5, 'ScaleMesh','off' );
When I run optimization (please see below), it hits the maximum number of function evaluations allowed. This in itself might not be good, but the issue is the overall time being more than 4,000 seconds:
tic; [param, fval, exitflag, output] = patternsearch( fun, guess_new, [], [], [], [], ...
zeros(1,29), ones(1,29), [], opts ); toc
Maximum number of function evaluations exceeded: increase options.MaxFunEvals.
Elapsed time is 4131.745766 seconds.
Whenever I simply run the same function this many times (100,000), it only takes around 800 seconds. Similarly, when passing the same function to fmincon or lsqnonlin, it takes 800-900 seconds for 100,000 function counts.
Besides, from my point of view, the default pattern, which is 'GPS Positive basis 2N', should take 58 function counts at each iteration: this is due to having 29 unknown as well as using 'on' for 'CompletePoll'. If I limit MaxFunEvals to 100,000, the number of iterations taken before hitting the limit and stopping the optimization should be (100000 / 58) = 1724. However, it can be seen from the output structure that the actual iteration number is greater than 1724:
output
output =
function: [function_handle]
problemtype: 'boundconstraints'
pollmethod: 'gpspositivebasis2n'
searchmethod: []
iterations: 1948
funccount: 100000
meshsize: 3.9063e-04
maxconstraint: 0
message: 'Maximum number of function evaluations exceeded: increase options.MaxFunEvals.'
This, together with the timing issue, makes me think how pattern search worked in this particular case. I would greatly appreciate any help.
Thank you in advance,
Igor.

채택된 답변

Alan Weiss
Alan Weiss 2014년 1월 6일
편집: Alan Weiss 2014년 1월 6일
Perhaps the Cache option should be 'off'. Please let us know if that makes a difference.
If the problem is suitable for lsqnonlin or fmincon, then those solvers will undoubtedly be more efficient. As you probably know, patternsearch is less efficient than they are. patternsearch is recommended for nonsmooth functions, while Optimization Toolbox solvers are for smooth functions.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 9
Alan Weiss
Alan Weiss 2014년 1월 10일
Based on your latest description, it seems to me that lsqnonlin accompanied by larger-than-default finite difference steps, and possibly central finite differences, is your best bet.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Igor
Igor 2014년 1월 12일
Alan,
Thank you. I agree that 'lsqnonlin' is the best one for this task. I've been using central finite differences for a long time. I guess I will have to cope with the noise to try to reduce it somehow. Otherwise, optimization will suffer too much.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by