Orbital library

orbital.algorithm.template
Class IterativeDeepeningAStar

java.lang.Object
  extended by orbital.algorithm.template.GeneralSearch
      extended by orbital.algorithm.template.GeneralBoundingSearch
          extended by orbital.algorithm.template.IterativeDeepeningAStar
All Implemented Interfaces:
java.io.Serializable, AlgorithmicTemplate, EvaluativeAlgorithm, HeuristicAlgorithm

public class IterativeDeepeningAStar
extends GeneralBoundingSearch
implements HeuristicAlgorithm

Iterative Deepening A* (IDA*). A heuristic search algorithm.

Apart from the evaluation function, IDA* has not much in common with A* but resembles ID, instead. It is not an instance of best-first search, but of bounding search. Which also means that it has less administrative overhead than maintaining priority queues.

IDA* is complete, optimal if the heuristic function h is admissible. It has a time complexity of O(bd) and a space complexity of O(b*d).

The effective time complexity of IDA* depends upon the number of different values the heuristic returns. If |h(S)| is small, IDA* only has to go through very little iterations. Of course, if the heuristic has too few values, then it does not guide search at all.

Author:
André Platzer
See Also:
"Korf, R.E. (1985) Depth-first iterative deepening. An optimal admissible tree search. AIJ, 27(1), 97-109", Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class orbital.algorithm.template.GeneralSearch
GeneralSearch.OptionIterator
 
Nested classes/interfaces inherited from interface orbital.algorithm.template.HeuristicAlgorithm
HeuristicAlgorithm.Configuration, HeuristicAlgorithm.PatternDatabaseHeuristic
 
Nested classes/interfaces inherited from interface orbital.algorithm.template.EvaluativeAlgorithm
EvaluativeAlgorithm.EvaluationComparator
 
Constructor Summary
IterativeDeepeningAStar(Function heuristic)
          Create a new instance of IDA* search.
 
Method Summary
 Function complexity()
          O(bd) where b is the branching factor and d the solution depth.
protected  java.util.Iterator createTraversal(GeneralSearchProblem problem)
          Define a traversal order by creating an iterator for the problem's state space.
 Function getEvaluation()
          f(n) = g(n) + h(n).
 Function getHeuristic()
          Get the heuristic function used.
 boolean isOptimal()
          Optimal if heuristic is admissible.
protected  boolean isOutOfBounds(java.lang.Object node)
          Compare f(n) with bound, normally and in case update cheapest pruned bound.
 void setHeuristic(Function heuristic)
          Set the heuristic function to use.
protected  java.lang.Object solveImpl(GeneralSearchProblem problem)
          Solve with bounds f(n0), f(n1), f(n2), ...
 Function spaceComplexity()
          O(b*d) where b is the branching factor and d the solution depth.
 
Methods inherited from class orbital.algorithm.template.GeneralBoundingSearch
getBound, isContinuedWhenFound, processSolution, search, setBound, setBound, setContinuedWhenFound
 
Methods inherited from class orbital.algorithm.template.GeneralSearch
getProblem, solve
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface orbital.algorithm.template.AlgorithmicTemplate
solve, spaceComplexity
 

Constructor Detail

IterativeDeepeningAStar

public IterativeDeepeningAStar(Function heuristic)
Create a new instance of IDA* search. Which is a bounding search using the evaluation function f(n) = g(n) + h(n).

Parameters:
heuristic - the heuristic cost function h:S→R embedded in the evaluation function f.
See Also:
getEvaluation()
Method Detail

getHeuristic

public Function getHeuristic()
Description copied from interface: HeuristicAlgorithm
Get the heuristic function used.

Specified by:
getHeuristic in interface HeuristicAlgorithm
Returns:
the heuristic cost function h:S→R estimating h*.

setHeuristic

public void setHeuristic(Function heuristic)
Description copied from interface: HeuristicAlgorithm
Set the heuristic function to use.

