Skip to content

Commit

Permalink
[BugFix] fix the vehicle_capacity dimension mismatching bug
Browse files Browse the repository at this point in the history
  • Loading branch information
cbhua committed Mar 13, 2024
1 parent 5e90b77 commit ca9efc1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rl4co/envs/routing/cvrp.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def _reset(
def get_action_mask(td: TensorDict) -> torch.Tensor:
# For demand steps_dim is inserted by indexing with id, for used_capacity insert node dim for broadcasting
exceeds_cap = (
td["demand"][:, None, :] + td["used_capacity"][..., None] > td["vehicle_capacity"]
td["demand"][:, None, :] + td["used_capacity"][..., None] > td["vehicle_capacity"][..., None]
)

# Nodes that cannot be visited are already visited or too much demand to be served now
Expand Down

0 comments on commit ca9efc1

Please sign in to comment.