|
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.searchtree.DepthFirstSearch
public class DepthFirstSearch
Given an initial state, a target goal state, expand in breadth-first manner all available moves until the target goal state is reached.
This search approach uses a Stack to store the OPEN set, to expand the most recently added board states, until the depth limit is reached.
Note that different performance can be obtained by setting the closedStorage
appropriately. If set to StateStorageFactory
.HASH then performance
benefits will be seen. If set to StateStorageFactory
.TREEWITHKEY then
the boardstate Key will be used to differentiate boards. With board states that
exhibit rotational symmetry, this method will achieve faster search times.
Field Summary | |
---|---|
int |
numClosed
|
int |
numMoves
|
int |
numOpen
|
Constructor Summary | |
---|---|
DepthFirstSearch()
Depth-First with no bound. |
|
DepthFirstSearch(int bound)
Initiate the Depth First Search with the given fixed-depth bound to search. |
Method Summary | |
---|---|
Solution |
search(INode initial,
INode goal)
Initiate the search for the target state. |
void |
storageType(int type)
Determine structure to use for storing CLOSED set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int numMoves
public int numOpen
public int numClosed
Constructor Detail |
---|
public DepthFirstSearch()
public DepthFirstSearch(int bound)
bound
- fixed depth to which to search.Method Detail |
---|
public void storageType(int type)
StateStorageFactory
type
- public Solution search(INode initial, INode goal)
search
in interface ISearch
initial
- the initial board stategoal
- the final board state
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |