knockabout.search
Class ConfigurableHeuristic
java.lang.Object
knockabout.search.ConfigurableHeuristic
- All Implemented Interfaces:
- Heuristic
- public class ConfigurableHeuristic
- extends java.lang.Object
- implements Heuristic
A weighted linear function-based heuristic
Constructor Summary |
ConfigurableHeuristic()
Create a new instance and precompute the normalization factor |
Method Summary |
float |
computeHeuristic(GameState gameState)
Give the estimated utility according to the formula:
a_VD * (sumBlack - sumYellow) + a_D8 * (numberOfBlackD8 - numberOfYellowD8) + a_D6 * (numberOfBlackD6 - numberOfYellowD6) + a_D4 * (numberOfBlackD4 - numberOfYellowD4)) / normalizationFactor
It will do the opposite (sumYellow-sumBlack) if gamestate's max color is yellow |
float |
getA_D4()
|
float |
getA_D6()
|
float |
getA_D8()
|
float |
getA_VD()
|
float |
getNormalizationFactor()
|
void |
setA_D4(float f)
|
void |
setA_D6(float f)
|
void |
setA_D8(float f)
|
void |
setA_VD(float f)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConfigurableHeuristic
public ConfigurableHeuristic()
- Create a new instance and precompute the normalization factor
computeHeuristic
public float computeHeuristic(GameState gameState)
- Give the estimated utility according to the formula:
a_VD * (sumBlack - sumYellow) + a_D8 * (numberOfBlackD8 - numberOfYellowD8) + a_D6 * (numberOfBlackD6 - numberOfYellowD6) + a_D4 * (numberOfBlackD4 - numberOfYellowD4)) / normalizationFactor
It will do the opposite (sumYellow-sumBlack) if gamestate's max color is yellow
- Specified by:
computeHeuristic
in interface Heuristic
- Parameters:
gameState
- A knockabout state
- Returns:
- Returns a float between 1 and -1. Higher value should correspond to states
favor the max player.
getA_D4
public float getA_D4()
- Returns:
getA_D6
public float getA_D6()
- Returns:
getA_D8
public float getA_D8()
- Returns:
getA_VD
public float getA_VD()
- Returns:
getNormalizationFactor
public float getNormalizationFactor()
- Returns:
setA_D4
public void setA_D4(float f)
- Parameters:
f
-
setA_D6
public void setA_D6(float f)
- Parameters:
f
-
setA_D8
public void setA_D8(float f)
- Parameters:
f
-
setA_VD
public void setA_VD(float f)
- Parameters:
f
-