Package org.encog.examples.nonlinear.tsp

Examples of org.encog.examples.nonlinear.tsp.City


    cities = new City[CITIES];
    for (int i = 0; i < cities.length; i++) {
      int xPos = (int) (Math.random() * MAP_SIZE);
      int yPos = (int) (Math.random() * MAP_SIZE);

      cities[i] = new City(xPos, yPos);
    }
  }
View Full Code Here


    cities = new City[CITIES];
    for (int i = 0; i < cities.length; i++) {
      int xPos = (int) (Math.random() * MAP_SIZE);
      int yPos = (int) (Math.random() * MAP_SIZE);

      cities[i] = new City(xPos, yPos);
    }
  }
View Full Code Here

    double result = 0.0;
   
    int[] path = (int[])genome.getOrganism();
   
    for (int i = 0; i < cities.length - 1; i++) {
      City city1 = cities[path[i]];
      City city2 = cities[path[i+1]];
     
      final double dist = city1.proximity(city2);
      result += dist;
    }
   
View Full Code Here

TOP

Related Classes of org.encog.examples.nonlinear.tsp.City

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.