• 游鱼儿
    了解作者
  • matlab
    开发工具
  • 7KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 10 积分
    下载积分
  • 14
    下载次数
  • 2019-11-18 17:33
    上传日期
这是遗传算法多目标优化程序。虽然是基础的GA算法程序,但是注释清晰,可以修改目标函数运行,也可以在此基础上进行算法优化
遗传算法多目标优化.rar
  • NSGAII
  • evaluate_objective.m
    970B
  • nsga_2.m
    4.6KB
  • plot_objective.m
    476B
  • replace_chromosome.m
    1.9KB
  • initialize_variables.m
    966B
  • non_domination_sort_mod.m
    4KB
  • genetic_operator.m
    3.4KB
  • crowding_distance.m
    1.2KB
  • tournament_selection.m
    1.7KB
内容介绍
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(pop,pro); %% 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(chromosome,pro); %% 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(chromosome,pool,tour); % 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_chromosome,pro,mu,mum); % 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. [main_pop,temp] = size(chromosome); [offspring_pop,temp] = size(offspring_chromosome); intermediate_chromosome(1:main_pop,:) = chromosome; intermediate_chromosome(main_pop + 1 : main_pop + offspring_pop,1 : M+V) = ... offspring_chromosome; % Non-domination-sort of intermediate population % The intermediate population is sorted again based on non-domination sort % before the replacement operator is performed on the intermediate % population. intermediate_chromosome = ... non_domination_sort_mod(intermediate_chromosome,pro); % Perform Selection % Once the intermediate population is sorted only the best solution is % selected based on it rank and crowding distance. Each front is filled in % ascending order until the addition of population size is reached. The % last front is included in the population based on the individuals with % least crowding distance chromosome = replace_chromosome(intermediate_chromosome,pro,pop); if ~mod(i,10) fprintf('%d\n',i); end end %% Result % Save the result in ASCII text format. save solution.txt chromosome -ASCII %% Visualize % The following is used to visualize the result for the given problem. switch pro case 1 plot(chromosome(:,V + 1),chromosome(:,V + 2),'*'); title('MOP1 using NSGA-II'); xlabel('f(x_1)'); ylabel('f(x_2)'); case 2 plot3(chromosome(:,V + 1),chromosome(:,V + 2),chromosome(:,V + 3),'*'); title('MOP2 using NSGA-II'); xlabel('f(x_1)'); ylabel('f(x_2)'); zlabel('f(x_3)'); end
评论
    相关推荐
    • 多目标优化.zip
      多目标优化模型matlab详细代码,文件里面有代码说明。以及代码注释
    • 多目标优化.rar
      多目标优化的各种类型算法的仿真程序,粒子群、遗传等等
    • 多目标优化算法
      蜻蜓灰狼pso等等matlab算法集合,融合了多目标处理,提供了现成的数据可直接运行
    • CS多目标.zip
      布谷鸟多目标算法用来函数寻优,本代码给出了通用版本,能够很好的适应和学习
    • 多目标优化.zip
      多目标程序优化,各种算法,成本费用优化,大家可以相互交流
    • 多目标优化moda
      多目标优化算法MODA。应用在工程技术领域解决多目标优化问题
    • GA多目标约束问题1.2.zip
      NSGA算法,对目标函数进行优化,得出优选的解集合
    • 多目标优化OTL算法
      多目标优化OTL算法,可以供初学者学习。多目标优化OTL算法,可以供初学者学习。
    • MATLAB多目标优化
      多目标优化与决策的基本方法 基于Matlab的一种现代方法
    • 多目标函数优化
      MATLAB多目标优化模型代码,只需要自己修改目标函数,可以运行,在数学建模等比赛中可以使用,可以直接运行,还含有遗传算法的工具箱,解压添加路径就可以使用,百度查询MATLAB工具箱导入即可