필터 지우기
필터 지우기

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
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 CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by