1 Star 1 Fork 0

Yangyan Xu / Sheng-mamn

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
main.m~ 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
Thiago Moura 提交于 2015-12-21 10:55 . x
%{
FUNCTION: main.m
DESCRIPTION: Runs the original MAMN algorithm and the modified one (with
crowding and gradient mutation).
INPUTS:
- Database file;
- Population size;
- Maximum number of generations;
- Algorithm(s) to run:
- 'both': runs original MAMN and the modified one;
- 'original': runs only original MAMN;
- 'modified': runs only modified one.
If 'both', the same generated population will be used for both algorithms.
OUTPUTS (as prints):
- Best individual for each method;
- Best fitness for each method.
%}
function [] = main(dataset, pop_size, max_gen, alg)
%%%%%%%%%
% Carrega dados da base de dados passada
%%%%%%%%%
fprintf('\nDATASET: %s\n', dataset);
[dados, ~] = loadData(sprintf('data/%s.data', dataset)); % Elimina a coluna de Labels (classes)
% Generating initial population
pop = geraPopulacao(dados, pop_size);
fprintf('\nCHOSEN: %s\n', alg);
if strcmp(alg, 'both')
fprintf('\n###\nORIGINAL\n###');
tic;
ga(dados, pop_size, max_gen, pop);
time_original = toc;
fprintf('\n###\nMODIFIED\n###');
ga_contrib(dados, pop_size, max_gen, pop);
elseif strcmp(alg, 'original')
fprintf('\n###\nORIGINAL\n###');
ga(dados, pop_size, max_gen, pop);
elseif strcmp(alg, 'modified')
fprintf('\n###\nMODIFIED\n###');
ga_contrib(dados, pop_size, max_gen, pop);
end
end
Matlab
1
https://gitee.com/xuyangyan/Sheng-mamn.git
git@gitee.com:xuyangyan/Sheng-mamn.git
xuyangyan
Sheng-mamn
Sheng-mamn
master

搜索帮助