Package dynheurset

Class RunStat

java.lang.Object
dynheurset.RunStat

public class RunStat
extends java.lang.Object
RunStat calculates and stores all run statistics/variables information that can be used by dynamic set to update the active set.

The statistics/variables which are kept track of include:

  • The elapsed time
  • The percentage improvement (disimprovement) achieved (caused) by each heuristic
  • The frequency of improvement (disimprovement) achieved (caused) by each heuristic
  • The percentage improvement over the best/run-best solution achieved by each heuristic
  • The maximum number of iterations we waited so far before the best solution is updated
  • Field Summary

    Fields 
    Modifier and Type Field Description
    double[] bestImpr
    The percentage improvement of each heuristic over the best solution
    double bestValue
    The best solution value
    java.util.List<java.lang.Double> bestValuesTrace
    The fitness trace of the best solution
    double[] disimpr
    The percentage disimprovement of each heuristic
    java.util.List<double[]> disimprList
    The percentage disimprovement for each heuristic over several periods during the search.
    double[] durations
    The total cumulative execution time for each heuristic (utilization)
    double elpTime
    The elapsed time so far
    int[] heurList
    The universal set which contains the heuristic unique identifiers
    double[] impr
    The percentage improvement of each heuristic
    java.util.List<double[]> imprList
    The percentage improvement for each heuristic over several periods during the search.
    int iter
    The current iteration (starts from 1)
    double maxTime
    The time limit in millisecond
    int maxWait
    The maximum number of iterations we waited before the best solution is updated
    double[] numBestImpr
    The number of improvement of each heuristic over the best solution
    double[] numDisimpr
    The number of disimprovement of each heuristic (frequency of disimprovement)
    java.util.List<double[]> numDisimprList
    The number of disimprovement for each heuristic over several periods during the search.
    int numHeurs
    The total number of heuristics
    double[] numImpr
    The number of improvement of each heuristic (frequency of improvement)
    java.util.List<double[]> numImprList
    The number of improvement for each heuristic over several periods during the search.
    double[] numRunBestImpr
    The number of improvement of each heuristic over the run-best solution
    double[] numRunDisimpr
    The number of disimprovement of each heuristic in the current run
    double[] numRunImpr
    The number of improvement of each heuristic in the current run
    double[] runBestImpr
    The percentage improvement of each heuristic over the run-best solution
    double runBestValue
    The best solution value in the current run
    double[] runDisimpr
    The percentage disimprovement of each heuristic for the current run (when a restart strategy is invoked, a new run will be started)
    double[] runImpr
    The percentage improvement of each heuristic for the current run (after the last restart is invoked)
    int runMaxWait
    The maximum number of iterations we waited before the best solution is updated in the current run
    int runWaitRemove  
    int runWaitReset  
    int runWaitUpdate  
    java.util.List<java.lang.Double> uniqueValuesTrace
    The unique fitness trace which does not store duplicate solution values
    java.util.List<java.lang.Double> valuesTrace
    The fitness trace of the hyper-heuristic (the objective values of the current solution)
    int waitRemove  
    int waitReset  
    int waitUpdate  
  • Constructor Summary

    Constructors 
    Constructor Description
    RunStat()  
  • Method Summary

    Modifier and Type Method Description
    void init​(double initValue)
    Initializes the fields of this RunStat object.
    void restart​(double initValue)
    Indicates that a restart strategy is triggered in the hyper-heuristic.
    void setHeurList​(int[] heurList)
    Sets the universal set for this RunStat object.
    void setMaxTime​(long maxTime)
    Sets the maximum computational time for this dynamic heuristic 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

    • heurList

      public int[] heurList
      The universal set which contains the heuristic unique identifiers
    • impr

      public double[] impr
      The percentage improvement of each heuristic
    • runImpr

      public double[] runImpr
      The percentage improvement of each heuristic for the current run (after the last restart is invoked)
    • disimpr

      public double[] disimpr
      The percentage disimprovement of each heuristic
    • runDisimpr

      public double[] runDisimpr
      The percentage disimprovement of each heuristic for the current run (when a restart strategy is invoked, a new run will be started)
    • bestImpr

      public double[] bestImpr
      The percentage improvement of each heuristic over the best solution
    • runBestImpr

      public double[] runBestImpr
      The percentage improvement of each heuristic over the run-best solution
    • numImpr

      public double[] numImpr
      The number of improvement of each heuristic (frequency of improvement)
    • numRunImpr

      public double[] numRunImpr
      The number of improvement of each heuristic in the current run
    • numDisimpr

      public double[] numDisimpr
      The number of disimprovement of each heuristic (frequency of disimprovement)
    • numRunDisimpr

      public double[] numRunDisimpr
      The number of disimprovement of each heuristic in the current run
    • numBestImpr

      public double[] numBestImpr
      The number of improvement of each heuristic over the best solution
    • numRunBestImpr

      public double[] numRunBestImpr
      The number of improvement of each heuristic over the run-best solution
    • durations

      public double[] durations
      The total cumulative execution time for each heuristic (utilization)
    • numHeurs

      public int numHeurs
      The total number of heuristics
    • iter

      public int iter
      The current iteration (starts from 1)
    • maxTime

      public double maxTime
      The time limit in millisecond
    • elpTime

      public double elpTime
      The elapsed time so far
    • bestValue

      public double bestValue
      The best solution value
    • runBestValue

      public double runBestValue
      The best solution value in the current run
    • waitRemove

      public int waitRemove
    • runWaitRemove

      public int runWaitRemove
    • waitReset

      public int waitReset
    • runWaitReset

      public int runWaitReset
    • waitUpdate

      public int waitUpdate
    • runWaitUpdate

      public int runWaitUpdate
    • maxWait

      public int maxWait
      The maximum number of iterations we waited before the best solution is updated
    • runMaxWait

      public int runMaxWait
      The maximum number of iterations we waited before the best solution is updated in the current run
    • valuesTrace

      public java.util.List<java.lang.Double> valuesTrace
      The fitness trace of the hyper-heuristic (the objective values of the current solution)
    • uniqueValuesTrace

      public java.util.List<java.lang.Double> uniqueValuesTrace
      The unique fitness trace which does not store duplicate solution values
    • bestValuesTrace

      public java.util.List<java.lang.Double> bestValuesTrace
      The fitness trace of the best solution
    • imprList

      public java.util.List<double[]> imprList
      The percentage improvement for each heuristic over several periods during the search.

      The total computational time is divided into several periods of the same time (default is 10 periods). The improvement achieved by each heuristic in that period is recorded.

      The array at index idx is the percentage improvement for all heuristics at period idx starting counting from 0. To access the performance of the heuristic indexed by idx in the first period: imprList.get(0)[idx]. Note that idx is the index of the heuristic in the universal set.

    • disimprList

      public java.util.List<double[]> disimprList
      The percentage disimprovement for each heuristic over several periods during the search.

      The total computational time is divided into several periods of the same time (default is 10 periods). The disimprovement caused by each heuristic in that period is recorded.

      The array at index idx is the percentage disimprovement for all heuristics at period idx starting counting from 0. To access the performance of the heuristic indexed by idx in the first period: imprList.get(0)[idx]. Note that idx is the index of the heuristic in the universal set.

    • numImprList

      public java.util.List<double[]> numImprList
      The number of improvement for each heuristic over several periods during the search.

      The total computational time is divided into several periods of the same time (default is 10 periods) and the number of improvement achieved by each heuristic in that period is recorded.

      The array at index idx is the number of improvement for all heuristics at period idx starting counting from 0. To access the performance of the heuristic indexed by idx in the first period: imprList.get(0)[idx]. Note that idx is the index of the heuristic in the universal set.

    • numDisimprList

      public java.util.List<double[]> numDisimprList
      The number of disimprovement for each heuristic over several periods during the search.

      The total computational time is divided into several periods of the same time (default is 10 periods) and the number of disimprovement achieved by each heuristic in that period is recorded.

      The array at index idx is the number of disimprovement for all heuristics at period idx starting counting from 0. To access the performance of the heuristic indexed by idx in the first period: imprList.get(0)[idx]. Note that idx is the index of the heuristic in the universal set.

  • Constructor Details

  • Method Details

    • setHeurList

      public void setHeurList​(int[] heurList)
      Sets the universal set for this RunStat object.

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

      Parameters:
      heurList - an integer array where each integer uniquely identifies a heuristic
    • init

      public void init​(double initValue)
      Initializes the fields of this RunStat object.
      Parameters:
      initValue - the value of the initial solution from which the hyper-heuristic starts the search
    • 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
    • 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