-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexperiment_aco.py
31 lines (27 loc) · 1.18 KB
/
experiment_aco.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
from problems.travelling_salesman.tsp_candidate import *
from problems.travelling_salesman.parser import *
from experiment.generator import ExperimentGenerator
from experiment.worker import Worker
from hippie.ant_colony.initializer import *
from hippie.ant_colony.evaporator import *
from hippie.ant_colony.intensifier import *
from hippie.ant_colony.optimizer import *
from hippie.ant_colony.convergence import *
problem = "1.tsp"
distance_matrix = parse_to_matrix("problems/travelling_salesman/data/"+problem)
experiments_parms = {
'n_ants': [10],
'initializer': [ConstantInitializer(distance_matrix.shape[0], 1)],
'evaporator': {'type': [Evaporator], 'rate': [0.1]},
'intensifier': {'type': [BestIntensifier], 'pheromone_increase': [0.5, 5]},
'convergence_criterion': {'type': [MaxIteration], 'n_max_iterations': [120]},
'ant_type': [LogicalTSPAnt],
'ant_gen_parms': {'type':[dict],
'distance_matrix': [distance_matrix],
'pathfinding_alpha': [1],
'pathfinding_beta': [0]}
}
experiments = ExperimentGenerator(AntColonyOptimizer, experiments_parms)
arbeiter = Worker(experiments)
arbeiter.start()
arbeiter.wait()