Trip Planner¶
- class main.components.trip_planner.TripPlanner¶
The TripPlanner object contains functions used for Trip Planner tab
Methods:
add_new_point_on_table(lat, lon, landmark, data)Adds new entry into landmark table
best_route_gurobi(distance_matrix)Calculates best route using gurobi optimiser
best_route_nearest_insertion(distance_matrix)Calculates best route using nearest insertion heuristic
best_route_nearest_neighbour(distance_matrix)Calculates best route using nearest neighbour heuristic
Get distance and duration matrix from landmark table, calls Google API
get_distance_from_routes(routes, distance_matrix)Calculates distance from existing routes tuple list
get_map_from_table(data, children)Adds landmark location pin on map from landmark table
get_permutation_of_routes(routes_list, landmark)Get permutation of routes with existing routes list and new landmark
get_routes_from_list(routes_list)Get tuple of routes from existing routes list
get_street_name(lat, lon)Get street name from latitude and longitude information, calls Google API
get_style_table(data)Return style of landmark table
optimiser_pipeline(data)Pipeline to run optimization algorithm
Removes last entry from landmark table
- add_new_point_on_table(lat: float, lon: float, landmark: str, data: List[Dict[str, Any]]) List[Dict[str, Any]]¶
Adds new entry into landmark table
- Parameters:
lat – latitude information
lon – longitude information
landmark – name of landmark, could be None or empty string
data – data of landmark table
- static best_route_gurobi(distance_matrix: ndarray) List[Any]¶
Calculates best route using gurobi optimiser
- Parameters:
distance_matrix – inter-distance between locations
- Returns:
list containing tuple of routes
- best_route_nearest_insertion(distance_matrix: ndarray) List[Any]¶
Calculates best route using nearest insertion heuristic
- Parameters:
distance_matrix – inter-distance between locations
- Returns:
contains tuple of routes
- static best_route_nearest_neighbour(distance_matrix: ndarray) List[Any]¶
Calculates best route using nearest neighbour heuristic
- Parameters:
distance_matrix – inter-distance between locations
- Returns:
list containing tuple of routes
- get_distance_and_duration_from_table(data: List[Dict[str, Any]])¶
Get distance and duration matrix from landmark table, calls Google API
- Parameters:
data – data of landmark table
- Returns:
2-element tuple
(np.ndarray): distance matrix
(np.ndarray): duration matrix
- static get_distance_from_routes(routes: List[Any], distance_matrix: ndarray) float¶
Calculates distance from existing routes tuple list
- Parameters:
routes – list of tuple of existing routes
distance_matrix – inter-distance between locations
- static get_map_from_table(data: List[Dict[str, Any]], children: List[Any]) List[Any]¶
Adds landmark location pin on map from landmark table
- Parameters:
data – data of landmark table
children – current map children
- Returns:
updated map children
- static get_permutation_of_routes(routes_list: List[Any], landmark: int) List[Any]¶
Get permutation of routes with existing routes list and new landmark
- Parameters:
routes_list – existing routes
landmark – new landmark to visit
- Returns:
list of list
- static get_routes_from_list(routes_list: List[Any]) List[Any]¶
Get tuple of routes from existing routes list
- Parameters:
routes_list – existing routes
- Returns:
list of tuple
- get_street_name(lat: float, lon: float) str¶
Get street name from latitude and longitude information, calls Google API
Return default string if street name is not found
- Parameters:
lat – latitude information
lon – longitude information
- static get_style_table(data: List[Dict[str, Any]]) Dict[str, str]¶
Return style of landmark table
- Parameters:
data – data of landmark table
- optimiser_pipeline(data: List[Any]) str | List¶
Pipeline to run optimization algorithm
- Parameters:
data – data of landmark table
- static remove_last_point_on_table(data: List[Dict[str, Any]]) List[Dict[str, Any]]¶
Removes last entry from landmark table
- Parameters:
data (list) – data of landmark table
- Returns:
(list)