-
Notifications
You must be signed in to change notification settings - Fork 0
/
BenchmarksMain.py
94 lines (67 loc) · 2.55 KB
/
BenchmarksMain.py
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
"""
def exp1(self):
self.automaton.reinit(50,50)
self.automaton.createPopulation(POPULATION, Agent.constRadium(RMAX))
self.simulation.start(ITERATION)
def exp2(self):
self.automaton.reinit(50,50)
self.automaton.createPopulation(POPULATION, Agent.randomRangeRadiumNormal(RMIN,RMAX))
self.simulation.start(ITERATION)
def exp3(self):
self.automaton.reinit(50,50)
self.automaton.createPopulation(POPULATION, Agent.randomRangeRadiumUnif(RMIN,RMAX))
self.simulation.start(ITERATION)
bench.addExp(exp1,"constRadium-15")
bench.addExp(exp2,"normRadium1-15")
bench.addExp(exp3,"unifRadium1-15")
"""
from Benchmarks import Benchmarks
from Automaton import Automaton
from Agent import Agent
import datetime
import os
__author__ = 'pleger'
""" EXECUTION OF THE EXPERIMENT 20000 22 537"""
if __name__ == '__main__':
REPEAT = 1
DEBUG_ITERATIONS = 1
POPULATION = 20000
ITERATION = 50
RMIN = 1
RMAX = 537
SIZE_Y = 22
SIZE_X = 537
bench = Benchmarks(Automaton(1,1))
def expsPapers():
exps = []
for rmax in [RMAX]:
def exp(self):
self.automaton.reinit(SIZE_X, SIZE_Y)
self.simulation.enableConvergenceStop()
self.automaton.disableRandomVisitingOfCells()
#self.automaton.enableCircularGrid()
self.automaton.createPopulation(POPULATION, Agent.randomRangeRadiumUnif(RMIN,rmax))
self.simulation.start(ITERATION)
exps.append(["normal-1-"+str(rmax),exp])
#for rmax in [1,5,10,15,25]:
# def exp(self):
# self.automaton.reinit(50,50)
# self.automaton.createPopulation(POPULATION, Agent.randomRangeRadiumNormal(1,rmax), Agent.deagglomerationForceFitness)
# self.simulation.start(ITERATION)
#
# exps.append(["degla-normal-1-"+str(rmax),exp])
return exps
bench.addExps(expsPapers())
bench.enableLogScale()
bench.setRepeat(REPEAT)
bench.setDebug(DEBUG_ITERATIONS)
initialTime = datetime.datetime.now()
print "BEGIN BENCH"
bench.run()
print "END BENCH"
finalTime = datetime.datetime.now()
deltaTime = finalTime - initialTime
fileNameZip = "expResult-"+bench.now()+".zip"
os.system("zip -r "+fileNameZip+" exps")
# To work with mail, it is necessary to config sendmail
os.system("echo 'Available results (Time: "+ deltaTime.__str__() +"): http://pleger.cl/ChileCA/"+fileNameZip+"' | mail -s 'ChileCA Results Available' pleger@gmail.com")