-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathABCAlgorithm.py
38 lines (30 loc) · 1.01 KB
/
ABCAlgorithm.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
# github page: https://abcolony.github.io/
# github repository: https://github.com/abcolony/ABCPython
import datetime
import sys
import time
import ABC
import Config
from Reporter import Reporter
def main(argv):
abc_conf = Config.Config(argv)
abc_list = list()
experiment_name = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S").replace(" ", "").replace(":", "")
for run in range(abc_conf.RUN_TIME):
abc = ABC.ABC(abc_conf)
abc.set_experiment_id(run, experiment_name)
start_time = time.time() * 1000
abc.initial()
abc.memorize_best_source()
while not(abc.stopping_condition()):
abc.send_employed_bees()
abc.calculate_probabilities()
abc.send_onlooker_bees()
abc.memorize_best_source()
abc.send_scout_bees()
abc.increase_cycle()
abc.globalTime = time.time() * 1000 - start_time
abc_list.append(abc)
Reporter(abc_list)
if __name__ == '__main__':
main(sys.argv[1:])