skatsuta / vrp-solver

Capacitated Vehicle Routing Problem with Time Windows (CVRPTW) solver written in Python.
MIT License
88 stars 26 forks source link

it is mapping vehicles for node with zero requirement #1

Closed Abdulla-mubharak closed 4 years ago

Abdulla-mubharak commented 4 years ago

respected skatsuta,

I tried giving demand zero for all the nodes still it is mapping vehicles to those nodes how can I prevent it from mapping any vehicle to the node with 0 demand. kindly help me it will be of great help

skatsuta commented 4 years ago

Hi @Abdulla-mubharak, sorry for my late reply (you may already solve the question by yourself?). You may possibly misunderstand the meaning of "demand" (which means my naming scheme would be bad 😅). "Demand" is actually a "load" that consumes the capacity of a vehicle. For example, if a node has 2 demands, it consumes two units of a vehicle's loading capacity when the vehicle visits the node. "Zero demand" means "there is no load that would consume the capacity of a vehicle even if it visited the node". Therefore, setting 0 demand to a node does not mean a routing engine eliminates the node from a solution, rather it means a vehicle can visit the node with no additional capacity consumption.

The simple answer to your question is just eliminate nodes you want to prevent vehicles from visiting from a problem setting in the first place. Nodes that should not be visited should be removed from the problem itself (all of weight matrix, demands and time windows) at first.