/// <summary> /// Calculates a solution to the ATSP. /// </summary> /// <param name="weights">The weights between all the customers.</param> /// <param name="locations">The locations of all customers.</param> /// <param name="is_round">Make the route return to the start-point or not.</param> /// <returns></returns> public IRoute CalculateTSP(double[][] weights, GeoCoordinate[] locations, bool is_round) { // create solver. ISolver solver = null; if (locations.Length < 6) { // creates a bute force solver. solver = new OsmSharp.Math.TSP.BruteForce.BruteForceSolver(); } else { // creates a solver for the larger problems. solver = this.DoCreateSolver(locations.Length); } solver.IntermidiateResult += new SolverDelegates.IntermidiateDelegate(solver_IntermidiateResult); // calculate the TSP. return(solver.Solve(this.GenerateProblem(weights, null, null, is_round))); }
/// <summary> /// Calculates a solution to the ATSP. /// </summary> /// <param name="weights">The weights between all the customers.</param> /// <param name="locations">The locations of all customers.</param> /// <param name="is_round">Make the route return to the start-point or not.</param> /// <returns></returns> public IRoute CalculateTSP(double[][] weights, GeoCoordinate[] locations, bool is_round) { // create solver. ISolver solver = null; if (locations.Length < 6) { // creates a bute force solver. solver = new OsmSharp.Math.TSP.BruteForce.BruteForceSolver(); } else { // creates a solver for the larger problems. solver = this.DoCreateSolver(locations.Length); } solver.IntermidiateResult += new SolverDelegates.IntermidiateDelegate(solver_IntermidiateResult); // calculate the TSP. return solver.Solve(this.GenerateProblem(weights, null, null, is_round)); }