reviewed code structure, cleaned comments, now pep8 conform
All checks were successful
Build and push docker image / Build (pull_request) Successful in 2m17s
Build and release APK / Build APK (pull_request) Successful in 6m53s
Build web / Build Web (pull_request) Successful in 1m31s

This commit is contained in:
2024-06-11 20:14:12 +02:00
parent af4d68f36f
commit 111e6836f6
10 changed files with 423 additions and 500 deletions

View File

@@ -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')