-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExecute.java
More file actions
47 lines (34 loc) · 899 Bytes
/
Execute.java
File metadata and controls
47 lines (34 loc) · 899 Bytes
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
package ga;
import java.util.Collections;
public class Execute {
public static void main(String[] args) {
GeneticAlg ag = new GeneticAlg();
ag.inicializar();
Collections.sort(ag.populacao);
int generation = 0;
while (generation < ag.GERACOES) {
ag.cruzamento();
ag.mutacao();
ag.repopular();
Collections.sort(ag.populacao);
System.out.println(ag.mediaGeracaoFitness());
generation++;
}
ag.imprimir(ag.populacao.get(0));
ag.imprimir(ag.populacao.get(ag.POPULACAO_MAX-1));
}
// Procedimento AG
// { t = 0;
// inicia_população (P, t)
// avaliação (P, t);
// repita até (t = d)
//
// { t = t +1;
// seleção_dos_pais (P,t);
// recombinação (P, t);
// mutação (P, t);
// avaliação (P, t);
// sobrevivem (P, t)
// }
// }
}