1.0.2 • Published 5 years ago

node-tspsolver v1.0.2

Weekly downloads
87
License
MIT
Repository
github
Last release
5 years ago

Build Status

node-tspsolver

Travelling salesman solver for nodejs

This solver uses Simulated Annealing with optional periodic reheating.

Initial solution is constructed using Nearest Neighbour heuristic.

Tour transformations used in the local search step: Stochastic 2-opt, translation and swapping.

The solver is implemented in C++ and doesn't use the nodejs main event loop for running, hence non-blocking.

Signature:

function solveTsp(costMatrix, roundtrip, options) returns a promise

Arguments:

costMatrix - 2d array of costs .. costMatrixi gives cost between ith and jth points

roundtrip - whether salesman needs to get back to starting point, ie point at index 0. If false, point at n - 1 is treated as the end point

options - {     N - 'number of iterations' default: 1000000,     T - 'Initial temperature' default: 100,     lambda - 'Annealing parameter' default: 0.985,     reheatInterval - 100000, }

Install:

npm install node-tspsolver

NOTE:

Since this is a C++ addon, it requires node-gyp to be properly configured in your machine. Please go through the instructions provided in https://github.com/nodejs/node-gyp to properly set it up for your platform.

Examples:

1.0.2

5 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago