fminimax option iter not working

1 view (last 30 days)
Ingrid on 22 Dec 2015
Commented: Alan Weiss on 28 Dec 2015
I want to be able to follow the iteration process of fminimax so that I can see if there is improvement or not since my function takes a very long time to calculate. I use the code below but I do not get any update of the iteration process in the command window. How can I follow the iteration process? Am I implementing this wrong or is there another method? I can see that it is iterating in the task manager (with peaks going up and down cyclical in the memory showing that the data required by the function is loaded and discarded) so there is no problem in the implementation of my function (for example eternal loop)
options = optimoptions(@fminimax,'Display','iter',...
% 'PlotFcns',@optimplotx);
x = fminimax(@myLongFunction,x0,[],[],[],[],[],[],[],options);

Answers (1)

Alan Weiss
Alan Weiss on 22 Dec 2015
What are the number of elements in x0? If you have more than 49, then your function might never take even the first step because you limit the number of function evaluations to 50, and fminimax needs more than that number to begin its estimation of the local gradient.
If your function evaluations take a long time because you are running a simulation or solving a differential equation, see some suggestions in the documentation.
I think that you had a good idea to plot something. @optimplotfunccount might give you some idea of how many function counts are needed. Basically, I suggest that you get rid of the 'MaxFunEvals' option and try again.
Alan Weiss
MATLAB mathematical toolbox documentation
Alan Weiss
Alan Weiss on 28 Dec 2015
If I understand you correctly, you have only a one-dimensional control variable x, and you have 276 objective functions, and you want to find x that minimizes the maximum objective. Is that correct? If so, just reformulate your problem so that x0 is a scalar, and I think that fminimax will operate quickly enough for you, especially if you have a reasonably large DiffMinChange option and have reasonable bounds lb and ub. Though you might have already found that you can just make a fine enough search using linspace, it is probably the case that fminimax would be quicker if you ever again need to solve a similar problem.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.


Community Treasure Hunt

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

Start Hunting!