forked from hencabral/metaheuristica-ant-colony
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
24 lines (18 loc) · 797 Bytes
/
main.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
from cvrp import CVRP, Heuristicas
import numpy as np
import random as rd
if __name__ == '__main__':
if __debug__:
print('modo debug ATIVADO')
else:
print('mode debug DESATIVADO')
np.random.seed(7)
rd.seed(7)
cvrp = CVRP('instancias/instancia1-vrp.txt')
heuristicas = Heuristicas(cvrp, plot=False)
print(cvrp)
# cost, route = heuristicas.ant_colony(ite=1, ants=1000, online=True, elitist=True, evapor=0.3)
cost, route = heuristicas.ant_colony(ite=50, ants=20, online=False, update_by='rank', k=5, worst=True, elitist=True, evapor=0.5)
# cost, route = heuristicas.ant_colony(ite=50, ants=20, online=False, update_by='quality', k=5, worst=True, elitist=True, evapor=0.3)
print(cvrp.route_cost(route))
cvrp.plot(routes=route)