lovasoa / salesman.js

Solves the traveling salesman problem using simulated annealing.

Home Page:https://lovasoa.github.io/salesman.js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Starting point is always the first point in the path

EliteMasterEric opened this issue · comments

commented

return 1 + Math.floor(Math.random() * (this.points.length - 1));

Currently the first point in the path is never moved. This should be configurable.

I am not sure I understand the goal here. We are working on a closed path, so there is no "first point". By convention, the code works with an array that starts with the first point in the input points array. But since the path is closed, the resulting path can be executed from any point without changing the total length.

commented

Aaah, I see.

I guess this inquiry only makes sense in the context of an open path (which is the use case I came to this repository for).

After more research, this may be out of the scope of a Salesman library as it falls under the concept of a 'Hamiltonian' path.