Package es.urjc.etsii.grafo.tsp.model
Class TSPInstance
java.lang.Object
es.urjc.etsii.grafo.io.Instance
es.urjc.etsii.grafo.tsp.model.TSPInstance
- All Implemented Interfaces:
Comparable<Instance>
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class es.urjc.etsii.grafo.io.Instance
LOAD_TIME_NANOS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedTSPInstance(String name, TSPInstance.Coordinate[] locations, double[][] distances) Constructor -
Method Summary
Modifier and TypeMethodDescriptiongetCoordinate(int id) Get coordinate of a specific location (that represents a city, place, facility...)doublegetDistance(int i, int j) Return the euclidean distance between two locations i and j.Get the list of locationsintGet the number of locations of the instanceMethods inherited from class es.urjc.etsii.grafo.io.Instance
compareTo, customProperties, equals, getId, getPath, getProperty, getPropertyOrDefault, getUniquePropertiesKeys, hashCode, resetProperties, setPath, setProperty, toString
-
Constructor Details
-
TSPInstance
Constructor- Parameters:
name- name of the instancelocations- list of coordiantes
-
-
Method Details
-
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
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 locationj- second location- Returns:
- the euclidean distance
-