You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried various things here now, but the resulting array does neither end nor start with "0", which is part of the point of the algorithm, isn't it? (it is suppsoed to return to the origin .. most of the time it just seems to pass by the origin)
e.g. test script
let salesman = require('salesman.js');
let a = [[0, 0], [20000, 200], [100, 0], [100, 100], [100, 0]];
let b = a.map(p => new salesman.Point(p[0], p[1]));
let sol = salesman.solve(b);
console.dir(sol);
I just made a change so that it always starts and ends with the first point you give.
The point of the algorithm is to find a loop with the shortest overall distance, so the starting point does not have much importance (you start at any point and just follow the path in the order given by the solution). [ 0,1,2,3], [1,2,3,0],[ 2,3,0,1], and [3,0,1,2] are all the same solution.
I've tried various things here now, but the resulting array does neither end nor start with "0", which is part of the point of the algorithm, isn't it? (it is suppsoed to return to the origin .. most of the time it just seems to pass by the origin)
e.g. test script
Ran multiple times:
I've tried closing the loop also (duplicating the first elem last) without any big amount of luck...
The text was updated successfully, but these errors were encountered: