Class TSPTWBaseMove

java.lang.Object
es.urjc.etsii.grafo.solution.Move<TSPTWSolution, TSPTWInstance>
es.urjc.etsii.grafo.tsptw.model.TSPTWBaseMove
Direct Known Subclasses:
TSPTWListManager.TSPTWGRASPMove

public abstract class TSPTWBaseMove extends Move<TSPTWSolution, TSPTWInstance>
Example movement class. Can be an insert, a swap, anything that modifies the solution state
  • Constructor Details

    • TSPTWBaseMove

      public TSPTWBaseMove(TSPTWSolution solution)
      Move constructor
      Parameters:
      solution - solution
  • Method Details

    • _execute

      protected abstract TSPTWSolution _execute(TSPTWSolution solution)
      Executes the proposed move, to be implemented by each move type. It is up to the implementation to decide if the original solution is modified in place or a new one is created by cloning the original solution and then applying the changes.

      This method should be idempotent, i.e. calling it multiple times with the same solution should return the same result
      Specified by:
      _execute in class Move<TSPTWSolution, TSPTWInstance>
      Parameters:
      solution - Solution where this move will be applied to.
      Returns:
      modified solution
    • getScoreChange

      public abstract double getScoreChange()
      Get the movement value, represents how much does the move changes the f.o of a solution if executed
      Returns:
      f.o change
    • toString

      public abstract String toString()
      Returns a String representation of the current movement. Only use relevant fields. Tip: Default IntelliJ implementation is fine
      Specified by:
      toString in class Move<TSPTWSolution, TSPTWInstance>
      Returns:
      human readable string
    • equals

      public abstract boolean equals(Object o)
      Specified by:
      equals in class Move<TSPTWSolution, TSPTWInstance>
    • hashCode

      public abstract int hashCode()
      Specified by:
      hashCode in class Move<TSPTWSolution, TSPTWInstance>