-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLauncher.java
More file actions
47 lines (38 loc) · 1.04 KB
/
Launcher.java
File metadata and controls
47 lines (38 loc) · 1.04 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
package simulator;
public class Launcher {
public static void main(String[] args) {
// set window value carefully!
final int windowX = 10;
final int windowY = 10;
//test
// try {
LinAlgebra la = new LinAlgebra();
la.displayGraph("EMPTY", "", "x ", "y ", windowX, windowY);
Point[] p = la.genRandomPopulation();
int count = 0;
la.initPopulation(p);
try {
Thread.sleep(2000);
double prevObjFunSoln = 0;
double currObjFunSoln = 99;
while (Math.abs(currObjFunSoln - prevObjFunSoln) > 0.0001) {
count++;
la.updateGraph("Generation-" + count + ":Entire Population");
prevObjFunSoln = currObjFunSoln;
currObjFunSoln = la.printSolution();
Thread.sleep(700);
la.calFitness();
la.genMatingPool();
la.updateGraph("Generation-" + count + ":Mating Pool");
Thread.sleep(700);
la.breed();
la.updateGraph("Generation-" + count + ":Offsprings");
Thread.sleep(700);
System.gc();
}
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}