资源简介

本资源是Mgasa算法解决TSP问题的Matlab代码,资源中包括mgasa_main(Mgasa算法解决TSP问题代码),mgasa_fitness(适应度求取函数代码),mgasa_annealing(Mgasa算法中模拟退火代码),mgasa_select(遗传算法中选择函数代码),mgasa_crossover(遗传算法中染色体交叉互换函数代码),mgasa_mutation(遗传算法中基因突变函数代码),mgasa_change(Mgasa算法中选择过程代码)。同时代码中有Location矩阵,其中30个坐标作为TSP问题的例子。

资源截图

代码片段和文件信息

function child=mgasa_annealing(TemppopdisConstantfitnessn)
%  Editor     : lfr_0531
%  Date       : 2015.1.20
%  input:  pop: an input array contains the routes.
%          dis: an inout array of the distance.
%          Constant:the number of the inner loop.
%          fitness: an array of the fitness data.
%          n: the number of the child‘s sample. 
%  output: the array of the child.
Iloop=0;
pm=0.1;
while Iloop    [parentsmax_pop]=mgasa_select(popfitnessn-2); %选择
    parents_fitness=mgasa_fitness(parentsdis);
    child=mgasa_crossover(parents);                    %交叉
    child=mgasa_mutation(childpm);                    %变异
    child_fitness=mgasa_fitness(childdis);            %子代适应度
    child=mgasa_change(childparentschild_fitnessparents_fi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         417  2016-01-27 19:25  Location.mat
     文件         980  2016-01-27 20:17  mgasa_annealing.m
     文件         820  2016-01-27 20:25  mgasa_change.m
     文件         862  2016-01-27 20:16  mgasa_crossover.m
     文件         535  2016-01-27 19:51  mgasa_fitness.m
     文件        2049  2016-01-27 22:40  mgasa_main.m
     文件         683  2016-01-27 20:18  mgasa_mutation.m
     文件         570  2016-01-27 20:15  mgasa_select.m

评论

共有 条评论