|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectalgs.model.problems.fifteenpuzzle.GoodEvaluator
public class GoodEvaluator
Better evaluation function, as inspired from Nilsson, p. 66., and applied to the Fifteen Puzzle
Constructor Summary | |
---|---|
GoodEvaluator()
|
Method Summary | |
---|---|
int |
eval(INode state)
h^(n) = P(n) + 4*S(n), where P(n) is the sum of the distances (via manhattan metric) that each tile is from "home". |
void |
score(INode state)
Evaluate the given state and update its score using our scoring function. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public GoodEvaluator()
Method Detail |
---|
public void score(INode state)
IScore
score
in interface IScore
state
- The board state whose score value is to be updated.IScore.score(INode)
public int eval(INode state)
Compute f^(n) = g^(n) + h^(n) where g(n) is the length of the path form the start node n to the state.
eval
in interface IScore
state
- state being evaluatedIScore.score(INode)
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |