VRPTW with time window to avoid visiting at

102 views
Skip to first unread message

Mohamed W. Mehrez

unread,
Jun 2, 2021, 8:37:52 AM6/2/21
to or-tools-discuss
Hi or-tools experts,

I am currently using the VRP with time window TW constraint. I understand how it is working; however, I was wondering if I can add a constraint on the vehicles for NOT to visit a certain location during a pre-specified time window. 

Your help is highly appreciated!
Mohamed

dqvi...@gmail.com

unread,
Jun 2, 2021, 8:39:58 AM6/2/21
to or-tools...@googlegroups.com

I think you just need to reverse your problem.

 

So let’s say you don’t a vehicle to visit a location from [0,8], you can define the allowed time windows I [8,24].

 

Hope it helps

--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/6cbf6ccc-90f7-4b17-a702-a43dbce89113n%40googlegroups.com.

Mohamed W. Mehrez

unread,
Jun 2, 2021, 8:46:53 AM6/2/21
to or-tools...@googlegroups.com
Thank you for your reply,

This sounds good for a prohibited time window that starts from zero; however, what if I Don't want the vehicles to visit a certain location during the window [9-15]. 

Thanks again!
Mohamed

You received this message because you are subscribed to a topic in the Google Groups "or-tools-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/or-tools-discuss/do6zqDuSSFA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to or-tools-discu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/or-tools-discuss/034501d757ac%2463a52e00%242aef8a00%24%40gmail.com.

Vinh Dang

unread,
Jun 2, 2021, 8:58:21 AM6/2/21
to or-tools...@googlegroups.com
You can define multiple time windows I think. 


Hope it helps


Regards


From: or-tools...@googlegroups.com <or-tools...@googlegroups.com> on behalf of Mohamed W. Mehrez <mehrez...@gmail.com>
Sent: Wednesday, June 2, 2021 7:46:30 PM
To: or-tools...@googlegroups.com <or-tools...@googlegroups.com>
Subject: Re: [or-tools-discuss] VRPTW with time window to avoid visiting at
 

Vincent Furnon

unread,
Jun 2, 2021, 9:01:41 AM6/2/21
to or-tools...@googlegroups.com

Mizux Seiha

unread,
Jun 2, 2021, 10:57:03 AM6/2/21
to or-tools-discuss
You can use time_dimension.CumulVar(index).RemoveInterval(a, b)

e.g. https://github.com/Mizux/tsp_multiple_days/blob/feature/morning_nodes/40_Locations_3_days.py

Mohamed W. Mehrez

unread,
Jun 2, 2021, 9:13:49 PM6/2/21
to or-tools-discuss
The RemoveInterval solution worked. Thank you very much!
Reply all
Reply to author
Forward
0 new messages