Class GRASPListManager<M extends Move<S,I>,S extends Solution<S,I>,I extends Instance>

java.lang.Object
es.urjc.etsii.grafo.create.grasp.GRASPListManager<M,S,I>
Direct Known Subclasses:
__RNAME__ListManager, GRASPListManager.NullGraspListManager, TSPListManager

public abstract class GRASPListManager<M extends Move<S,I>,S extends Solution<S,I>,I extends Instance> extends Object
Creates and updates the candidate list when a movement is performed
  • Constructor Details

    • GRASPListManager

      public GRASPListManager()
  • Method Details

    • beforeGRASP

      public void beforeGRASP(S solution)
      Initialize solution before GRASP algorithm is run F.e: In the case of clustering algorithms, usually each cluster needs to have at least one point, different solutions types may require different initialization
      Parameters:
      solution - Solution to initialize before running the GRASP constructive method
    • afterGRASP

      public void afterGRASP(S solution)
      Do any kind of post-processing after there are no more valid GRASP moves
      Parameters:
      solution - Solution to modify after the GRASP constructive method has finished
    • buildInitialCandidateList

      public abstract List<M> buildInitialCandidateList(S solution)
      Generate initial candidate list.
      Parameters:
      solution - Current solution
      Returns:
      an UNSORTED candidate list
    • updateCandidateList

      public abstract List<M> updateCandidateList(S solution, M move, List<M> candidateList, int index)
      Update candidate list after each movement. The list will be sorted by the constructor.
      Parameters:
      solution - Current solution, move has been already applied
      move - Chosen move
      candidateList - original candidate list
      index - index of the chosen move in the candidate list
      Returns:
      an UNSORTED candidate list, where the best candidate is on the first position and the worst in the last
    • toString

      public String toString()
      Return string representation of the current list manager. Defaults to "classname{}", override if custom parameters should appear in the string.
      Overrides:
      toString in class Object
    • nul

      public static <M extends Move<S, I>, S extends Solution<S, I>, I extends Instance> GRASPListManager<M,S,I> nul()
      Create a no operation GRASPListManager method Returns empty lists
      Type Parameters:
      M - Move class
      S - Solution class
      I - Instance class
      Returns:
      Null GRASPListManager method