Interface StrategyFunction
- All Known Subinterfaces:
StrategyFunction.Deterministic,StrategyFunction.NonDeterministic
public interface StrategyFunction
The heuristic function for determining the strategy at the root of any B* search.
This class contains several defaults for strategy functions, but you can also construct
your own using this interface and several methods for constructing new strategy functions.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfacestatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StrategyFunction.DeterministicBerliner's depth-based D-criterium, considering 1 alternativestatic final StrategyFunction.DeterministicBerliner's depth- and range-based R-criterium, considering 1 alternativestatic final StrategyFunction.DeterministicBerliner's depth-based D-criterium, considering 2 alternativesstatic final StrategyFunction.DeterministicBerliner's depth- and range-based R-criterium, considering 2 alternativesstatic final StrategyFunction.DeterministicBerliner's depth-based D-criterium, considering all alternativesstatic final StrategyFunction.DeterministicBerliner's depth- and range-based R-criterium, considering all alternativesstatic final StrategyFunction.Deterministicwill use DISPROVEREST where possiblestatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicstatic final StrategyFunction.Deterministicwill ALWAYS use PROVEBEST -
Method Summary
Modifier and TypeMethodDescriptionwill alternate between PROVEBEST and DISPROVEREST, starting at PROVEBEST; unless DISPROVEREST is impossible, which will suspend the alternation countBY_SUBTREE_EXPANSIONS(int num_alternatives, boolean by_optimistic, double best_node_weight) BY_SUBTREE_MAXSIZE(int num_alternatives, boolean by_optimistic, double best_node_weight) BY_SUBTREE_PARAMS(int num_alternatives, boolean by_optimistic, ToDoubleFunction<MetricKeeper> bestNodeEvaluator, ToDoubleFunction<MetricKeeper> restNodesEvaluator) BY_SUBTREE_SIZE(int num_alternatives, boolean by_optimistic, double best_node_weight) CRITERIUM_D_or_R(int num_alternatives, boolean divide_by_range) If the sum of the squares of the depths from which the optimistic bounds of the alternatives has been backed up is less than the square of the depth from which the value of the best arc has been backed up, then use DISPROVEREST; otherwise use PROVEBEST.getHeuristicStrategyFunction(int num_alternatives, boolean by_optimistic, StrategyFunction.HeuristicFunction bestNodeFunction, StrategyFunction.HeuristicFunction restNodesFunction) If the sum of therestNodesFunctionvalues for the alternatives is less than thebestNodeFunctionvalue for the best node, then use DISPROVEREST; otherwise use PROVEBEST.booleanRANDOM()will select randomly between PROVEBEST and DISPROVEREST when both are applicableRANDOM(long seed) will select randomly between PROVEBEST and DISPROVEREST when both are applicablebooleanuseProveBest(GameTreeNode<?, ?> root, MetricKeeper... metrics)
-
Field Details
-
PROVEBEST
will ALWAYS use PROVEBEST -
DISPROVEREST
will use DISPROVEREST where possible -
B_2D
Berliner's depth-based D-criterium, considering 1 alternative -
B_3D
Berliner's depth-based D-criterium, considering 2 alternatives -
B_AD
Berliner's depth-based D-criterium, considering all alternatives -
B_2R
Berliner's depth- and range-based R-criterium, considering 1 alternative -
B_3R
Berliner's depth- and range-based R-criterium, considering 2 alternatives -
B_AR
Berliner's depth- and range-based R-criterium, considering all alternatives -
P_2M1
-
P_2S1
-
P_2X1
-
P_2M2
-
P_2S2
-
P_2X2
-
P_3M1
-
P_3S1
-
P_3X1
-
P_3M2
-
P_3S2
-
P_3X2
-
P_AM1
-
P_AS1
-
P_AX1
-
P_AM2
-
P_AS2
-
P_AX2
-
-
Method Details
-
useProveBest
-
isDeterministic
boolean isDeterministic() -
ALTERNATE
will alternate between PROVEBEST and DISPROVEREST, starting at PROVEBEST; unless DISPROVEREST is impossible, which will suspend the alternation count -
RANDOM
will select randomly between PROVEBEST and DISPROVEREST when both are applicable -
RANDOM
will select randomly between PROVEBEST and DISPROVEREST when both are applicable -
CRITERIUM_D_or_R
static StrategyFunction.Deterministic CRITERIUM_D_or_R(int num_alternatives, boolean divide_by_range) If the sum of the squares of the depths from which the optimistic bounds of the alternatives has been backed up is less than the square of the depth from which the value of the best arc has been backed up, then use DISPROVEREST; otherwise use PROVEBEST.- Parameters:
num_alternatives- number of alternatives (including best arc) to consider. Or any value<1to consider ALL.divide_by_range- toggle the use of the "R" criterium, where the square of the depth value is divided by the node's range before summing and comparing them.- Returns:
- a function which follows the described behavior for the
selected number of alternatives considered to determine the strategy.
This function will return
truewhen PROVEBEST should be used, andfalseotherwise.
-
BY_SUBTREE_MAXSIZE
static StrategyFunction.Deterministic BY_SUBTREE_MAXSIZE(int num_alternatives, boolean by_optimistic, double best_node_weight) -
BY_SUBTREE_SIZE
static StrategyFunction.Deterministic BY_SUBTREE_SIZE(int num_alternatives, boolean by_optimistic, double best_node_weight) -
BY_SUBTREE_EXPANSIONS
static StrategyFunction.Deterministic BY_SUBTREE_EXPANSIONS(int num_alternatives, boolean by_optimistic, double best_node_weight) -
BY_SUBTREE_PARAMS
static StrategyFunction.Deterministic BY_SUBTREE_PARAMS(int num_alternatives, boolean by_optimistic, ToDoubleFunction<MetricKeeper> bestNodeEvaluator, ToDoubleFunction<MetricKeeper> restNodesEvaluator) -
getHeuristicStrategyFunction
static StrategyFunction.Deterministic getHeuristicStrategyFunction(int num_alternatives, boolean by_optimistic, StrategyFunction.HeuristicFunction bestNodeFunction, StrategyFunction.HeuristicFunction restNodesFunction) If the sum of therestNodesFunctionvalues for the alternatives is less than thebestNodeFunctionvalue for the best node, then use DISPROVEREST; otherwise use PROVEBEST.- Parameters:
num_alternatives- number of alternatives (including best node) to consider. Or any value<1to consider ALL.by_optimistic- iftrue, consider the nodes with better optimistic values to be 'better'. Iffalse, instead consider the nodes with better pessimistic values to be 'better'. This ordering of nodes affects which node is selected as 'best' node and which nodes are selected as alternative nodes ifnum_alternativesis not considering ALL alternative nodes.bestNodeFunction- function to apply to the best noderestNodesFunction- function to apply to the alternative nodes- Returns:
- a function which follows the described behavior for the
selected number of alternatives considered to determine the strategy.
This function will return
truewhen PROVEBEST should be used, andfalseotherwise.
-