fminimax option iter not working

1 次查看(过去 30 天)
Ingrid
Ingrid 2015-12-22
评论: Alan Weiss 2015-12-28
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',...
'MaxFunEvals',50,'MaxIter',50,'UseParallel',0,'PlotFcns',[]);
% 'PlotFcns',@optimplotx);
x = fminimax(@myLongFunction,x0,[],[],[],[],[],[],[],options);

回答(1 个)

Alan Weiss
Alan Weiss 2015-12-22
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
  5 个评论
Ingrid
Ingrid 2015-12-24
the values are all independent from each other. So x0(1) only influences goal(1) and so on so it does not really have 276 dimensions. I guess that is why my approach was flawed.
Alan Weiss
Alan Weiss 2015-12-28
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by