simulation based GA, runs slow and calculate more than the number of population

4 views (last 30 days)
Hi everyone:
Im using non-linear constrianted GA to optimize my Simulink model but run into a problem.
As you can see in my code, the population is set to 15 (because it will cost my simulink model around 4mins to calculate each solution so i set it to a small number), but based on my timing record i found GA calculate way more than that on each iteration which is really time-consuming. Any sugguestions will be very much appreciated, thanks !
%% Objective function
ObjectiveFunction = @f_eco; % define objective function
NumVar = 9; % number of variables
LB = [90*10^(-6),330*10^(-6),0.025,250,400,4*10^(-3),0.8,7,7]; % lower bound
UB = [110*10^(-6),400*10^(-6),0.04,350,600,7.2*10^(-3),1.2,12,12]; % upper bound
ConstraintFunction = @f_cons; % constraint function
%% GA Options
% population size
options = optimoptions('ga','PopulationSize',15);
% modifying the stopping criteria
options = optimoptions(options,'MaxGenerations',10,'MaxStallGenerations',inf);
% initial populaztion
options = optimoptions(options,'InitialPopulationMatrix',var_ini);
% visualization
options = optimoptions(options,'PlotFcn',{@gaplotbestf},'Display','iter');
% modify the output
options = optimoptions(options,'OutputFcn',@gaoutfun);
% Termination certeria
options = optimoptions(options,'TolFun',1e-6,'TolCon',1e-3);
% Parrell
options = optimoptions(options,'UseParallel',true,'EliteCount',2);
%% SPMD
spmd
mkdir(sprintf('worker%d', labindex));
copyfile('E28.slx',sprintf('worker%d/',labindex));
cd(sprintf('worker%d', labindex));
end
%% Run GA !
tic
[x,fval,exitFlag,Output] = ga(ObjectiveFunction,NumVar,[],[],[],[],LB,UB, ...
ConstraintFunction,options);
toc
  10 Comments
Jason Xu
Jason Xu on 23 Apr 2019
Hi Stephan, do u know how to use surrogate optimization when the problem is mixed-integer? thanks

Sign in to comment.

Answers (0)

Categories

Find more on Global Optimization Toolbox in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!