Class TravellingSalesmanSolver
- java.lang.Object
-
- org.apache.commons.math4.examples.sofm.tsp.TravellingSalesmanSolver
-
public final class TravellingSalesmanSolver extends Object
Handles the "Travelling Salesman's Problem" (i.e. trying to find the sequence of cities that minimizes the travel distance) using a 1D SOFM.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<double[]>
getCoordinatesList()
static City[]
solve(City[] cities, double neuronsPerCity, long numUpdates, int numTasks, org.apache.commons.rng.UniformRandomProvider random)
-
-
-
Method Detail
-
solve
public static City[] solve(City[] cities, double neuronsPerCity, long numUpdates, int numTasks, org.apache.commons.rng.UniformRandomProvider random)
- Parameters:
cities
- List of cities to be visited.neuronsPerCity
- Average number of neurons per city.numUpdates
- Number of updates for training the network.numTasks
- Number of concurrent tasks.random
- RNG for presenting samples to the trainer.- Returns:
- the solution (list of cities in travel order).
-
getCoordinatesList
public List<double[]> getCoordinatesList()
- Returns:
- the list of features (coordinates) of linked neurons.
-
-