fixed the optimizer_v4

This commit is contained in:
2024-07-07 16:24:15 +02:00
parent e71c92da40
commit d4e964c5d4
7 changed files with 358 additions and 113 deletions

View File

@@ -73,7 +73,7 @@ def test4(coordinates: tuple[float, float]) -> List[Landmark]:
sightseeing=Preference(
name='sightseeing',
type=LandmarkType(landmark_type='sightseeing'),
score = 5),
score = 0),
nature=Preference(
name='nature',
type=LandmarkType(landmark_type='nature'),
@@ -105,21 +105,22 @@ def test4(coordinates: tuple[float, float]) -> List[Landmark]:
with open (os.path.dirname(os.path.abspath(__file__)) + '/parameters/optimizer.params', "r") as f :
parameters = json.loads(f.read())
max_landmarks = parameters['max landmarks']
max_walking_time = 120 # minutes
detour = 30 # minutes
max_walking_time = 120 # minutes
detour = 10 # minutes
# First stage optimization
#base_tour = solve_optimization(landmarks_short, max_walking_time, True)
base_tour = solve_optimization(landmarks_short, max_walking_time, True)
#base_tour = solve_optimization(landmarks_short, max_walking_time, True)
# First stage using NetworkX
base_tour = generate_path(landmarks_short, max_walking_time, max_landmarks)
#base_tour = generate_path(landmarks_short, max_walking_time, max_landmarks)
# Second stage using linear optimization
refined_tour = refine_optimization(landmarks, base_tour, max_walking_time+detour, True)
if detour != 0 :
refined_tour = refine_optimization(landmarks, base_tour, max_walking_time+detour, True)
# Second stage using NetworkX
#refined_tour = refine_path(landmarks, base_tour, max_walking_time+detour, True)
@@ -130,8 +131,8 @@ def test4(coordinates: tuple[float, float]) -> List[Landmark]:
return refined_tour
#test4(tuple((48.8344400, 2.3220540))) # Café Chez César
test4(tuple((48.8344400, 2.3220540))) # Café Chez César
#test4(tuple((48.8375946, 2.2949904))) # Point random
#test4(tuple((47.377859, 8.540585))) # Zurich HB
test4(tuple((45.7576485, 4.8330241))) # Lyon Bellecour
#test4(tuple((45.7576485, 4.8330241))) # Lyon Bellecour
#test3('Vienna, Austria')