Limit max vehicles in list of nodes in time window #2535
Replies: 2 comments 4 replies
-
|
I figured It. I will use additional nodes as zone entry/exit points. |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Take a look at the resource constraint example: https://developers.google.com/optimization/routing/cvrptw_resources # Add resource constraints.
your_node_list = [12,13,14,...]
solver = routing.solver()
intervals = []
for node in your_node_list:
# Add time windows for each node
intervals.append(
solver.FixedDurationIntervalVar(
time_dimension.CumulVar(manager.NodeToIndex(node)), # start time
service_time, # duration
f'node_{node}_interval'))
# each node use 1 "token" of the resource
resource_usage = [1 for i in range(len(intervals))]
solver.Add(
solver.Cumulative(
intervals,
resource_usage,
number_of_token_available, # here 1 if we want one visit at a time
'congestion')) |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
Is there a simple way to limit the number of vehicles visiting a list of nodes in a certain time window?
I want to model zone congestion control.
Thanks a lot,
Ronen
Beta Was this translation helpful? Give feedback.
All reactions