Can gaplotpareto be used with saved gamultiobj state data?
Show older comments
I have the gamultiobj state being saved after each generation using outputfunction.m with the following added:
assignin('base','fcnStatus',state)
dt = datestr(now,'mmmm-dd-yyyy_HH_MM_SS');
name = strcat('/Log/',dt,'_Generation');
Filename = sprintf('%s_%d',[pwd name],state.Generation);
save(Filename,'state')
Is it possible to use gaplotpareto to create a graph during the gamultiobj run or after by loading the state data on another computer's matlab instance?
Picture attached of the state loaded on another machine. If gaplotpareto can't be used is there another way to easily recreate the plots from the state data? I'm not too worried about the progressing plot image a static plot for each save state would be great.
Thanks, David
Answers (1)
Alan Weiss
on 6 Aug 2018
I think that gaplotpareto is intended to be used as a plot function, so I believe that it would be difficult to call directly. But you can easily plot the Pareto set yourself from the saved state structure. Extract the state.Population matrix, then call your objective function to get the matrix of values (one row for each population member, one column for each objective function). If your objective function is not vectorized, call it on each row of the population matrix in a loop.
Then plot the resulting values however you like. For example, assuming that F is the resulting matrix of objective function values, and assuming that F has two columns:
plot(F(:,1),F(:,2),'m*')
xlabel('Objective 1')
ylabel('Objective 2')
title('Pareto Front')
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Just for fun in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!