Ga algorithm fitness value not improving
古いコメントを表示
Hello users,
This is the first time I'm using genetic algorithms. I am attempting to tune PID gains. As I observe the results I find that the fitness value is not improving, infact it's not changing at all. I am wondering what I am doing wrong. Before running the code I first initized k1=[1 1 1]. Below is my script written as clearly as I could.
% Inner Loop Controller
%Population range
InitialPopulationRange1 = [50 50 10;inf inf inf];
var_num1=3; % number of variables
lb1=[50 50 10]; % solution lower bound
ub1=[inf inf inf]; % solution upper bound
%Initial population
PopulationSize = 10; %Population size
InitialPopulationMatrix1=rand(PopulationSize,3);
MaxGenerations=10; % max no. of generations
MaxStallGenerations=5; %max generations when solution doesn't change
% ga options
ga_opt1 = optimoptions(@ga,'MaxGenerations',MaxGenerations,'MaxStallGenerations',MaxStallGenerations,'PopulationSize',PopulationSize,'SelectionFcn',{@selectiontournament,4},'FitnessScalingFcn',@fitscalingprop,'MutationFcn',{@mutationadaptfeasible},'PlotFcn',@gaplotbestf);
% Reproduction options
ga_opt1.EliteCount = 0;
ga_opt1.CrossoverFraction=0.8;
obj_fn=@(k) optimization_PID(k1);
% ga Command
[k1,best]=ga((obj_fn),var_num1,[],[],[],[],lb1,ub1,[],ga_opt1)
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Solver Outputs and Iterative Display についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

