fmincon optimization not responding to options settings

I am performing an optimization where every objective function evaluation involves a time-consuming algorithm. To see whether things are working properly, I thought I'd set the 'MaxFunctionEvaluations' option to a low value. But it seems the optimization is not responding to whatever options I set whatsoever.
My options and fmincon call are:
options = optimoptions('fmincon','Display','iter','Algorithm','sqp','MaxFunctionEvaluations',4,'StepTolerance',1e-2); % 4 eval for tests
[x, fval, exitflag, output, lambda] = fmincon(@(x)this.jumphigh_obj(x),x0,A,b,Aeq,beq,lb,ub,@(x)this.jumpcon(x),options);
I feel like I am missing something basic. I appreciate any help.

 채택된 답변

Alan Weiss
Alan Weiss 2017년 11월 7일

1 개 추천

It is possible that you have more than 4 dimensions in the problem. No matter what you set for MaxFunctionEvaluations, fmincon will take at least N + 1 function evaluations in order to estimate a gradient, where N is the number of problem variables.
Alan Weiss
MATLAB mathematical toolbox documentation

댓글 수: 6

Thanks, I do have more than 4 dimensions in the problem.
Still, the other options have no effect. The 'Display','iter'.. does not yield any display information and the step tolerance options setting has no influence on the step either.
For more help, please give more detail. What does MATLAB show when you run it? Errors? Warnings? Did you copy-paste the exact and complete options statement and fmincon call? What are the sizes of your arguments A, b, lb, etc.?
Also, what happens when you run
xtest = this.jumphigh_obj(x0)
[ctest,ceqtest] = this.jumpcon(x0)
Alan Weiss
MATLAB mathematical toolbox documentation
Matlab shows no errors or warnings when I run it. I copy-pasted the exact options statement and fmincon call. My argument sizes:
A=[];
b=[];
Aeq=[];
beq=[];
size lb
1 164 % 164 problem variables
size ub
1 164
When I run the above
xtest =
-0.0662
And
ctest =
[]
ceqtest =
[]
Right now as it is a work in progress the constraint function is:
function [g, geq] = jumpcon(this,x)
%TODO: add CoM final x position =0 constraint?
g = [];
geq =[];
end
So I guess the values make sense.
I believe that what is happening is that your extremely low value of MaxFunctionEvaluations causes fmincon to halt after its initial evaluation of the function and its initial gradient estimation. So it may never get to start iterating. Also, when your nonlinear constraint doesn't do anything at all, it is not a good idea to include it in the fmincon call.
I suggest that, instead of a very low MaxFunctionEvaluations value, set a MaxIterations of 2. And possibly display some statements from within your objective function just so you know what is happening. Maybe even set a plot function.
Alan Weiss
MATLAB mathematical toolbox documentation
P.S. It is no surprise that the StepTolerance option has no effect, as it is a stopping criterion, it does not control the iterative step sizes that fmincon takes.
Thanks, I have drastically downscaled my number of variables and it works now. A small change in a variable yielded no change in the outcome of the objective function. With less variables actual iterations occur.
Thanks for letting us know what happened. You might be interested in this documentation (I guess now that you are optimizing a simulation, but I was not aware of that before).
Alan Weiss
MATLAB mathematical toolbox documentation

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Get Started with Optimization Toolbox에 대해 자세히 알아보기

질문:

2017년 11월 7일

댓글:

2017년 11월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by