Getting start with Brainee

Brainee features a number of ready -to-use AI algorithm that you can use to solve your own problems. But, it also exposes all needed interfaces to build your own search strategies and AI algorithms.

At the time this page is written, only two search algorithms are implemented :
  • TreeSearch,
  • RecursiveSearch.

These two algorithms are very generic and need a search strategy to be fully functional. The following strategies are currently implemented:
  • Uninformed strategies:
    • Breadth-First,
    • Uniform-cost
    • Depth-first,
    • Depth-limited
    • Iterative deepening
    • Graph-search
  • Informed strategies:
    • Greedy-best-first
    • A*

To use these algorithms, just define the problem to solve by implementing the IProblem interface. This interface follows the formal definition given in AIMA :

A problem consists of four parts: the initial state, a set of actions, a goal test function, and a path cost function. The environment of the problem is represented by a state space. A path through the state space from the initial state to a goal state is a solution.

The interface IProblem exposes the following method which match the previous definition:

  public interface IProblem
  {
    // Get or set the initial state that the agent starts in.
    IState InitialState { get; set; }

    // A description of the possible actions available to the agent for a given state. 
    // Given a particular state, Successor returns a set of (action, successor) ordered pairs,
    // where each action is one of the legal actions in current state and each successor is a 
    // state that can be reached from the current one by applying the action.
    IEnumerable<ActionState> Successors (IState state);

    // Determines whether a given state is a goal state.
    bool GoalTest (IState state);

    /// The step cost of taking the action go from a state to another one. 
    double StepCost (IState from, IAction action, IState to);

    // Gets the IEqualityComparer<IState> object that is used
    // to determine equality of two IState instances.
    IEqualityComparer<IState> StateComparer { get; }

    // Returns an estimation of the cost from the given state to the goal state.
    // This method is optional, but must be implemented in order to use informed
    // strategies to solve this problem.
    double EstimatedCostToGoal (IState state);
}

The interfaces IState and IAction are empty and act as marker interfaces: their whole design is left to the developer.

Last edited Sep 12, 2009 at 6:51 PM by cedrou, version 2

Comments

No comments yet.