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 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 a ExplicitAtspInstance record class.
      Parameters:
      name - the value for the name record component
      comment - the value for the comment record component
      edgeWeightType - the value for the edgeWeightType record component
      dimension - the value for the dimension record component
      nodeCoords - the value for the nodeCoords record component
      displayCoords - the value for the displayCoords record component
      fixedEdges - the value for the fixedEdges record component
      edgeWeights - the value for the edgeWeights record component
  • Method Details

    • from

      public static ExplicitAtspInstance from(TsplibFileData data)
    • getEdgeWeight

      public int getEdgeWeight(int i, int j)
      Description copied from interface: BaseInstance
      Returns the weight of the edge that joins node i and j.
      Specified by:
      getEdgeWeight in interface BaseInstance
      Parameters:
      i - 0-based index of one node of the edge
      j - 0-based index of the other node of the edge
      Returns:
      the weight of the edge
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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 with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface BaseInstance
      Returns:
      the value of the name record component
    • comment

      public String comment()
      Returns the value of the comment record component.
      Specified by:
      comment in interface BaseInstance
      Returns:
      the value of the comment record component
    • edgeWeightType

      public TsplibFileFormat.EdgeWeightType edgeWeightType()
      Returns the value of the edgeWeightType record component.
      Specified by:
      edgeWeightType in interface BaseInstance
      Returns:
      the value of the edgeWeightType record component
    • dimension

      public int dimension()
      Returns the value of the dimension record component.
      Specified by:
      dimension in interface BaseInstance
      Returns:
      the value of the dimension record component
    • nodeCoords

      public double[][] nodeCoords()
      Returns the value of the nodeCoords record component.
      Specified by:
      nodeCoords in interface BaseInstance
      Returns:
      the value of the nodeCoords record component
    • displayCoords

      public double[][] displayCoords()
      Returns the value of the displayCoords record component.
      Specified by:
      displayCoords in interface BaseInstance
      Returns:
      the value of the displayCoords record component
    • fixedEdges

      public int[][] fixedEdges()
      Returns the value of the fixedEdges record component.
      Specified by:
      fixedEdges in interface BaseInstance
      Returns:
      the value of the fixedEdges record component
    • edgeWeights

      public int[][] edgeWeights()
      Returns the value of the edgeWeights record component.
      Returns:
      the value of the edgeWeights record component