Class TSPInstanceImporter

java.lang.Object
es.urjc.etsii.grafo.io.InstanceImporter<TSPInstance>
es.urjc.etsii.grafo.TSP.model.TSPInstanceImporter

public class TSPInstanceImporter extends InstanceImporter<TSPInstance>
  • Constructor Details

    • TSPInstanceImporter

      public TSPInstanceImporter()
  • Method Details

    • importInstance

      public TSPInstance importInstance(BufferedReader reader, String filename) throws IOException
      Description copied from class: InstanceImporter
      Create an instance from the format used by the problem. After this method finishes executing, the Instance object MUST BE IMMUTABLE.
      Specified by:
      importInstance in class InstanceImporter<TSPInstance>
      Parameters:
      reader - Input buffer, managed by the framework
      filename - Filename on disk
      Returns:
      The instance object that represents this object
      Throws:
      IOException - If an error is encountered while the instance is being parsed
    • calculateEuclideanDistance

      public double calculateEuclideanDistance(TSPInstance.Coordinate i, TSPInstance.Coordinate j)
      Calculate the Euclidian distance of two given coordinates
      Parameters:
      i - first coordinate
      j - second coordinate
      Returns:
      the euclidean distance between two coordiantes