Class SimpleHeuristicFunction
java.lang.Object
com.aoindustries.aoserv.cluster.optimize.SimpleHeuristicFunction
- All Implemented Interfaces:
ResultHandler<Object>,HeuristicFunction
public class SimpleHeuristicFunction
extends Object
implements HeuristicFunction, ResultHandler<Object>
Simply counts the non-optimal nodes, adds
g to prefer shorter paths.
This is not thread safe.
- Author:
- AO Industries, Inc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetHeuristic(ClusterConfiguration clusterConfiguration, int g) Estimates the number of moves to an optimal state.booleanhandleResult(Result<?> result) Each result is provided as it is generated instead of building into lists.
-
Constructor Details
-
SimpleHeuristicFunction
public SimpleHeuristicFunction()
-
-
Method Details
-
getHeuristic
Description copied from interface:HeuristicFunctionEstimates the number of moves to an optimal state. If it uses the providedgg(n) it will result in Algorithm A. If it also always uses h(n) <= h*(n) it will result in Algorithm A*.- Specified by:
getHeuristicin interfaceHeuristicFunction- Parameters:
clusterConfiguration- TheClusterConfigurationrepresenting the current state.g- The number of moves already made.- Returns:
- The estimated number of moves to an optimal state
-
handleResult
Description copied from interface:ResultHandlerEach result is provided as it is generated instead of building into lists.- Specified by:
handleResultin interfaceResultHandler<Object>- Returns:
- true if more results are wanted, or false to receive no more results.
-
