All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cc.mallet.util.search.AStarNode Maven / Gradle / Ivy

Go to download

MALLET is a Java-based package for statistical natural language processing, document classification, clustering, topic modeling, information extraction, and other machine learning applications to text.

The newest version!
package cc.mallet.util.search;

/**
 * Created by IntelliJ IDEA.
 * User: pereira
 * Date: Jun 19, 2005
 * Time: 1:07:17 PM
 * Search node in an A* search.
 */
public class AStarNode extends SearchNode {
  /**
   * Iterator over new A* search nodes generated by state transitions
   * from this node's state.
   */
  public class NextNodeIterator extends SearchNode.NextNodeIterator {
    protected NextNodeIterator() {
      super();
    }
    public SearchNode nextNode() {
      AStarNode p = AStarNode.this;
      AStarState s = (AStarState)getStateIter().nextState();
      return new AStarNode(s, p, p.getCost() + cost());
    }
  }
  /**
   * Create an A* search node with given state, parent, and cost.
   * @param state the state
   * @param parent the parent
   * @param cost the cost
   */
  public AStarNode(AStarState state, AStarNode parent, double cost) {
    super(state, parent, cost); }
  /**
   * Get the completion cost for the underlying state.
   * @return the completion cost
   */
  public double completionCost() {
    return ((AStarState)getState()).completionCost();
  }
  public SearchNode.NextNodeIterator getNextNodes() {
    return new NextNodeIterator();
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy