diff options
Diffstat (limited to 'dashboard_website/router.py')
| -rw-r--r-- | dashboard_website/router.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/dashboard_website/router.py b/dashboard_website/router.py index 5d5a909..1a90a9e 100644 --- a/dashboard_website/router.py +++ b/dashboard_website/router.py @@ -2,13 +2,14 @@ import numpy as np import requests from sklearn.cluster import KMeans import time -from datetime import datetime +import datetime from datastructs import * host = "http://acetyl.net:5000" # queries acetyl.net:5000, the OSRM engine +endtime = datetime.datetime(2023, 11, 18, 18, 35) # 11/18/2023 6:35pm # external facing functions @@ -77,6 +78,8 @@ def cluster_and_optimize(clues: [Clue], bikes: [Bike], end: Point, time_diff=0.2 :param n: the number of routes to create :return: a list of lists of clues (ordered by position on route), and a list of json route geojsons """ + # OVERRIDE MAX TIME + max_time = datetime.datetime.now() - endtime routes = [clues] # one bike = one set of routes. only need to remove the faraway waypoints if len(bikes) > 1: # Create a new column with normalized gps coordinates and centroids @@ -106,7 +109,7 @@ def cluster_and_optimize(clues: [Clue], bikes: [Bike], end: Point, time_diff=0.2 geometries.append(route_json['trips'][0]['geometry']['coordinates']) route_waypoints.append(route_json['waypoints']) eta = time.time() + route_json['trips'][0]['duration'] + 90 * len(route) - eta_str = datetime.fromtimestamp(eta).strftime("%I:%M:%S%p") + eta_str = datetime.datetime.fromtimestamp(eta).strftime("%I:%M:%S%p") times.append(eta_str) # Use the waypoint_index to reorder each route |
