public abstract class

Algorithm

extends Object
implements Iterable<T>
java.lang.Object
   ↳ es.usc.citius.hipster.algorithm.Algorithm<A, S, N extends es.usc.citius.hipster.model.Node<A, S, N>>
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

Abstract class implemented by each search algorithm. This class provides basic methods to each algorithm for searching or printing detailed information about the search.

Summary

Nested Classes
interface Algorithm.SearchListener<N>  
class Algorithm.SearchResult Holds information about the search process. 
Public Constructors
Algorithm()
Public Methods
static <A, N extends Node<A, ?, N>> List<A> recoverActionPath(N node)
Returns a path of the actions applied from the initial state to the state of the provided node (state()).
static <S, N extends Node<?, S, N>> List<S> recoverStatePath(N node)
Returns a path with all the states of the path.
SearchResult search(S goalState)
Run the algorithm until the goal is found or no more states are available.
SearchResult search(Predicate<N> condition)
Executes the search algorithm until the predicate condition is satisfied or there are no more nodes to explore.
void search(SearchListener<N> listener)

Executes the search algorithm and invokes the method handle(Object) passing the current explored node to the listener.

[Expand]
Inherited Methods
From class java.lang.Object
From interface java.lang.Iterable

Public Constructors

public Algorithm ()

Public Methods

public static List<A> recoverActionPath (N node)

Returns a path of the actions applied from the initial state to the state of the provided node (state()).

Returns
  • list with the ordered actions.

public static List<S> recoverStatePath (N node)

Returns a path with all the states of the path.

Returns
  • a list with the states of the path, from the initial state to the state of the provided node (state()).

public SearchResult search (S goalState)

Run the algorithm until the goal is found or no more states are available.

Returns
  • SearchResult with the information of the search

public SearchResult search (Predicate<N> condition)

Executes the search algorithm until the predicate condition is satisfied or there are no more nodes to explore.

Parameters
condition predicate with the boolean condition.

public void search (SearchListener<N> listener)

Executes the search algorithm and invokes the method handle(Object) passing the current explored node to the listener.

  {@code Hipster.createDijkstra(problem).search(new Algorithm.SearchListener() {

Parameters
listener listener used to receive the explored nodes.