-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_hillclimb.py
31 lines (26 loc) · 903 Bytes
/
main_hillclimb.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 genetic_algorithm.hill_climb import HillClimb
from models.solution import Solution
from reader import Reader
from utils import Utils
reader = Reader()
reader.read()
if __name__ == '__main__':
Utils.log("Pre-processing..")
Solution.connect_cells_needed = True
solution = Solution.generate_feasible()
# solution.fix()
Solution.connect_cells_needed = False
Utils.log("Pre-processing ended..")
Utils.log("Numb of routers", len(solution.routers))
# print(solution.get_score())
#
# solution.remove_router(solution.routers[0])
# solution.remove_router(solution.routers[0])
# solution.remove_router(solution.routers[0])
solution.connected_cells = {}
solution.score_calculation_needed = True
HillClimb.minutes = 3
hill_climb = HillClimb(solution)
solution = hill_climb.run_by_time()
solution.fix()
print(solution.get_score())