demands integer only
Closed this issue · 4 comments
While testing the VPR with ~ 500 destinations with demands, some calculated tours are slightly over the given vehicle capacity. The given demands are floats with 2 decimals. Making the vehicle capacity and the demands integers (by multiply by 100), all the tour-demands are just below the vehicle capacity, which is correct.
https://github.com/mapbox/node-or-tools/blob/master/API.md#constructor-1 = Numbers. Floats are numbers, too.
Is this an error in documentation or a bug in the node-or-tools?
Yep you're right we're working with 32 integers internally:
https://github.com/mapbox/node-or-tools/blob/master/src/types.h#L23
Hm I would say this is an error in the documentation, even though technically you're right Javascript Numbers
are floating point types and we should not silently truncate.
Thanks, Daniel, for fast response. This seems to be the case also for durations and costs?
https://github.com/mapbox/node-or-tools/blob/master/src/types.h#L21
Yes internally we always use integral types and not floating point types.
We really should update the documentation - sorry you ran into this.
Don't worry - i'm glad you did the node-bindings.