Module org.cicirello.chips_n_salsa
Class EuclideanDistance
java.lang.Object
org.cicirello.search.problems.tsp.EuclideanDistance
- All Implemented Interfaces:
TSPEdgeDistance
A Euclidean distance function for use with
TSP instances.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledistance(double x1, double y1, double x2, double y2) Computes the distance between two cities in the TSP.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.cicirello.search.problems.tsp.TSPEdgeDistance
distanceAsInt
-
Constructor Details
-
EuclideanDistance
public EuclideanDistance()
-
-
Method Details
-
distance
public double distance(double x1, double y1, double x2, double y2) Description copied from interface:TSPEdgeDistanceComputes the distance between two cities in the TSP.- Specified by:
distancein interfaceTSPEdgeDistance- 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.
-