-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.m
More file actions
73 lines (62 loc) · 1.41 KB
/
Main.m
File metadata and controls
73 lines (62 loc) · 1.41 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
clc;clear all;
%csvwrite('AntiVirus.csv', inputs)
%filename = 'DataSets/forestfires.csv';
%filename = 'DataSets/bank.csv';
%filename = 'DataSets/AntiVirus.csv';
%lines=25;
%filename = 'DataSets/movement_libras.csv';
%[numbers, TEXT, everything] =xlsread(filename);
%[M,N]=size(numbers);
%if(M>lines)
% M=lines;
%end
%X = numbers(:,1:N-1); Y = numbers(:,N);
rng(10);
N = 8; M = 30;
X = randn(M,N); Y = randn(M,1);
%LS:
%X = numbers(:,1:N-1); Y = numbers(:,N);
m=0.4;
Q = 30;
I = 100;
pc = 5;
C = 10;
[LSsolGi,LSmeGi,LSeGi,LSpcGi,LSposGi,LStime]=LR_LS(X,Y,m,Q,I,pc,C);
fprintf(num2str(LStime));
%ACO:
%X = numbers(:,1:N-1); Y = numbers(:,N);
m=0.4;
Q = 30;
I = 100;
pc = 5;
C = 10;
numberOfAnts=200;
coefPheromone=0.1;
beta=1;
alfa=1;
[ACOsolGi,ACOmeGi,ACOdeGi,ACOpcGi,ACOposGi,ACOtime]=LR_LS_AC(X,Y,m,Q,I,pc,C,numberOfAnts,coefPheromone,beta,alfa);
fprintf(num2str(ACOtime));
%GA:
%X = numbers(:,1:N-1); Y = numbers(:,N);
m=0.4;
Q = 30;
I = 100;
pc = 5;
C = 10;
mutacion=0.2;
numerOfGenerations=200;
[GAsolGi,GAmeGi,GAdeGi,GApcGi,GAposGi,GAtime]=LR_LS_GA(X,Y,m,Q,I,pc,C, mutacion,numerOfGenerations);
fprintf(num2str(GAtime));
%SA:
%X = numbers(:,1:N-1); Y = numbers(:,N);
m=0.4;
Q = 30;
I = 100;
pc = 5;
C = 10;
IniTemp=500;
coolingRate=0.80;
minTemp=10^-2;
I = 20;
[SAsolGi,SAmeGi ,SAdeGi,SApcGi,SAposGi,SAtime]=LR_LS_SA(X,Y,m,Q,I,pc,C,IniTemp,coolingRate,minTemp);
fprintf(num2str(SAtime));