started to implement overpass queries
This commit is contained in:
@@ -1,22 +1,30 @@
|
||||
from optimizer import solve_optimization
|
||||
from .structs.landmarks import LandmarkTest
|
||||
from .structs.preferences import Preferences
|
||||
from fastapi import FastAPI
|
||||
from structs.landmarks import LandmarkTest
|
||||
from structs.landmarks import Landmark
|
||||
from structs.preferences import Preferences
|
||||
from fastapi import FastAPI, Query, Body
|
||||
from typing import List
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
|
||||
# Assuming frontend is calling like this :
|
||||
#"http://127.0.0.1:8000/process?param1={param1}¶m2={param2}"
|
||||
# This should become main at some point
|
||||
@app.post("optimizer/{longitude}/{latitude}")
|
||||
def get_data(longitude: float, latitude: float, preferences: Preferences) :
|
||||
@app.post("/optimizer/{longitude}/{latitude}")
|
||||
def main(longitude: float, latitude: float, prefrences: Preferences = Body(...)) -> List[Landmark]:
|
||||
# From frontend get longitude, latitude and prefence list
|
||||
|
||||
return
|
||||
landmarks = []
|
||||
|
||||
@app.get("optimizer/{max_steps}/{print_details}")
|
||||
def main(max_steps: int, print_details: bool):
|
||||
|
||||
return landmarks
|
||||
|
||||
@app.get("test")
|
||||
def test():
|
||||
|
||||
# CONSTRAINT TO RESPECT MAX NUMBER OF STEPS
|
||||
#max_steps = 16
|
||||
max_steps = 16
|
||||
|
||||
|
||||
# Initialize all landmarks (+ start and goal). Order matters here
|
||||
@@ -30,13 +38,14 @@ def main(max_steps: int, print_details: bool):
|
||||
landmarks.append(LandmarkTest("arrivée", -1, (0, 0)))
|
||||
|
||||
|
||||
visiting_order = solve_optimization(landmarks, max_steps, print_details)
|
||||
visiting_order = solve_optimization(landmarks, max_steps, True)
|
||||
|
||||
#return visiting_order
|
||||
return visiting_order
|
||||
|
||||
# should return landmarks = the list of Landmark (ordered list)
|
||||
return("max steps :", max_steps, "\n", visiting_order)
|
||||
#return("max steps :", max_steps, "\n", visiting_order)
|
||||
|
||||
|
||||
"""if __name__ == "__main__":
|
||||
"""# keep this for debug
|
||||
if __name__ == "__main__":
|
||||
main()"""
|
||||
Reference in New Issue
Block a user