|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.algorithm.template.OpenClosedGeneralSearchProblem
public class OpenClosedGeneralSearchProblem
GeneralSearchProblem wrapper keeping track of open and closed sets.
This class extends a problem such that it keeps track of closed sets. And thus it optimizes search in search spaces that form graphs, as well as prevents circular expansions. However, this book-keeping will prove useless and time-consuming on search spaces that form real trees (without repetitive nodes and cross edges).
The closed set is the set of closed nodes that have already been expanded. Nodes in the search space that are not closed are called open.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface orbital.algorithm.template.GeneralSearchProblem |
---|
GeneralSearchProblem.Transition |
Nested classes/interfaces inherited from interface orbital.algorithm.template.MarkovDecisionProblem |
---|
MarkovDecisionProblem.DefaultTransition |
Constructor Summary | |
---|---|
OpenClosedGeneralSearchProblem(GeneralSearchProblem problem)
Create a GeneralSearchProblem keeping track of closed sets. |
Method Summary | |
---|---|
java.util.Iterator |
actions(java.lang.Object s)
Only returns actions leading to open nodes, and only if s is not closed itself. |
MutableFunction |
getAccumulatedCostFunction()
Get the accumulated cost function. |
java.lang.Object |
getInitialState()
Get the initial state of the problem. |
GeneralSearchProblem |
getProblem()
Get the proper (inner) problem to solve which does not yet keep track of closed sets. |
boolean |
isSolution(java.lang.Object s)
Check whether the given state is a goal state (a valid solution to the problem). |
java.util.Iterator |
states(java.lang.Object a,
java.lang.Object s)
Get all states reachable with any transitions from the state under a given action. Deterministic case (will only return one single transition per action). |
TransitionModel.Transition |
transition(java.lang.Object a,
java.lang.Object s,
java.lang.Object sp)
Get (information about) the transition from a state to another state under a given action. Deterministic case. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OpenClosedGeneralSearchProblem(GeneralSearchProblem problem)
problem
- the proper problem to solve which does not yet keep track of closed sets.Method Detail |
---|
public GeneralSearchProblem getProblem()
public java.lang.Object getInitialState()
getInitialState
in interface GeneralSearchProblem
public java.util.Iterator actions(java.lang.Object s)
actions
in interface GeneralSearchProblem
actions
in interface TransitionModel
s
- the state s∈S whose applicable actions to determine.
GreedyProblem.nextCandidates(java.util.List)
public java.util.Iterator states(java.lang.Object a, java.lang.Object s)
GeneralSearchProblem
Intuitively, those are the only relevant states which can be reached by any transitions (from the given state under the given action) at all.
For performance reasons it is recommended that this method does only return those states sʹ∈S that can truely be reached (i.e. where P(sʹ|s,a) > 0, i.e. sʹ ∈ {s}∘τ(a) = {sʹ∈S ¦ τ(a)(s,sʹ)>0}). Although this is not strictly required if it would be too expensive to determine.
Note that the resulting iterator will never be empty since the transition probabilities sum up 1 (or integrate to 1 in the case of a continuous transition probability distribution), even though the next state may not differ from the previous state.
Deterministic case (will only return one single transition per action).
states
in interface GeneralSearchProblem
states
in interface TransitionModel
a
- the action a∈A(s) that must be applicable in state s∈S.s
- the state s∈S.
public TransitionModel.Transition transition(java.lang.Object a, java.lang.Object s, java.lang.Object sp)
GeneralSearchProblem
This central method specifies the central action-dependent (stochastic) transition relation
In usual cases, implementations can assume that action stems from some call to TransitionModel.actions(Object)
,
and statep is obtained from TransitionModel.states(Object,Object)
.
immediate action cost
of the transition,
plus any (optional) problem-specific additional information.
transition
in interface GeneralSearchProblem
transition
in interface TransitionModel
a
- the action a∈A(s) that must be applicable in state s∈S.s
- the source state s∈S prior to the transition.sp
- the resulting state sʹ∈S after the transition took place.
transition
which may contain additional information.Functions.diracDelta
public boolean isSolution(java.lang.Object s)
MarkovDecisionProblem
Optional variation: Search algorithms generally seek out for one single solution. In order to find all solutions to a problem, simply let this method store solutions and return false instead, until enough solutions have occurred. However, expanding solution nodes should result in an empty list at some time to ensure termination, then.
isSolution
in interface MarkovDecisionProblem
s
- the state s∈S to check for being a goal state.
public MutableFunction getAccumulatedCostFunction()
GeneralSearchProblem
This function encapsulates read write access to the accumulated cost values. Search algorithms can accumulate cost for states by setting g(s) to the accumulate cost value, and later query that accumulate cost value again, by applying g.
The most simple way of providing such an accumulated cost function g, is to enrich states with a (private) field for accumulated cost that is accessible via g. So you can simply use S×R as states instead of S for storing accumulated cost values.Since search algorithms may invoke this method several times, it should not perform too slow. So consider returning a single pre-initialized instance of the accumulate cost function.
Note that accumulated cost functions usually do not need to be cloned.
getAccumulatedCostFunction
in interface GeneralSearchProblem
Real
s.
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |