Class Solution<SELF extends Solution<SELF,I>,I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.solution.Solution<SELF,I>
Direct Known Subclasses:
__RNAME__Solution, ACSolution, TestSolution, TSPSolution

public abstract class Solution<SELF extends Solution<SELF,I>,I extends Instance> extends Object

Abstract Solution class.

  • Field Details

  • Constructor Details

    • Solution

      protected Solution(I ins)
      Create a solution for a given instance
      Parameters:
      ins - Instance
    • Solution

      public Solution(Solution<SELF,I> s)

      Constructor for Solution.

      Parameters:
      s - a Solution object.
  • Method Details

    • notifyUpdate

      public void notifyUpdate()

      notifyUpdate.

    • notifyUpdate

      public void notifyUpdate(long when)

      notifyUpdate.

    • lastExecutesMoves

      public List<Move<? extends Solution<SELF,I>,I>> lastExecutesMoves()
      Returns ordered list of oldest to recent moves Note: If assertions are disabled, always returns an empty list
      Returns:
      ordered list of oldest to recent moves
    • lastExecutesMovesAsString

      public String lastExecutesMovesAsString()
      Generate a string representation of the chain of moves used to reach the current solution state.
      Returns:
      string representation, each move is separated by a new line
    • cloneSolution

      public abstract SELF cloneSolution()
      Clone the current solution. Deep clone mutable data or you will regret it.
      Returns:
      A deep clone of the current solution
    • toString

      public abstract String toString()
      Resume this solution Generate a toString method using your IDE
      Overrides:
      toString in class Object
      Returns:
      string representation of the current solution
    • getInstance

      public I getInstance()

      getInstance.

      Returns:
      a I object.
    • getLastModifiedTime

      public long getLastModifiedTime()
      When was the last time the current solution was modified. Has no meaning when used independently, must be used along a reference time (for example, to calculate the TTB, substracting the time at which the current solution was built)
      Returns:
      reference time, in nano seconds.
    • getVersion

      public long getVersion()
      Get current solution version. This is an internal ID kept by the framework, which tracks how many times the current solution has been modified. While it currently equals the number of moves that has been applied to the current solution, such behaviour can change in future framework versions and should not be relied on.
      Returns:
      current solution version.
    • customProperties

      public Map<String,Function<SELF,Object>> customProperties()
      Define custom properties for the solution
      Returns:
      Map of properties, where the key is the property name and the value is how to calculate the property value