how to save all optimum values in each generation (iteration) of gamultiobj optimisation (optimization)

14 views (last 30 days)
I use gamultiobj to do a multiobjective optimisation. using the option settings, it is possible to see the Pareto front plot for each iteration and it also gives the final optimal values. but I need to plot all optimal values for all iterations in a single graph to show the improvements of the results during the iterations. So, I need either a single plot or a file which includes all Pareto optimal values for all iterations. Can someone help me how to do that?

Answers (1)

Madhav Rajan
Madhav Rajan on 21 Jul 2015
I understand that you are trying to save all optimum values in each generation of the "gamultiobj" optimization. Asuming that you have the Optimization Toolbox, the following steps and the example shown below can serve as a good reference point for your issue
1) Set the 'display' property to 'iter'. With this you can see the results of each iteration on the MATLAB console. 2) Set the 'OutputFcn' property to the handle of a customizable user defined function which will be called at the end of every iteration. You must adhere to the 'OutputFcn' template which can be accessed through the following command:
>> edit gaoutputfcntemplate
An example is shown below: 1) The Output function file 'outputfunction.m':
function [state, options,optchanged] = outputfunction(options,state,flag)
%displays the function eval value at each iteration. You can change this
disp(state.FunEval);
optchanged = false;
switch flag
case 'init'
disp('Starting the algorithm');
case {'iter','interrupt'}
disp('Iterating ...')
case 'done'
disp('Performing final task');
end
2) The display and output options are set as follows:
options = gaoptimset('PopulationSize',60,'PlotFcns',@gaplotpareto, 'display', 'iter', 'OutputFcns', @outputfunction);
3) Finally you call the "gamultiobj' with the options variable set as follows:
X = gamultiobj(FITNESSFCN,NVARS,A,b,Aeq,beq,LB,UB,nonlcon, options)
With the help of the Ouptut Function, you could save your results to a file and then create a plot.
You can refer the following link about for more information about the Output Function options:
You can refer the following link for more information about the allowable optimization options: http://www.mathworks.com/help/gads/gaoptimset.html
You can refer the following example for the "gamultiobj" function and use it in conjunction with the above options parameters: http://www.mathworks.com/help/gads/gamultiobj.html#zmw57dd0e33278
Hope I have answered your question.

Community Treasure Hunt

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

Start Hunting!