KohonenTrainingTask implements Runnable { public void run() { while (featuresIterator.hasNext()) { updateAction.update(net, featuresIterator.next()); } } KohonenTrainingTask(Network net,
                               Iterator<double[]> featuresIterator,
                               KohonenUpdateAction updateAction); void run();  }
@Test public void testTravellerSalesmanSquareTourSequentialSolver() { final City[] squareOfCities = new City[] { new City("o0", 0, 0), new City("o1", 1, 0), new City("o2", 2, 0), new City("o3", 3, 0), new City("o4", 3, 1), new City("o5", 3, 2), new City("o6", 3, 3), new City("o7", 2, 3), new City("o8", 1, 3), new City("o9", 0, 3), new City("i3", 1, 2), new City("i2", 2, 2), new City("i1", 2, 1), new City("i0", 1, 1), }; final long seed = 1245632379L; final TravellingSalesmanSolver solver = new TravellingSalesmanSolver(squareOfCities, 2, seed); solver.createSequentialTask(15000).run(); final City[] result = solver.getCityList(); Assert.assertEquals(squareOfCities.length, uniqueCities(result).size()); final double ratio = computeTravelDistance(squareOfCities) / computeTravelDistance(result); Assert.assertEquals(1, ratio, 1e-1); }