fminimax option iter not working

조회 수: 3 (최근 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에서 Linear Algebra에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by