fixed input as coordinates
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from pydantic import BaseModel
|
||||
from OSMPythonTools.api import Api
|
||||
from .landmarktype import LandmarkType
|
||||
from .preferences import Preferences
|
||||
|
||||
@@ -12,19 +13,10 @@ class Landmark(BaseModel) :
|
||||
name : str
|
||||
type: LandmarkType # De facto mapping depending on how the query was executed with overpass. Should still EXACTLY correspond to the preferences
|
||||
location : tuple
|
||||
|
||||
# loop through the preferences and assign a score to the landmark
|
||||
def score(self, preferences: Preferences):
|
||||
|
||||
for preference_name, preference in preferences.__dict__.items():
|
||||
|
||||
if (preference_name == self.type.landmark_type) :
|
||||
score = preference.score
|
||||
|
||||
if (not score) :
|
||||
raise Exception(f"Could not determine score for landmark {self.name}")
|
||||
|
||||
else :
|
||||
return score
|
||||
osm_type : str
|
||||
osm_id : int
|
||||
attractiveness : int
|
||||
must_do : bool
|
||||
n_tags : int
|
||||
|
||||
|
||||
|
@@ -3,8 +3,8 @@ from .landmarktype import LandmarkType
|
||||
|
||||
class Preference(BaseModel) :
|
||||
name: str
|
||||
type: LandmarkType
|
||||
score: int
|
||||
type: LandmarkType # should match the attributes of the Preferences class
|
||||
score: int # score could be from 1 to 5
|
||||
|
||||
# Input for optimization
|
||||
class Preferences(BaseModel) :
|
||||
@@ -17,11 +17,11 @@ class Preferences(BaseModel) :
|
||||
# Shopping (diriger plutôt vers des zones / rues commerçantes)
|
||||
shopping : Preference
|
||||
|
||||
# Food (price low or high. Combien on veut dépenser pour manger à midi/soir)
|
||||
""" # Food (price low or high. Combien on veut dépenser pour manger à midi/soir)
|
||||
food_budget : Preference
|
||||
|
||||
# Tolérance au détour (ce qui détermine (+ ou -) le chemin emprunté)
|
||||
detour_tol : Preference
|
||||
detour_tol : Preference"""
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user