more balanced scores
All checks were successful
Build and push docker image / Build (pull_request) Successful in 1m41s
All checks were successful
Build and push docker image / Build (pull_request) Successful in 1m41s
This commit is contained in:
@@ -25,6 +25,11 @@ class LinkedLandmarks:
|
||||
"""
|
||||
Create the links between the landmarks in the list by setting their .next_uuid and the .time_to_next attributes.
|
||||
"""
|
||||
|
||||
# Mark secondary landmarks as such
|
||||
self.update_secondary_landmarks()
|
||||
|
||||
|
||||
for i, landmark in enumerate(self._landmarks[:-1]):
|
||||
landmark.next_uuid = self._landmarks[i + 1].uuid
|
||||
time_to_next = get_time(landmark.location, self._landmarks[i + 1].location)
|
||||
@@ -34,6 +39,22 @@ class LinkedLandmarks:
|
||||
self._landmarks[-1].next_uuid = None
|
||||
self._landmarks[-1].time_to_reach_next = 0
|
||||
|
||||
def update_secondary_landmarks(self) -> None:
|
||||
# Extract the attractiveness scores and sort them in descending order
|
||||
scores = sorted([landmark.attractiveness for landmark in self._landmarks], reverse=True)
|
||||
|
||||
# Determine the 10th highest score
|
||||
if len(scores) >= 10:
|
||||
threshold_score = scores[9]
|
||||
else:
|
||||
# If there are fewer than 10 landmarks, use the lowest score in the list as the threshold
|
||||
threshold_score = min(scores) if scores else 0
|
||||
|
||||
# Update 'is_secondary' for landmarks with attractiveness below the threshold score
|
||||
for landmark in self._landmarks:
|
||||
if landmark.attractiveness < threshold_score:
|
||||
landmark.is_secondary = True
|
||||
|
||||
|
||||
def __getitem__(self, index: int) -> Landmark:
|
||||
return self._landmarks[index]
|
||||
|
Reference in New Issue
Block a user