An heuristic cost function h:S→R is estimating the cost to get from a node n to a goal G. For several heuristic algorithms this heuristic function needs to be admissible

h ≤ h*
i.e. h is a lower bound for the effective cost function h*. Then the pathmax heuristic f(s') := max {f(s), g(s') + h(s')} (for transitions s→s'=t(s,a) with a∈A(s)) is monotonic.

A heuristic cost function h is monotonic :⇔ the f-costs (with h) do not decrease in any path from the initial state ⇔ h obeys the triangular inequality

∀s∈S,a∈A(s) h(s) ≤ h(s') + c(s,a) with s' = t(s,a)
i.e. the sum of the costs from A to C and from C to B must not be less than the cost from A to B.

A simple improvement for heuristic functions is using pathmax.

Specified by:
setHeuristic in interface HeuristicAlgorithm
Parameters:
heuristic - the heuristic cost function h:S→R estimating h*. h will be embedded in the evaluation function f.
See Also:
"Pearl, J. Heuristics: Intelligent Search Strategies for Computer Problem Solving. Addison-Wesley, Reading, Massachusetts. 1984."

getEvaluation

public Function getEvaluation()
f(n) = g(n) + h(n).

Specified by:
getEvaluation in interface EvaluativeAlgorithm
Specified by:
getEvaluation in interface HeuristicAlgorithm
Returns:
the evaluation function f:S→R used to evaluate (either utility or cost) value of states.

complexity

public Function complexity()
O(bd) where b is the branching factor and d the solution depth.

Specified by:
complexity in interface AlgorithmicTemplate
Returns:
the function f for which the solve() method of this algorithm runs in O(f(n)) assuming the algorithmic problem hook to run in O(1).
See Also:
AlgorithmicTemplate.solve(AlgorithmicProblem)

isOptimal

public boolean isOptimal()
Optimal if heuristic is admissible.

Specified by:
isOptimal in class GeneralSearch
Returns:
whether this search algorithm is optimal, i.e. whether solutions found are guaranteed to be optimal.

isOutOfBounds

protected boolean isOutOfBounds(java.lang.Object node)
Compare f(n) with bound, normally and in case update cheapest pruned bound.

Overrides:
isOutOfBounds in class GeneralBoundingSearch
Parameters:
node - the node to check.
Returns:
whether the node is out of current bounds.
See Also:
nextBound

solveImpl

protected java.lang.Object solveImpl(GeneralSearchProblem problem)
Solve with bounds f(n0), f(n1), f(n2), ... until a solution is found. Where n0=root, and ni is the cheapest node pruned in iteration i-1.

Overrides:
solveImpl in class GeneralSearch
Returns:
the solution found by GeneralSearch.search(Iterator).
See Also:
GeneralSearch.search(Iterator)

createTraversal

protected java.util.Iterator createTraversal(GeneralSearchProblem problem)
Description copied from class: GeneralSearch
Define a traversal order by creating an iterator for the problem's state space.

Lays a linear order through the state space which the search can simply follow sequentially. Thus a traversal policy effectively reduces a search problem through a graph to a search problem through a linear sequence of states. Of course, the mere notion of a traversal policy does not yet solve the task of finding a good order of states, but only encapsulate it. Complete search algorithms result from traversal policies that have a linear sequence through the whole state space.

Parameters:
problem - the problem whose state space to create a traversal iterator for.
Returns:
an iterator over the options of the problem's state space thereby encapsulating and hiding the traversal order.
See Also:
Factory Method, GeneralSearch.OptionIterator

spaceComplexity

public Function spaceComplexity()
O(b*d) where b is the branching factor and d the solution depth.

Returns:
the function f for which the solve() method of this algorithm consumes memory with an amount in O(f(n)) assuming the algorithmic problem hook uses space in O(1).
See Also:
AlgorithmicTemplate.solve(AlgorithmicProblem)

Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.