mapbox / node-or-tools

Node.js bindings for or-tools vehicle routing problems
MIT License
146 stars 48 forks source link

how to declare demands ? #75

Open hamdi-islam opened 4 years ago

hamdi-islam commented 4 years ago

Hello, i'm really confused about how to declare demands, in the documentation it states that there is a from-to locations pair of values, and in this example i see 3 values inside a single array, i'm confused which one is which:

var vrpSolverOpts = { numNodes: 3, costs: [[0, 10, 10], [10, 0, 10], [10, 10, 0]], durations: [[0, 2, 2], [2, 0, 2], [2, 2, 0]], timeWindows: [[0, 9], [2, 3], [2, 3]], demands: [[0, 0, 0], [1, 1, 1], [1, 1, 1]] };

Let's say i have 3 vehicles with capacity of 15 each. All goods are loaded from the depot. and 5 locations to deliver to with the following demands : location A demands 5 location B demands 3 location C demands 2 location D demands 7 location E demands 10

How can I specify the demands in such case ? Thank you.

hamdi-islam commented 4 years ago

any help please ?