Class TSPInstance

java.lang.Object
es.urjc.etsii.grafo.io.Instance
es.urjc.etsii.grafo.TSP.model.TSPInstance
All Implemented Interfaces:
Comparable<Instance>

public class TSPInstance extends Instance
  • Constructor Details

    • TSPInstance

      protected TSPInstance(String name, TSPInstance.Coordinate[] locations, double[][] distances)
      Constructor
      Parameters:
      name - name of the instance
      locations - list of coordiantes
  • Method Details

    • getLocations

      public TSPInstance.Coordinate[] getLocations()
      Get the list of locations
      Returns:
      list of locations
    • numberOfLocations

      public int numberOfLocations()
      Get the number of locations of the instance
      Returns:
      number of locations
    • getCoordinate

      public TSPInstance.Coordinate getCoordinate(int id)
      Get coordinate of a specific location (that represents a city, place, facility...)
      Parameters:
      id - of the location
      Returns:
      the location coordinate
    • getDistance

      public double getDistance(int i, int j)
      Return the euclidean distance between two locations i and j.
      Parameters:
      i - first location
      j - second location
      Returns:
      the euclidean distance