aima.gui.applications.search.map
Class AbstractMapAgentController

java.lang.Object
  extended by aima.gui.framework.AgentAppController
      extended by aima.gui.applications.search.map.AbstractMapAgentController
All Implemented Interfaces:
AgentAppFrame.Controller
Direct Known Subclasses:
RoutePlanningAgentAppDemo.RoutePlanningAgentController

public abstract class AbstractMapAgentController
extends AgentAppController

Provides a useful base class for agent application controller implementations in the context of route planning agent application development. To get it ready to work, all you need to do is, to provide implementations for the four abstract methods. See RoutePlanningAgentAppDemo for an example.


Field Summary
protected  java.util.List<java.lang.String> destinations
          Some location names.
protected  AdaptableHeuristicFunction heuristic
          Heuristic function to be used when performing informed search.
protected  Scenario scenario
          A scenario.
protected  Search search
          Search method to be used.
 
Fields inherited from class aima.gui.framework.AgentAppController
frame, model
 
Constructor Summary
AbstractMapAgentController()
           
 
Method Summary
 void clearAgent()
          Clears the model's tour history.
protected abstract  AdaptableHeuristicFunction createHeuristic(int heuIdx)
          Factory method, responsible for creating a heuristic function.
 void prepareAgent()
          Template method, which performs necessary preparations for running the agent.
protected abstract  void prepareModel()
          Primitive operation, responsible for preparing the model.
 void runAgent()
          Template method, which calls startAgent() and then updates the status bar of the frame.
protected abstract  void selectScenarioAndDest(int scenarioIdx, int destIdx)
          Primitive operation, responsible for assigning values to attributes scenario and destinations.
protected abstract  void startAgent()
          Primitive operation, responsible for creating and starting the agent.
 
Methods inherited from class aima.gui.framework.AgentAppController
setFrame, setModel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

scenario

protected Scenario scenario
A scenario.


destinations

protected java.util.List<java.lang.String> destinations
Some location names. For route planning problems, only one location should be specified.


search

protected Search search
Search method to be used.


heuristic

protected AdaptableHeuristicFunction heuristic
Heuristic function to be used when performing informed search.

Constructor Detail

AbstractMapAgentController

public AbstractMapAgentController()
Method Detail

clearAgent

public void clearAgent()
Clears the model's tour history.

Specified by:
clearAgent in interface AgentAppFrame.Controller
Overrides:
clearAgent in class AgentAppController

prepareAgent

public void prepareAgent()
Template method, which performs necessary preparations for running the agent. The behavior is strongly influenced by the primitive operations selectScenarioAndDest(int, int), prepareModel() and createHeuristic(int).

Specified by:
prepareAgent in interface AgentAppFrame.Controller
Overrides:
prepareAgent in class AgentAppController

runAgent

public void runAgent()
Template method, which calls startAgent() and then updates the status bar of the frame.

Specified by:
runAgent in interface AgentAppFrame.Controller
Overrides:
runAgent in class AgentAppController

selectScenarioAndDest

protected abstract void selectScenarioAndDest(int scenarioIdx,
                                              int destIdx)
Primitive operation, responsible for assigning values to attributes scenario and destinations.


prepareModel

protected abstract void prepareModel()
Primitive operation, responsible for preparing the model. Scenario and destinations are already selected when this method is called.


createHeuristic

protected abstract AdaptableHeuristicFunction createHeuristic(int heuIdx)
Factory method, responsible for creating a heuristic function.


startAgent

protected abstract void startAgent()
Primitive operation, responsible for creating and starting the agent. Scenario, destinations are selected before as well as search method and search heuristic.