core
Interface Problem<T>

Type Parameters:
T - the type of the states used throughout the search
All Known Subinterfaces:
BidirectionalProblem<T>, HeuristicProblem<T>, HillClimbingProblem<T>, SimulatedAnnealingProblem<T>, TreeProblem<T>

public interface Problem<T>

This is the base of all problems which can be solved with the Search framework.

A simple Problem consists of a starting state, a test if a state is a goal or not and a way to generate the successor states of a known state.
If you implement this interface, your problem can be solved by the following search algorithms:

Author:
eden06
See Also:
DepthFirstSearch, BreadthFirstSearch, SlowDepthFirstSearch

Method Summary
 java.util.List<T> expand(T state)
          Generates all successor states of the given state.
 T initial()
          Returns the starting state of the search.
 boolean isGoal(T state)
          Checks whether a given state is a goal of the search or not.
 

Method Detail

initial

T initial()
Returns the starting state of the search.
Note: In some cases (e.g. HillClimbing) it is feasible to return a random generated state, instead of one single starting state.

Returns:
the initial state of your search domain

isGoal

boolean isGoal(T state)
Checks whether a given state is a goal of the search or not.

Parameters:
state - to be checked
Returns:
true only if the state is one of the goal states

expand

java.util.List<T> expand(T state)
Generates all successor states of the given state.
This method should never return null. If the state can not be expanded than you should return an empty List.
Note: Most search algorithms have the ability to check for duplicate states, but if you want to implement your own duplicate handling than this method is the place to put it in.

Parameters:
state - to be expanded
Returns:
a List of all successor states