optimization icon indicating copy to clipboard operation
optimization copied to clipboard

Directed TSP with invalid indices

Open bouldrini opened this issue 1 year ago • 0 comments

Hi,

I try using Itinero for solving a DTSP as shown below:

DirectedWeightMatrixAlgorithm directedWeightMatrixAlgorithm = new DirectedWeightMatrixAlgorithm(mRouter, Vehicle.Car.Fastest(), wgsCoordArray);

// wgsCoordArray has 15 elements in it

Itinero.Optimization.TSP.Directed.Solvers.HillClimbing3OptSolver directedhillClimbingSolver = new Itinero.Optimization.TSP.Directed.Solvers.HillClimbing3OptSolver();

directedTsprouter = new Itinero.Optimization.TSP.Directed.TSPRouter(directedWeightMatrixAlgorithm, 1.0f, 0, 15, directedhillClimbingSolver);

directedTsprouter.Run();
if (directedTsprouter.HasSucceeded)
    itineroTour = directedTsprouter.Tour; // {[0] -> 51 -> 11 -> 2 -> 39 -> 40 -> ... -> [12]}

Determination works fine but the result is unclear to me. directedTsprouter.Tour contains obscure indices that do not correspond to the wgsCoordArray in any way.

I cannot find any hint in the documentation how to map the given indices back to the given wgsCoordArray.

bouldrini avatar Feb 23 '24 18:02 bouldrini