Class MSTSolution


public class MSTSolution extends Solution<MSTSolution,MSTInstance>
  • Constructor Details

    • MSTSolution

      public MSTSolution(MSTInstance instance)
      Initialize solution from instance
      Parameters:
      instance -
    • MSTSolution

      public MSTSolution(MSTSolution solution)
      Clone constructor
      Parameters:
      solution - Solution to clone
  • Method Details

    • cloneSolution

      public MSTSolution cloneSolution()
      Description copied from class: Solution
      Clone the current solution. Deep clone mutable data or you will regret it.
      Specified by:
      cloneSolution in class Solution<MSTSolution,MSTInstance>
      Returns:
      A deep clone of the current solution
    • getScore

      public double getScore()
      Get the current solution score. The difference between this method and recalculateScore is that this result can be a property of the solution, or cached, it does not have to be calculated each time this method is called
      Returns:
      current solution score as double
    • getEdges

      public List<Edge> getEdges()
    • setEdges

      public void setEdges(List<Edge> mstEdges)
      Set the edges of the MST solution
      Parameters:
      mstEdges - List of edges that form the MST
    • toString

      public String toString()
      Generate a string representation of this solution. Used when printing progress to console, show as minimal info as possible
      Specified by:
      toString in class Solution<MSTSolution,MSTInstance>
      Returns:
      Small string representing the current solution (Example: id + score)