fixed loki + some opti changes
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m36s
Run linting on the backend code / Build (pull_request) Successful in 27s
Run testing on the backend code / Build (pull_request) Failing after 4m46s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 22s
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m36s
Run linting on the backend code / Build (pull_request) Successful in 27s
Run testing on the backend code / Build (pull_request) Failing after 4m46s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 22s
This commit is contained in:
@@ -87,7 +87,7 @@ class Optimizer:
|
||||
|
||||
# inequality matrix and vector
|
||||
A_ub = np.zeros(L*L, dtype=np.int16)
|
||||
b_ub = round(max_time*self.overshoot)
|
||||
b_ub = round(max_time*(1.1+max_time*self.overshoot))
|
||||
|
||||
for i, spot1 in enumerate(landmarks) :
|
||||
c[i] = spot1.attractiveness
|
||||
@@ -489,6 +489,17 @@ class Optimizer:
|
||||
return L
|
||||
|
||||
|
||||
def warm_start(self, x: list[pl.LpVariable], L: int) :
|
||||
|
||||
for i in range(L*L) :
|
||||
x[i].setInitialValue(0)
|
||||
|
||||
x[1].setInitialValue(1)
|
||||
x[2*L-1].setInitialValue(1)
|
||||
|
||||
return x
|
||||
|
||||
|
||||
def pre_processing(self, L: int, landmarks: list[Landmark], max_time: int, max_landmarks: int | None) :
|
||||
"""
|
||||
Preprocesses the optimization problem by setting up constraints and variables for the tour optimization.
|
||||
@@ -539,6 +550,7 @@ class Optimizer:
|
||||
self.respect_order(prob, x, L) # Respect order of visit (only works when max_time is limiting factor)
|
||||
self.respect_user_must(prob, x, L, landmarks) # Force to do/avoid landmarks set by user.
|
||||
|
||||
# return prob, self.warm_start(x, L)
|
||||
return prob, x
|
||||
|
||||
|
||||
@@ -561,7 +573,7 @@ class Optimizer:
|
||||
prob, x = self.pre_processing(L, landmarks, max_time, max_landmarks)
|
||||
|
||||
# Solve the problem and extract results.
|
||||
prob.solve(pl.PULP_CBC_CMD(msg=False, gapRel=0.1))
|
||||
prob.solve(pl.PULP_CBC_CMD(msg=False, gapRel=0.1, timeLimit=10, warmStart=False))
|
||||
status = pl.LpStatus[prob.status]
|
||||
solution = [pl.value(var) for var in x] # The values of the decision variables (will be 0 or 1)
|
||||
|
||||
|
Reference in New Issue
Block a user