Skip to content

Commit

Permalink
minor changes in cvrp/local_search.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeok9855 committed Feb 14, 2025
1 parent d4695c3 commit 9261d20
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rl4co/envs/routing/cvrp/local_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@
assert os.path.isfile(HGS_LIBRARY_FILEPATH) # Failure case will be handled in the env.py


def local_search(td: TensorDict, actions: torch.Tensor, max_iterations: int = 1000) -> torch.Tensor:
def local_search(
td: TensorDict, actions: torch.Tensor, max_iterations: int = 1000, **kwargs
) -> torch.Tensor:
"""
Improve the solution using local search for CVRP, based on PyVRP.
Expand Down Expand Up @@ -365,7 +367,7 @@ def local_search(self, data, routes: List[np.ndarray], count: int = 1) -> List[n
assert dist_mtx.shape[0] == dist_mtx.shape[1]
assert (dist_mtx >= 0.0).all()

callid = (time.time_ns()*10000+random.randint(0,10000))%C_INT_MAX
callid = (time.time_ns()*100000+random.randint(0,100000))%C_INT_MAX

tmppath = "/tmp/route-{}".format(callid)
resultpath = "/tmp/swapstar-result-{}".format(callid)
Expand Down

0 comments on commit 9261d20

Please sign in to comment.