better time management for optimizer
This commit is contained in:
@@ -24,8 +24,8 @@ def test(start_coords: tuple[float, float], finish_coords: tuple[float, float] =
|
||||
nature=Preference(type='nature', score = 5),
|
||||
shopping=Preference(type='shopping', score = 5),
|
||||
|
||||
max_time_minute=1000,
|
||||
detour_tolerance_minute=0
|
||||
max_time_minute=300,
|
||||
detour_tolerance_minute=15
|
||||
)
|
||||
|
||||
# Create start and finish
|
||||
@@ -60,9 +60,14 @@ def test(start_coords: tuple[float, float], finish_coords: tuple[float, float] =
|
||||
refined_tour = refiner.refine_optimization(all_landmarks=landmarks, base_tour=base_tour, max_time = preferences.max_time_minute, detour = preferences.detour_tolerance_minute)
|
||||
|
||||
linked_tour = LinkedLandmarks(refined_tour)
|
||||
total_time = 0
|
||||
logger.info("Optimized route : ")
|
||||
for l in linked_tour :
|
||||
logger.info(f"{l}")
|
||||
total_time += l.duration
|
||||
total_time += l.time_to_reach_next
|
||||
|
||||
logger.info(f"Total time: {total_time}")
|
||||
|
||||
# with open('linked_tour.yaml', 'w') as f:
|
||||
# yaml.dump(linked_tour.asdict(), f)
|
||||
@@ -70,9 +75,9 @@ def test(start_coords: tuple[float, float], finish_coords: tuple[float, float] =
|
||||
return linked_tour
|
||||
|
||||
|
||||
test(tuple((48.8344400, 2.3220540))) # Café Chez César
|
||||
# test(tuple((48.8344400, 2.3220540))) # Café Chez César
|
||||
# test(tuple((48.8375946, 2.2949904))) # Point random
|
||||
# test(tuple((47.377859, 8.540585))) # Zurich HB
|
||||
# test(tuple((45.7576485, 4.8330241))) # Lyon Bellecour
|
||||
test(tuple((45.7576485, 4.8330241))) # Lyon Bellecour
|
||||
# test(tuple((48.5848435, 7.7332974))) # Strasbourg Gare
|
||||
# test(tuple((48.2067858, 16.3692340))) # Vienne
|
||||
|
Reference in New Issue
Block a user