org.vizzini.game.search
Class AbstractSearch

java.lang.Object
  extended by org.vizzini.game.search.AbstractSearch
All Implemented Interfaces:
ISearch
Direct Known Subclasses:
AlphaBetaSearch, NegamaxSearch

public abstract class AbstractSearch
extends Object
implements ISearch

Provides base functionality for search algorithms.

Since:
v0.2
Version:
v0.3
Author:
Jeffrey M. Thompson

Constructor Summary
AbstractSearch()
           
 
Method Summary
 void configure(Properties properties, int index)
          Configure this search.
protected  int evaluate(IAgent agent, IEvaluator evaluator, IEnvironment environment, IAdjudicator adjudicator, int maxDepth, int depth)
          Return an evaluation of the given environment using the given parameters.
 int getNodesVisitedCount()
          Return the nodes visited count.
protected  void incrementNodesVisited()
          Increment the nodes visited count.
protected abstract  IAction performSearch(IAgent agent, IAgent opponent, IEnvironment environment, IAdjudicator adjudicator, IEvaluator evaluator, IActionGenerator actionGenerator, int maxDepth, int depth, int alpha, int beta, IAction parentAction)
          Perform a search using the given parameters.
protected  void printActions(Collection actions, int maxDepth, int depth)
          Print the given actions.
protected  void releaseActions(Collection actions)
          Release the actions in the given list.
 void reset()
          Reset this search.
 IAction search(IAgent agent, IAgent opponent, IEnvironment environment, IAdjudicator adjudicator, IEvaluator evaluator, IActionGenerator actionGenerator, int maxDepth, int depth)
          Perform a search using the given parameters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSearch

public AbstractSearch()
Method Detail

configure

public void configure(Properties properties,
                      int index)
               throws InstantiationException,
                      IllegalAccessException
Description copied from interface: ISearch
Configure this search.

Specified by:
configure in interface ISearch
Parameters:
properties - Properties.
index - Index of the agent to which this search belongs.
Throws:
InstantiationException - if the specified ITranspositionKeyCreator cannot be instantiated.
IllegalAccessException - if the specified ITranspositionKeyCreator class or its no-arg constructor cannot be accessed.

getNodesVisitedCount

public int getNodesVisitedCount()
Description copied from interface: ISearch
Return the nodes visited count.

Specified by:
getNodesVisitedCount in interface ISearch

reset

public void reset()
Description copied from interface: ISearch
Reset this search.

Specified by:
reset in interface ISearch

search

public IAction search(IAgent agent,
                      IAgent opponent,
                      IEnvironment environment,
                      IAdjudicator adjudicator,
                      IEvaluator evaluator,
                      IActionGenerator actionGenerator,
                      int maxDepth,
                      int depth)
Description copied from interface: ISearch
Perform a search using the given parameters.

Specified by:
search in interface ISearch
Parameters:
agent - Agent.
opponent - Opposing agent.
environment - Environment.
adjudicator - Adjudicator.
evaluator - Evaluator.
actionGenerator - Action generator.
maxDepth - Maximum depth of search.
depth - Current depth of search.

performSearch

protected abstract IAction performSearch(IAgent agent,
                                         IAgent opponent,
                                         IEnvironment environment,
                                         IAdjudicator adjudicator,
                                         IEvaluator evaluator,
                                         IActionGenerator actionGenerator,
                                         int maxDepth,
                                         int depth,
                                         int alpha,
                                         int beta,
                                         IAction parentAction)
Perform a search using the given parameters.

Since:
v0.2

evaluate

protected int evaluate(IAgent agent,
                       IEvaluator evaluator,
                       IEnvironment environment,
                       IAdjudicator adjudicator,
                       int maxDepth,
                       int depth)
Return an evaluation of the given environment using the given parameters.

Since:
v0.2

incrementNodesVisited

protected void incrementNodesVisited()
Increment the nodes visited count.

Since:
v0.2

printActions

protected void printActions(Collection actions,
                            int maxDepth,
                            int depth)
Print the given actions.

Parameters:
actions -
maxDepth -
depth -
Since:
v0.3

releaseActions

protected void releaseActions(Collection actions)
Release the actions in the given list.

Parameters:
actions - Actions list.
Since:
v0.3


Copyright 2007 Vizzini.org. All Rights Reserved. 2007.12.25.03.00.02