fixed input as coordinates
This commit is contained in:
67
backend/src/tester.py
Normal file
67
backend/src/tester.py
Normal file
@@ -0,0 +1,67 @@
|
||||
from optimizer import solve_optimization
|
||||
from landmarks_manager import generate_landmarks
|
||||
from structs.landmarks import LandmarkTest
|
||||
from structs.landmarks import Landmark
|
||||
from structs.landmarktype import LandmarkType
|
||||
from structs.preferences import Preferences, Preference
|
||||
from fastapi import FastAPI, Query, Body
|
||||
from typing import List
|
||||
|
||||
|
||||
def test3(city_country: str) -> List[Landmark]:
|
||||
|
||||
|
||||
preferences = Preferences(
|
||||
sightseeing=Preference(
|
||||
name='sightseeing',
|
||||
type=LandmarkType(landmark_type='sightseeing'),
|
||||
score = 5),
|
||||
nature=Preference(
|
||||
name='nature',
|
||||
type=LandmarkType(landmark_type='nature'),
|
||||
score = 0),
|
||||
shopping=Preference(
|
||||
name='shopping',
|
||||
type=LandmarkType(landmark_type='shopping'),
|
||||
score = 5))
|
||||
|
||||
landmarks = generate_landmarks(city_country, preferences)
|
||||
|
||||
max_steps = 9
|
||||
|
||||
visiting_order = solve_optimization(landmarks, max_steps, True)
|
||||
|
||||
print(len(visiting_order))
|
||||
|
||||
return len(visiting_order)
|
||||
|
||||
|
||||
def test4(coordinates: tuple[float, float]) -> List[Landmark]:
|
||||
|
||||
|
||||
preferences = Preferences(
|
||||
sightseeing=Preference(
|
||||
name='sightseeing',
|
||||
type=LandmarkType(landmark_type='sightseeing'),
|
||||
score = 5),
|
||||
nature=Preference(
|
||||
name='nature',
|
||||
type=LandmarkType(landmark_type='nature'),
|
||||
score = 0),
|
||||
shopping=Preference(
|
||||
name='shopping',
|
||||
type=LandmarkType(landmark_type='shopping'),
|
||||
score = 5))
|
||||
|
||||
landmarks = generate_landmarks(coordinates, preferences)
|
||||
|
||||
max_steps = 90
|
||||
|
||||
visiting_order = solve_optimization(landmarks, max_steps, True)
|
||||
|
||||
print(len(visiting_order))
|
||||
|
||||
return len(visiting_order)
|
||||
|
||||
|
||||
test3(tuple((48.834378, 2.322113)))
|
Reference in New Issue
Block a user