フィルターのクリア

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

1 回表示 (過去 30 日間)
Jason Xu
Jason Xu 2019 年 1 月 11 日
編集済み: Jason Xu 2019 年 5 月 1 日
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 件のコメント
Stephan
Stephan 2019 年 1 月 15 日
ah ok - thank you
Jason Xu
Jason Xu 2019 年 4 月 23 日
Hi Stephan, do u know how to use surrogate optimization when the problem is mixed-integer? thanks

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by