all tests passed after cache
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m42s
Run linting on the backend code / Build (pull_request) Successful in 27s
Run testing on the backend code / Build (pull_request) Failing after 2m18s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 24s
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m42s
Run linting on the backend code / Build (pull_request) Successful in 27s
Run testing on the backend code / Build (pull_request) Failing after 2m18s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 24s
This commit is contained in:
parent
71abeabbd2
commit
bab6cfe74e
File diff suppressed because one or more lines are too long
@ -55,6 +55,9 @@ class Optimizer:
|
|||||||
self.average_walking_speed = parameters['average_walking_speed']
|
self.average_walking_speed = parameters['average_walking_speed']
|
||||||
self.max_landmarks = parameters['max_landmarks']
|
self.max_landmarks = parameters['max_landmarks']
|
||||||
self.overshoot = parameters['overshoot']
|
self.overshoot = parameters['overshoot']
|
||||||
|
self.time_limit = parameters['time_limit']
|
||||||
|
self.gap_rel = parameters['gap_rel']
|
||||||
|
self.max_iter = parameters['max_iter']
|
||||||
|
|
||||||
|
|
||||||
def init_ub_time(self, prob: pl.LpProblem, x: pl.LpVariable, L: int, landmarks: list[Landmark], max_time: int):
|
def init_ub_time(self, prob: pl.LpProblem, x: pl.LpVariable, L: int, landmarks: list[Landmark], max_time: int):
|
||||||
@ -573,7 +576,10 @@ class Optimizer:
|
|||||||
prob, x = self.pre_processing(L, landmarks, max_time, max_landmarks)
|
prob, x = self.pre_processing(L, landmarks, max_time, max_landmarks)
|
||||||
|
|
||||||
# Solve the problem and extract results.
|
# Solve the problem and extract results.
|
||||||
prob.solve(pl.PULP_CBC_CMD(msg=False, gapRel=0.1, timeLimit=3, warmStart=False))
|
try :
|
||||||
|
prob.solve(pl.PULP_CBC_CMD(msg=False, timeLimit=self.time_limit+1, gapRel=self.gap_rel))
|
||||||
|
except Exception as exc :
|
||||||
|
raise Exception(f"No solution found: {exc}") from exc
|
||||||
status = pl.LpStatus[prob.status]
|
status = pl.LpStatus[prob.status]
|
||||||
solution = [pl.value(var) for var in x] # The values of the decision variables (will be 0 or 1)
|
solution = [pl.value(var) for var in x] # The values of the decision variables (will be 0 or 1)
|
||||||
|
|
||||||
@ -588,18 +594,21 @@ class Optimizer:
|
|||||||
circles = self.is_connected(solution)
|
circles = self.is_connected(solution)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
timeout = 15
|
|
||||||
while circles is not None :
|
while circles is not None :
|
||||||
i += 1
|
i += 1
|
||||||
if i == timeout :
|
if i == self.max_iter :
|
||||||
self.logger.error(f'Timeout: No solution found after {timeout} iterations.')
|
self.logger.error(f'Timeout: No solution found after {self.max_iter} iterations.')
|
||||||
raise TimeoutError(f"Optimization took too long. No solution found after {timeout} iterations.")
|
raise TimeoutError(f"Optimization took too long. No solution found after {self.max_iter} iterations.")
|
||||||
|
|
||||||
for circle in circles :
|
for circle in circles :
|
||||||
self.prevent_circle(prob, x, circle, L)
|
self.prevent_circle(prob, x, circle, L)
|
||||||
|
|
||||||
# Solve the problem again
|
# Solve the problem again
|
||||||
prob.solve(pl.PULP_CBC_CMD(msg=False))
|
try :
|
||||||
|
prob.solve(pl.PULP_CBC_CMD(msg=False, timeLimit=self.time_limit, gapRel=self.gap_rel))
|
||||||
|
except Exception as exc :
|
||||||
|
raise Exception(f"No solution found: {exc}") from exc
|
||||||
|
|
||||||
solution = [pl.value(var) for var in x]
|
solution = [pl.value(var) for var in x]
|
||||||
|
|
||||||
if pl.LpStatus[prob.status] != 'Optimal' :
|
if pl.LpStatus[prob.status] != 'Optimal' :
|
||||||
|
@ -8,5 +8,5 @@ image_bonus: 1.1
|
|||||||
viewpoint_bonus: 5
|
viewpoint_bonus: 5
|
||||||
wikipedia_bonus: 1.25
|
wikipedia_bonus: 1.25
|
||||||
name_bonus: 3
|
name_bonus: 3
|
||||||
N_important: 40
|
N_important: 60
|
||||||
pay_bonus: -1
|
pay_bonus: -1
|
||||||
|
@ -4,3 +4,6 @@ average_walking_speed: 4.8
|
|||||||
max_landmarks: 10
|
max_landmarks: 10
|
||||||
max_landmarks_refiner: 20
|
max_landmarks_refiner: 20
|
||||||
overshoot: 0.0016
|
overshoot: 0.0016
|
||||||
|
time_limit: 1
|
||||||
|
gap_rel: 0.05
|
||||||
|
max_iter: 25
|
Loading…
x
Reference in New Issue
Block a user