|
Orbital library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orbital.algorithm.template.GeneralSearch orbital.algorithm.template.GeneralBoundingSearch orbital.algorithm.template.BranchAndBound
public class BranchAndBound
Branch-and-bound (B&B).
B&B is complete, optimal, and has a time complexity of O(bd) and a space complexity of O(b*d).
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 | |
---|---|
BranchAndBound(Function heuristic,
double maximumUpperBound)
Deprecated. Since Orbital1.1 use BranchAndBound(Function,Real) instead. |
|
BranchAndBound(Function heuristic,
Real maximumUpperBound)
Create a new instance of Branch and Bound 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. |
Real |
getMaxBound()
Get the maximum upper bound for a solution. |
boolean |
isOptimal()
Whether this search algorithm is optimal. |
protected java.lang.Object |
processSolution(java.lang.Object node)
Updates bound to solution cost. |
void |
setHeuristic(Function heuristic)
Set the heuristic function to use. |
void |
setMaxBound(double maximumUpperBound)
Deprecated. Since Orbital1.1 use setMaxBound(Real) instead. |
void |
setMaxBound(Real maximumUpperBound)
Set the maximum upper bound for a solution. |
protected java.lang.Object |
solveImpl(GeneralSearchProblem problem)
Implements the solution policy. |
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, isOutOfBounds, 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 |
---|
public BranchAndBound(Function heuristic, Real maximumUpperBound)
heuristic
- the heuristic cost function h:S→R embedded in the evaluation function f.maximumUpperBound
- is a sufficiently high upper bound for a solution.
If there is no solution below this bound, the search will fail.getEvaluation()
public BranchAndBound(Function heuristic, double maximumUpperBound)
BranchAndBound(Function,Real)
instead.
Method Detail |
---|
public Real getMaxBound()
public void setMaxBound(Real maximumUpperBound)
maximumUpperBound
- is a sufficiently high upper bound for a solution.
If there is no solution below this bound, the search will fail.public void setMaxBound(double maximumUpperBound)
setMaxBound(Real)
instead.
public Function getHeuristic()
HeuristicAlgorithm
getHeuristic
in interface HeuristicAlgorithm
public void setHeuristic(Function heuristic)
HeuristicAlgorithm
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
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 HeuristicAlgorithm
heuristic
- the heuristic cost function h:S→R estimating h*.
h will be embedded in the evaluation function f
.public Function getEvaluation()
getEvaluation
in interface EvaluativeAlgorithm
getEvaluation
in interface HeuristicAlgorithm
public Function complexity()
complexity
in interface AlgorithmicTemplate
AlgorithmicTemplate.solve(AlgorithmicProblem)
public boolean isOptimal()
GeneralSearch
If a search algorithm is not optimal, i.e. it might be content with solutions that are sub optimal only, then it can at most reliably find solutions, not best solutions. However, those solutions found still provide an upper bound to the optimal solution.
isOptimal
in class GeneralSearch
protected java.lang.Object processSolution(java.lang.Object node)
processSolution
in class GeneralBoundingSearch
node
- the node describing the solution.
protected java.lang.Object solveImpl(GeneralSearchProblem problem)
GeneralSearch
Like the default solution policies, this implementation will
GeneralSearch.createTraversal(GeneralSearchProblem)
.
GeneralSearch.search(Iterator)
to search through the state space in the traversal order.
solveImpl
in class GeneralSearch
GeneralSearch.search(Iterator)
.GeneralSearch.search(Iterator)
public Function spaceComplexity()
AlgorithmicTemplate.solve(AlgorithmicProblem)
protected java.util.Iterator createTraversal(GeneralSearchProblem problem)
GeneralSearch
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.
createTraversal
in class GeneralSearch
problem
- the problem whose state space to create a traversal iterator for.
GeneralSearch.OptionIterator
|
Orbital library 1.3.0: 11 Apr 2009 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |