cleaned up folders and defined proper structs
This commit is contained in:
42
backend/src/main.py
Normal file
42
backend/src/main.py
Normal 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()"""
|
||||
Reference in New Issue
Block a user