Package dynheurset

Class DynHeurSet

java.lang.Object
dynheurset.DynHeurSet

public class DynHeurSet
extends java.lang.Object
DynHeurSet implements basic functionalities of dynamic sets.

Dynamic sets can be used within hyper-heuristics to manage the set of low-level heuristics available for the hyper-heuristic to select from. This set is called the active set which is typically a subset of the universal set that represents the set of all low-level heuristics in a problem domain.

A dynamic set changes during the search allowing different heuristics to enter and leave the active set at different phases during the search.

This dynamic set has a RunStat field to keep track of run-related statistics/variables such as the elapsed time, the best solution value, the improvement (deterioration) achieved (caused) by each heuristic and many more.

This dynamic set has a Update field which implements the update strategy that defines the update condition (when to update) and the update criterion (which heuristic to include in the active set).

  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected RunStat runStat
    The run statistics.
    protected Update update
    The update strategy used to decide when and how to update the active set.
  • Constructor Summary

    Constructors 
    Constructor Description
    DynHeurSet()  
  • Method Summary

    Modifier and Type Method Description
    java.util.List<java.lang.Integer> getActiveList()
    Returns the currently active set.
    int getNumberOfRemove()
    Returns the number of times a removal strategy is triggered.
    int getNumberOfResets()
    Returns the number of times the active set is reset to include all heuristics except for permanently removed heuristics.
    int getNumberOfUpdates()
    Returns the number of updates performed by this dynamic sets.
    RunStat getRunStatistics()
    Returns the runStat field of this dynamic set.
    void init​(double initValue)
    Initializes this dynamic heuristic set.
    void restart​(double initValue)
    Indicates that a restart strategy is triggered in the hyper-heuristic.
    void setHeurList​(int[] heurArray)
    Sets the universal set for this dynamic heuristic set.
    void setMaxTime​(long maxTime)
    Sets the maximum computational time for this dynamic heuristic set.
    void setRunStat​(RunStat runStat)
    Sets the runStat field of this dynamic set.
    void setUpdate​(Update update)
    Sets the update strategy for this dynamic set.
    java.util.List<java.lang.Integer> updateActiveList()
    Updates the active set from which the hyper-heuristic is allowed to choose if an update condition is satisfied and returns the currently active set.
    void updateHeurValue​(int idx, double currentValue, double newValue, long duration)
    Updates the performance-related information of the heuristic stored at index idx in the universal set of this dynamic set.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • runStat

      protected RunStat runStat
      The run statistics.
    • update

      protected Update update
      The update strategy used to decide when and how to update the active set.
  • Constructor Details

  • Method Details

    • setRunStat

      public void setRunStat​(RunStat runStat)
      Sets the runStat field of this dynamic set.
      Parameters:
      runStat - records run-related information
    • setUpdate

      public void setUpdate​(Update update)
      Sets the update strategy for this dynamic set.
      Parameters:
      update - the update strategy used by this dynamic set
    • setHeurList

      public void setHeurList​(int[] heurArray)
      Sets the universal set for this dynamic heuristic set.

      The universal set should contain all heuristics represented in an array of integers where each integer identifies a unique heuristic.

      Parameters:
      heurArray - an integer array where each integer uniquely identifies a heuristic
    • setMaxTime

      public void setMaxTime​(long maxTime)
      Sets the maximum computational time for this dynamic heuristic set.

      The maximum time should be the same as the maximum time for the hyper-heuristic using this dynamic heuristic set.

      Parameters:
      maxTime - the time limit in millisecond for the hyper-heuristic using this dynamic set
    • init

      public void init​(double initValue)
      Initializes this dynamic heuristic set.

      This method should be called immediately after the hyper-heuristic has created an initial solution and evaluates it.

      Parameters:
      initValue - the initial solution value
    • updateActiveList

      public java.util.List<java.lang.Integer> updateActiveList()
      Updates the active set from which the hyper-heuristic is allowed to choose if an update condition is satisfied and returns the currently active set.

      Note that the returned list contains the indexes of the heuristics in the universal set (not their unique identifiers). The universal set should be passed to this dynamic set using the method setHeurList.

      The update condition and the update criterion are implemented in the update field of this dynamic set. This method calls updateActiveList of the update field to update the active set. Therefore, your logic for updating the active set should go in updateActiveList of the Update class.

      Returns:
      a list containing the integer indexes of the heuristics in the currently active set
      See Also:
      Update.updateActiveList()
    • updateHeurValue

      public void updateHeurValue​(int idx, double currentValue, double newValue, long duration)
      Updates the performance-related information of the heuristic stored at index idx in the universal set of this dynamic set.

      Note that the universal set of this dynamic set is set using setHeurList. Therefore, heurList.get(idx) returns the heuristic unique identifier.

      The update includes the percentage and frequency of improvement (disimprovement) achieved (caused) by this heuristic, the total execution time used by this heuristic, the percentage and frequency of improvement over the best solution and the run-best solution, etc.

      Parameters:
      idx - the heuristic identifier
      currentValue - the solution value before applying the heuristic
      newValue - the solution value after applying the heuristic
      duration - the time (in millisecond) taken by the heuristic to execute the move
    • restart

      public void restart​(double initValue)
      Indicates that a restart strategy is triggered in the hyper-heuristic.

      This method is relevant to hyper-heuristics that implement a restart strategy. This method is used by this dynamic set to reset run-specific statistics such as the percentage improvement over the run-best solution.

      Parameters:
      initValue - the solution value of the solution from which the search is initialized
    • getActiveList

      public java.util.List<java.lang.Integer> getActiveList()
      Returns the currently active set.
      Returns:
      a list containing the integer identifiers of the currently active set
    • getRunStatistics

      public RunStat getRunStatistics()
      Returns the runStat field of this dynamic set.
      Returns:
      the observer that records the run statistics of heuristics
    • getNumberOfUpdates

      public int getNumberOfUpdates()
      Returns the number of updates performed by this dynamic sets.
      Returns:
      the number of updates performed by this dynamic sets
    • getNumberOfRemove

      public int getNumberOfRemove()
      Returns the number of times a removal strategy is triggered.

      The removal strategy implements the removal condition (when to remove some heuristic permanently) and the removal criterion (which heuristics to remove)

      Returns:
      the number of times a removal strategy is triggered.
      See Also:
      Remove
    • getNumberOfResets

      public int getNumberOfResets()
      Returns the number of times the active set is reset to include all heuristics except for permanently removed heuristics.

      The reset is performed by a reset strategy which decides when to trigger the reset.

      Returns:
      the number of times the active set is reset