|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectai.search.AbstractSearchStateForIntCostFn
public abstract class AbstractSearchStateForIntCostFn
This class represents a state of the world in a search problem.
Together with an appropriate implementation for actions, an implementation of
a SearchStateForIntCostFn
defines a search problem, which
consists of four components:
successors()
in
this class isGoalState()
in this
class IntCostAction
class
Given a definition of a search problem in terms of these components and
implemented by a class for SearchStateForIntCostFn
s and a
class for IntCostAction
s, a search engine can be used to
attempt to solve the search problem.
The extend this class one of the functions successors()
or
getAllPossibleActions()
must be overridden. Only one of the default
implementations provided here can be used. If
getAllPossibleActions()
is overridden the Array returned by
this function is used to create a generic Iterator to be returned by
successors()
. This approach should only be used if there are
few actions, most of which are usually applicable. Otherwise the function
successors()
should be overridden and this can create a more
efficient Iterator to enumerate the successors of this state.
IntCostAction
,
SearchEngineForIntCostFn
Nested Class Summary | |
---|---|
(package private) class |
AbstractSearchStateForIntCostFn.GenericSuccessorIterator
|
Constructor Summary | |
---|---|
AbstractSearchStateForIntCostFn()
|
Method Summary | |
---|---|
abstract IntCostAction[] |
getAllPossibleActions()
This function returns an array of all the actions that are in principle possible in this state. |
java.util.Iterator<inf.util.Pair<IntCostAction,SearchStateForIntCostFn>> |
successors()
This function indirectly generates the successors for this state in the context of the search problem defined by this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface ai.search.SearchStateForIntCostFn |
---|
apply, getActionClass, isApplicable, isGoalState |
Constructor Detail |
---|
public AbstractSearchStateForIntCostFn()
Method Detail |
---|
public abstract IntCostAction[] getAllPossibleActions()
This function returns an array of all the actions that are in principle possible in this state. There is no guarantee that these actions are also applicable. If this function is implemented correctly then the default implementation of successors() will return a correctly working Iterator. This default implementation only throws an UnsupportedOperationException.
Extensions of this class should override either this function or
successors()
.
public java.util.Iterator<inf.util.Pair<IntCostAction,SearchStateForIntCostFn>> successors()
This function indirectly generates the successors for this state in the context of the search problem defined by this class. The returned Iterator will generate a sequence of Pairs consisting of an IntCostAction and a SearchStateForIntCostFn, where the action if applied in this state will result in the paired state.
The default implementation provided here relies on the function
getAllPossibleActions() to work correctly. Extensions of this class
should override either this function or getAllPossibleActions()
.
successors
in interface SearchStateForIntCostFn
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |