Smyk L.
Smyk L.

Reputation: 42

Vehicle skills using or-tools with C#

Im trying to solve Vehicle Routing with Pickups and Deliveries using or-tool with C#. Is it possible to add some kind of skills (product type) to the vehicle? example:

So pickup1 can only be picked up by vehicle2, but pickup2 can be picked up by vehicle1 or vehicle2.

Upvotes: 1

Views: 219

Answers (1)

Laurent Perron
Laurent Perron

Reputation: 11014

You can restrict the vehicle var of each node to filter unskilled vehicles.

For a given node, the vehicle var has a domain [-1, 0, .., num_vehicle - 1].

-1 is assigned to the vehicle var if the node is not visited.

So if you have n vehicle, and you want to forbid vehicle i to visit node j, you need to remove i from the domain of the vehicle var j.

After this removal, the domain of the vehicle var should be [0, .., i - 1, i + 1, .. , n - 1] if the node is not optional, or [-1, .., i - 1, i + 1, .. , n - 1] if the node is optional.

Upvotes: 1

Related Questions