Class ExponentialHeuristicFunction

java.lang.Object
com.aoindustries.aoserv.cluster.optimize.ExponentialHeuristicFunction
All Implemented Interfaces:
ResultHandler<Object>, HeuristicFunction

public class ExponentialHeuristicFunction extends Object implements HeuristicFunction, ResultHandler<Object>
Adds up all the non-optimal states of the analyzed cluster giving more weight to higher level problems. Adds in g to prefer shorter paths.

This is not thread safe.

The values are:

 NONE = 0
 LOW = 4
 MEDIUM = 8
 HIGH = 16
 CRITICAL = 1024
 
Author:
AO Industries, Inc.
  • Constructor Details

    • ExponentialHeuristicFunction

      public ExponentialHeuristicFunction()
  • Method Details

    • getHeuristic

      public double getHeuristic(ClusterConfiguration clusterConfiguration, int g)
      Description copied from interface: HeuristicFunction
      Estimates the number of moves to an optimal state. If it uses the provided g g(n) it will result in Algorithm A. If it also always uses h(n) <= h*(n) it will result in Algorithm A*.
      Specified by:
      getHeuristic in interface HeuristicFunction
      Parameters:
      clusterConfiguration - The ClusterConfiguration representing the current state.
      g - The number of moves already made.
      Returns:
      The estimated number of moves to an optimal state
    • handleResult

      public boolean handleResult(Result<?> result)
      Description copied from interface: ResultHandler
      Each result is provided as it is generated instead of building into lists.
      Specified by:
      handleResult in interface ResultHandler<Object>
      Returns:
      true if more results are wanted, or false to receive no more results.