reviewed code structure, cleaned comments, now pep8 conform
This commit is contained in:
@@ -1,11 +1,13 @@
|
||||
import pandas as pd
|
||||
from optimizer import solve_optimization
|
||||
|
||||
from typing import List
|
||||
from landmarks_manager import generate_landmarks
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
|
||||
from optimizer import solve_optimization
|
||||
from structs.landmarks import Landmark
|
||||
from structs.landmarktype import LandmarkType
|
||||
from structs.preferences import Preferences, Preference
|
||||
from fastapi.encoders import jsonable_encoder
|
||||
from typing import List
|
||||
|
||||
|
||||
# Helper function to create a .txt file with results
|
||||
@@ -37,17 +39,24 @@ def test3(city_country: str) -> List[Landmark]:
|
||||
type=LandmarkType(landmark_type='shopping'),
|
||||
score = 5))
|
||||
|
||||
coords = None
|
||||
coordinates = None
|
||||
|
||||
landmarks = generate_landmarks(preferences=preferences, city_country=city_country, coordinates=coords)
|
||||
landmarks, landmarks_short = generate_landmarks(preferences=preferences, city_country=city_country, coordinates=coordinates)
|
||||
|
||||
max_steps = 9
|
||||
#write_data(landmarks)
|
||||
|
||||
visiting_order = solve_optimization(landmarks, max_steps, True)
|
||||
start = Landmark(name='start', type=LandmarkType(landmark_type='start'), location=(48.2044576, 16.3870242), osm_type='start', osm_id=0, attractiveness=0, must_do=True, n_tags = 0)
|
||||
finish = Landmark(name='finish', type=LandmarkType(landmark_type='finish'), location=(48.2044576, 16.3870242), osm_type='finish', osm_id=0, attractiveness=0, must_do=True, n_tags = 0)
|
||||
|
||||
|
||||
print(len(visiting_order))
|
||||
test = landmarks_short
|
||||
|
||||
test.insert(0, start)
|
||||
test.append(finish)
|
||||
|
||||
return len(visiting_order)
|
||||
max_walking_time = 2 # hours
|
||||
|
||||
visiting_list = solve_optimization(test, max_walking_time*60, True)
|
||||
|
||||
|
||||
def test4(coordinates: tuple[float, float]) -> List[Landmark]:
|
||||
@@ -77,7 +86,6 @@ def test4(coordinates: tuple[float, float]) -> List[Landmark]:
|
||||
start = Landmark(name='start', type=LandmarkType(landmark_type='start'), location=(48.8375946, 2.2949904), osm_type='start', osm_id=0, attractiveness=0, must_do=True, n_tags = 0)
|
||||
finish = Landmark(name='finish', type=LandmarkType(landmark_type='finish'), location=(48.8375946, 2.2949904), osm_type='finish', osm_id=0, attractiveness=0, must_do=True, n_tags = 0)
|
||||
|
||||
|
||||
test = landmarks_short
|
||||
|
||||
test.insert(0, start)
|
||||
@@ -91,4 +99,5 @@ def test4(coordinates: tuple[float, float]) -> List[Landmark]:
|
||||
return visiting_list
|
||||
|
||||
|
||||
test4(tuple((48.8795156, 2.3660204)))
|
||||
test4(tuple((48.8795156, 2.3660204)))
|
||||
#test3('Vienna, Austria')
|
Reference in New Issue
Block a user