|
Orbital library | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorbital.algorithm.template.GeneralSearch
orbital.algorithm.template.BestFirstSearch
orbital.algorithm.template.AStar
public class AStar
A* search class.
In fact this is a special instance of WA* with W=1.
A* is complete, optimal if the heuristic function h is admissible. It has a time and space complexity of O(bd). A* is optimal in another sense ("optimally efficient"): no other algorithm expands less nodes than A* with the same heuristic function. It also expands nodes only once. But this does not mean that it is always fastest. A* expands less nodes with better heuristic functions (h' is better than h if 0 < h < h' ≤ h*).
To be precise, like most (if not all) other search algorithms, A* achieves completeness only on locally finite graphs (i.e. with finite branching factors) provided that the costs keep away from zero, i.e.
For the (admissible) heuristic h=0, A* results in (non-uniform cost) BreadthFirstSearch,
whilst no admissible heuristic can exist that will let A* resemble DepthFirstSearch.
For the ignorant cost function g=0, A* degrades to a simple best first search that
always selects best nodes first regardless of the history.
This behaviour for g=0 resembles HillClimbing but is not limited to selecting
from most recently expaned nodes,
nevertheless with g=0 it is still incomplete and not optimal.
WAStar with W=1.| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class orbital.algorithm.template.BestFirstSearch |
|---|
BestFirstSearch.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 | |
|---|---|
AStar(Function heuristic)
Create a new instance of A* search. |
|
| Method Summary | |
|---|---|
Function |
complexity()
O(bd) where b is the branching factor and d the solution depth. |
Function |
getEvaluation()
f(n) = g(n) + h(n). |
Function |
getHeuristic()
Get the heuristic function used. |
boolean |
isOptimal()
Optimal if heuristic is admissible. |
void |
setHeuristic(Function heuristic)
Set the heuristic function to use. |
Function |
spaceComplexity()
O(bd) where b is the branching factor and d the solution depth. |
| Methods inherited from class orbital.algorithm.template.BestFirstSearch |
|---|
createTraversal |
| Methods inherited from class orbital.algorithm.template.GeneralSearch |
|---|
getProblem, search, solve, solveImpl |
| 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 |
| Constructor Detail |
|---|
public AStar(Function heuristic)
heuristic - the heuristic cost function h:S→R embedded in the evaluation function f.getEvaluation()| Method Detail |
|---|
public Function getHeuristic()
HeuristicAlgorithm
getHeuristic in interface HeuristicAlgorithmpublic void setHeuristic(Function heuristic)
HeuristicAlgorithmAn 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
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
A simple improvement for heuristic functions is using pathmax.
setHeuristic in interface HeuristicAlgorithmheuristic - the heuristic cost function h:S→R estimating h*.
h will be embedded in the evaluation function f.public Function getEvaluation()
getEvaluation in interface EvaluativeAlgorithmgetEvaluation in interface HeuristicAlgorithmpublic Function complexity()
complexity in interface AlgorithmicTemplateAlgorithmicTemplate.solve(AlgorithmicProblem)public Function spaceComplexity()
spaceComplexity in interface AlgorithmicTemplateAlgorithmicTemplate.solve(AlgorithmicProblem)public boolean isOptimal()
isOptimal in class GeneralSearch
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||