-
大小: 2KB文件类型: .rar金币: 1下载: 0 次发布日期: 2021-05-29
- 语言: Matlab
- 标签:
资源简介
基于非支配排序遗传算法处理多目标优化的matlab例程,可以自行修改
代码片段和文件信息
function nsga_2()
%% Main Function
% Main program to run the NSGA-II MOEA.
% Read the corresponding documentation to learn more about multiobjective
% optimization using evolutionary algorithms.
% initialize_variables has two arguments; First being the population size
% and the second the problem number. ‘1‘ corresponds to MOP1 and ‘2‘
% corresponds to MOP2.
%% Initialize the variables
% Declare the variables and initialize their values
% pop - population
% gen - generations
% pro - problem number
pop = 200;
gen = 1000;
pro = 1;
switch pro
case 1
% M is the number of objectives.
M = 2;
% V is the number of decision variables. In this case it is
% difficult to visualize the decision variables space while the
% objective space is just two dimensional.
V = 6;
case 2
M = 3;
V = 12;
end
% Initialize the population
chromosome = initialize_variables(poppro);
%% Sort the initialized population
% Sort the population using non-domination-sort. This returns two columns
% for each individual which are the rank and the crowding distance
% corresponding to their position in the front they belong.
chromosome = non_domination_sort_mod(chromosomepro);
%% Start the evolution process
% The following are performed in each generation
% Select the parents
% Perfrom crossover and Mutation operator
% Perform Selection
for i = 1 : gen
% Select the parents
% Parents are selected for reproduction to generate offspring. The
% original NSGA-II uses a binary tournament selection based on the
% crowded-comparision operator. The arguments are
% pool - size of the mating pool. It is common to have this to be half the
% population size.
% tour - Tournament size. Original NSGA-II uses a binary tournament
% selection but to see the effect of tournament size this is kept
% arbitary to be choosen by the user.
pool = round(pop/2);
tour = 2;
parent_chromosome = tournament_selection(chromosomepooltour);
% Perfrom crossover and Mutation operator
% The original NSGA-II algorithm uses Simulated Binary Crossover (SBX) and
% Polynomial crossover. Crossover probability pc = 0.9 and mutation
% probability is pm = 1/n where n is the number of decision variables.
% Both real-coded GA and binary-coded GA are implemented in the original
% algorithm while in this program only the real-coded GA is considered.
% The distribution indeices for crossover and mutation operators as mu = 20
% and mum = 20 respectively.
mu = 20;
mum = 20;
offspring_chromosome = genetic_operator(parent_chromosomepromumum);
% Intermediate population
% Intermediate population is the combined population of parents and
% offsprings of the current generation. The population size is almost 1 and
% half times the initial population.
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 4670 2006-03-07 16:48 nsga_2.m
----------- --------- ---------- ----- ----
4888 2
评论
共有 条评论