cleaned up folders and defined proper structs
Some checks failed
Build and push docker image / Build (pull_request) Failing after 2m14s
Build and release APK / Build APK (pull_request) Successful in 5m15s
Build web / Build Web (pull_request) Successful in 2m32s

This commit is contained in:
2024-05-29 22:57:11 +02:00
parent 7e4538a1bf
commit 03da8441f2
17 changed files with 103 additions and 38 deletions

42
backend/src/main.py Normal file
View File

@@ -0,0 +1,42 @@
from optimizer import solve_optimization
from .structs.landmarks import LandmarkTest
from .structs.preferences import Preferences
from fastapi import FastAPI
app = FastAPI()
# This should become main at some point
@app.post("optimizer/{longitude}/{latitude}")
def get_data(longitude: float, latitude: float, preferences: Preferences) :
# From frontend get longitude, latitude and prefence list
return
@app.get("optimizer/{max_steps}/{print_details}")
def main(max_steps: int, print_details: bool):
# CONSTRAINT TO RESPECT MAX NUMBER OF STEPS
#max_steps = 16
# Initialize all landmarks (+ start and goal). Order matters here
landmarks = []
landmarks.append(LandmarkTest("départ", -1, (0, 0)))
landmarks.append(LandmarkTest("tour eiffel", 99, (0,2))) # PUT IN JSON
landmarks.append(LandmarkTest("arc de triomphe", 99, (0,4)))
landmarks.append(LandmarkTest("louvre", 99, (0,6)))
landmarks.append(LandmarkTest("montmartre", 99, (0,10)))
landmarks.append(LandmarkTest("concorde", 99, (0,8)))
landmarks.append(LandmarkTest("arrivée", -1, (0, 0)))
visiting_order = solve_optimization(landmarks, max_steps, print_details)
#return visiting_order
# should return landmarks = the list of Landmark (ordered list)
return("max steps :", max_steps, "\n", visiting_order)
"""if __name__ == "__main__":
main()"""