mapbox/node-or-tools

What is depotIndex?

hopewise opened this issue · 3 comments

As I am reviewing the source code of node example, I did not understand the depotIndex, can you please explain it?

Also, how to define origin point? considering locations are all destinations?

Last question please, in the example, there is:

  // 9am -- 5pm
  var dayStarts = 0;
  var dayEnds = 8 * 60 * 60;

how did you figure out the 9am ? as dayStarts equals to zero?

Thank you!

depotIndex in the example is the index for the depot into the list of locations. Say you have n locations and you want the the first location to be your depot, then set depotIndex to 0.

The solver's world always starts at time point 0 and ends at time point timeHorizon. You need to shift your real day start and then calculate time differences.

More here: https://github.com/mapbox/node-or-tools/blob/master/API.md

Happy routing! 🎉 🚗

Thanks for quick response! so, what if we have multiple origins?

You need to re-model your problem e.g. by adding an artificial dummy depot. See #9.