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
-
Method Summary
Modifier and TypeMethodDescriptiondouble
distance
(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, wait
Methods 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:TSPEdgeDistance
Computes the distance between two cities in the TSP.- Specified by:
distance
in 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.
-