Class EuclideanDistance

java.lang.Object
org.cicirello.search.problems.tsp.EuclideanDistance
All Implemented Interfaces:
TSPEdgeDistance

public final class EuclideanDistance extends Object implements TSPEdgeDistance
A Euclidean distance function for use with TSP instances.
  • Constructor Details

    • EuclideanDistance

      public EuclideanDistance()
  • Method Details

    • distance

      public double distance(double x1, double y1, double x2, double y2)
      Description copied from interface: TSPEdgeDistance
      Computes the distance between two cities in the TSP.
      Specified by:
      distance in interface TSPEdgeDistance
      Parameters:
      x1 - The x coordinate of the first city.
      y1 - The y coordinate of the first city.
      x2 - The x coordinate of the second city.
      y2 - The y coordinate of the second city.
      Returns:
      The distance between the two cities.