Record Class ExplicitAtspInstance
java.lang.Object
java.lang.Record
io.github.lmores.tsplib.atsp.ExplicitAtspInstance
- All Implemented Interfaces:
AtspInstance
,BaseInstance
public record ExplicitAtspInstance(String name, String comment, TsplibFileFormat.EdgeWeightType edgeWeightType, int dimension, double[][] nodeCoords, double[][] displayCoords, int[][] fixedEdges, int[][] edgeWeights)
extends Record
implements AtspInstance
ATSP instance with edge weights explicitly defined.
- Since:
- 0.0.1
- Author:
- Lorenzo Moreschini
-
Constructor Summary
ConstructorsConstructorDescriptionExplicitAtspInstance
(String name, String comment, TsplibFileFormat.EdgeWeightType edgeWeightType, int dimension, double[][] nodeCoords, double[][] displayCoords, int[][] fixedEdges, int[][] edgeWeights) Creates an instance of aExplicitAtspInstance
record class. -
Method Summary
Modifier and TypeMethodDescriptioncomment()
Returns the value of thecomment
record component.int
Returns the value of thedimension
record component.double[][]
Returns the value of thedisplayCoords
record component.int[][]
Returns the value of theedgeWeights
record component.Returns the value of theedgeWeightType
record component.final boolean
Indicates whether some other object is "equal to" this one.int[][]
Returns the value of thefixedEdges
record component.static ExplicitAtspInstance
from
(TsplibFileData data) int
getEdgeWeight
(int i, int j) Returns the weight of the edge that joins nodei
andj
.final int
hashCode()
Returns a hash code value for this object.name()
Returns the value of thename
record component.double[][]
Returns the value of thenodeCoords
record component.final String
toString()
Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.github.lmores.tsplib.atsp.AtspInstance
hasEdge
Methods inherited from interface io.github.lmores.tsplib.BaseInstance
computeTourValue, materializeEdgeWeightsMatrix
-
Constructor Details
-
ExplicitAtspInstance
public ExplicitAtspInstance(String name, String comment, TsplibFileFormat.EdgeWeightType edgeWeightType, int dimension, double[][] nodeCoords, double[][] displayCoords, int[][] fixedEdges, int[][] edgeWeights) Creates an instance of aExplicitAtspInstance
record class.- Parameters:
name
- the value for thename
record componentcomment
- the value for thecomment
record componentedgeWeightType
- the value for theedgeWeightType
record componentdimension
- the value for thedimension
record componentnodeCoords
- the value for thenodeCoords
record componentdisplayCoords
- the value for thedisplayCoords
record componentfixedEdges
- the value for thefixedEdges
record componentedgeWeights
- the value for theedgeWeights
record component
-
-
Method Details
-
from
-
getEdgeWeight
public int getEdgeWeight(int i, int j) Description copied from interface:BaseInstance
Returns the weight of the edge that joins nodei
andj
.- Specified by:
getEdgeWeight
in interfaceBaseInstance
- Parameters:
i
- 0-based index of one node of the edgej
- 0-based index of the other node of the edge- Returns:
- the weight of the edge
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with thecompare
method from their corresponding wrapper classes. -
name
Returns the value of thename
record component.- Specified by:
name
in interfaceBaseInstance
- Returns:
- the value of the
name
record component
-
comment
Returns the value of thecomment
record component.- Specified by:
comment
in interfaceBaseInstance
- Returns:
- the value of the
comment
record component
-
edgeWeightType
Returns the value of theedgeWeightType
record component.- Specified by:
edgeWeightType
in interfaceBaseInstance
- Returns:
- the value of the
edgeWeightType
record component
-
dimension
public int dimension()Returns the value of thedimension
record component.- Specified by:
dimension
in interfaceBaseInstance
- Returns:
- the value of the
dimension
record component
-
nodeCoords
public double[][] nodeCoords()Returns the value of thenodeCoords
record component.- Specified by:
nodeCoords
in interfaceBaseInstance
- Returns:
- the value of the
nodeCoords
record component
-
displayCoords
public double[][] displayCoords()Returns the value of thedisplayCoords
record component.- Specified by:
displayCoords
in interfaceBaseInstance
- Returns:
- the value of the
displayCoords
record component
-
fixedEdges
public int[][] fixedEdges()Returns the value of thefixedEdges
record component.- Specified by:
fixedEdges
in interfaceBaseInstance
- Returns:
- the value of the
fixedEdges
record component
-
edgeWeights
public int[][] edgeWeights()Returns the value of theedgeWeights
record component.- Returns:
- the value of the
edgeWeights
record component
-