Inter route constraint

Is it possible to have a new constraint type which depends on state of other vehicle.


  1. A location can have a maximum parking space, so there is an upper limit of maximum number of vehicle that can visit it simultaneously.
  2. If a vehicle has already visited a store second vehicle can not visit that store on same day.

Hi @Bhoumik_Shah,

I think it is possible. You will need to create states to memorize the state of other routes so that in the constraint when evaluating the insertion into a route you do not need to go over other routes.

Regarding your examples, the second one is definitely doable, as it is effectively the same as a constraint that a group of jobs cannot be assigned to more than one routes.

The first one is a bit more complicated. You can create states to memorize the arrival time of each activities in each route, and, in the constraint, for each activity from the newAct onwards, compare its (new) arrival time with that of other activities that share the same location with it. As you can see, in the constraint you will need to loop over the activities in the route, so it will not be so efficient.

Best regards,