Orbital library

orbital.algorithm.template
Class BestFirstSearch.OptionIterator

java.lang.Object
  extended by orbital.algorithm.template.GeneralSearch.OptionIterator
      extended by orbital.algorithm.template.BestFirstSearch.OptionIterator
All Implemented Interfaces:
java.io.Serializable, java.util.Iterator
Enclosing class:
BestFirstSearch

public static class BestFirstSearch.OptionIterator
extends GeneralSearch.OptionIterator

An iterator over a state space in best-first order. Expands nodes with better f-costs, first.

Author:
André Platzer
See Also:
Serialized Form
Invariants:
isSorted(nodes)

Constructor Summary
BestFirstSearch.OptionIterator(GeneralSearchProblem problem, Function evaluation)
           
 
Method Summary
protected  boolean add(java.util.Iterator newNodes)
          merge old and new lists.
protected  boolean isEmpty()
          Returns true if this iterator's collection of nodes currently does not contain any elements.
protected  java.lang.Object select()
          Select the node with min f(n).
 
Methods inherited from class orbital.algorithm.template.GeneralSearch.OptionIterator
getProblem, hasNext, next, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BestFirstSearch.OptionIterator

public BestFirstSearch.OptionIterator(GeneralSearchProblem problem,
                                      Function evaluation)
Parameters:
evaluation - the evaluation function to use for sorting the options monotonically. Usually EvaluativeAlgorithm.getEvaluation().
Method Detail

isEmpty

protected boolean isEmpty()
Description copied from class: GeneralSearch.OptionIterator
Returns true if this iterator's collection of nodes currently does not contain any elements.

Specified by:
isEmpty in class GeneralSearch.OptionIterator
Returns:
true if this collection contains no elements.

select

protected java.lang.Object select()
Select the node with min f(n). Due to the sorted list that is the first object.

Specified by:
select in class GeneralSearch.OptionIterator
Returns:
the selected option after removing it from nodes.
Preconditions:
sorted(nodes)

add

protected boolean add(java.util.Iterator newNodes)
merge old and new lists.

Specified by:
add in class GeneralSearch.OptionIterator
Parameters:
newNodes - the new nodes we apparently became aware of. (Might be modified by this method).
Returns:
true if nodes changed as a result of the call.
See Also:
Setops.merge(List, List, Comparator)
Preconditions:
sorted(nodes)
Postconditions:
sorted(nodes)

Orbital library
1.3.0: 11 Apr 2009

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