代码拉取完成,页面将自动刷新
%{
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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。