A UGen that solves the traveling salesman problem (TSP) using the Lin-Kernighan heuristic.
For each input value of size
, a corresponding initial tour and edge weight sequence are
read, the tour is optimized and output along with the tour's cost.
Currently, we output two channels:
- 0 -
tour
- the optimized tour - 1 -
cost
- the cost of the optimized tour, i.e. the sum of its edge weights
- Value Params
- init
the initial tour, for example linear or randomized. Should consist of
size
zero-based vertex indices- mode
currently unused and should remain at the default value of zero.
- size
for each complete graph, the number of vertices.
- timeOut
currently unused and should remain at the default value of zero.
- weights
the symmetric edge weights, a sequence of length
size * (size - 1) / 2
, sorted as vertex connections (0,1), (0,2), (0,3), ... (0,size-1), (1,2), (1,3), ... (1,size-1), etc., until (size-2,size-1).
- Companion
- object