NodeJS bindings for or-tools Travelling Salesman Problem (TSP) and Vehicle Routing Problem (VRP) solvers.
See API.md for documentation.
Solving TSP and VRP problems always starts out with having a m x m
cost matrix for all pairwise routes between all locations.
We recommend using the Mapbox Directions Matrix service when optimizing travel times.
npm install node_or_tools
var ortools = require('node_or_tools')
var VRP = new ortools.VRP(solverOpts);
VRP.Solve(searchOpts, function (err, solution) {
// ..
});
See API.md for interface documentation and the example for a small self-contained example.
We ship pre-built native binaries (for Node.js LTS 4 and 6 on Linux and macOS).
You will need a compatible C++ stdlib, see below if you encounter issues.
Building from source is supported via the --build-from-source
flag.
You're fine. The system's stdlib is recent enough.
apt install software-properties-common
add-apt-repository ppa:ubuntu-toolchain-r/test
apt update
apt install libstdc++-5-dev
npm test
If your C++ compiler and stdlib are quite recent they will default to a new ABI.
Mason packages are still built against an old ABI.
If you see undefined symbols
errors force the stdlib to use the old ABI by setting:
export CXXFLAGS="-D_GLIBCXX_USE_CXX11_ABI=0"
and re-build the project.
[publish binary]
on mastergit tag vx.y.z -a
on master, git push origin vx.y.z
npm login
, npm publish
to npmRouting Interfaces
More or-tools
Tests
Node bindings
Copyright © 2017 Mapbox
Distributed under the MIT License (MIT).