-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScriptPruebas.m
50 lines (49 loc) · 1.95 KB
/
ScriptPruebas.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
Nombres ={['Ackley']; ['Beale']; ['Bohachevsky 1']; ['Bohachevsky 2'];...
['Bohachevsky 3']; ['Booth']; ['Branin']; ['Colvile']; ['Dixon & Price'];...
['Easom']; ['Goldstein & Price']; ['Griewank']; ['Hartmann 3'];...
['Hartmann 6']; ['Hump']; ['Levy']; ['Matyas']; ['Michalewicz']; ['Perm']; ['Powell'];...
['Power Sum']; ['Rastrigin']; ['Rosenbrock']; ['Schwefel']; ['Shekel'];...
['Shubert']; ['Sphere']; ['Sum Squares']; ['Trid']; ['Zakharov']};
funciones={['ackley']; ['beale']; ['boh1']; ['boh2']; ['boh3']; ['booth'];...
['branin']; ['colville']; ['dp']; ['easom']; ['gold']; ['griew'];...
['hart3']; ['hart6']; ['hump']; ['levy']; ['matyas']; ['mich'];...
['perm']; ['powell']; ['powersum']; ['rast']; ['rosen'];...
['schw']; ['shekel']; ['shub']; ['sphere']; ['sum2'];...
['trid']; ['zakh']};
%optimos=[];
%valoptimos=[];
n=length(funciones);
D=2*ones(n,1);
D(8)=4;%colville
D(13)=3;%hart3
D(14)=6;%hart6
D(25)=4;%shekel
NP=5*D;
CR=0.9*ones(n,1);
F=0.8*ones(n,1);
generaciones=50*ones(n,1);
estrategia=ones(n,1);
estrategia(7)=4;%branin-best/2
cotainf=[-15;-4.5;-100;-100;-100;-10;-5;-10;-10;-100;-2;...
-600; 0; 0; -5; -10; -10; -2; -4; 0; -5.12; -5;...
-500; 0; -10; -5.12; -10; -4; -5];
cotasup=[30;4.5;100;100;100;10;15;10;10;100;2;...
600; 1; 1; 5; 10; 10; 2; 5; 2; 4.12; 10;...
500; 10; 10; 5.12; 10; 4; 10];
for i=1:n
%i
%funciones{i}
[xopt,nfevals]=EvoDif(funciones{i}, NP(i), D(i), F(i), CR(i),...
generaciones(i), estrategia(i), cotainf(i)*ones(D(i),1),...
cotasup(i)*ones(D(i),1));
disp(sprintf('Funcion: %s',Nombres{i}))
disp('Mejor individuo: ')
disp(sprintf('\t%d\n',xopt))
disp(sprintf('Valor:\t%d\n',feval(funciones{i},xopt)))
%disp(sprintf('Optimo:\t %s
%valor optimo
%distancia al optimo
%distancia al valor optimo
disp(sprintf('Evaluaciones de la funcion:\t%d\n',nfevals))
disp('-----------------------------')
end