net.openai.ai.hybrid.fsmagent
Class FSMAgent
java.lang.Object
|
+--net.openai.ai.agent.Agent
|
+--net.openai.ai.agent.MobileAgent
|
+--net.openai.ai.hybrid.fsmagent.FSMAgent
- All Implemented Interfaces:
- AgentConstants, java.io.Serializable
- public class FSMAgent
- extends MobileAgent
This MobileAgent uses an internal Finite State Machine as its method of
execution. All states within the FSMAgent's Machine must be AgentStates
or a ClassCastException will the thrown during the executeAgent() method.
Upon startup, the String "FSM_AGENT_START" will be used as the first input
into the FSM. The easiest way to handle this is to use an "AnyCondition"
as the transition Condition for exiting the start state.
It is important to make sure you cover all possible Conditions for the
transitions out of an AgentState otherwise there is a risk in the Machine
throwing an UnhandledConditionException that will cause the FSMAgent to
die. If you do want to stop the agent at a particular point in the FSM
graph, you should add a transition to a HaltState.
- See Also:
- Serialized Form
Constructor Summary |
FSMAgent(AgentState startState)
Constructs a new FSMAgent with the given start state. |
Methods inherited from class net.openai.ai.agent.Agent |
displayMessage, getAgentDescription, getAgentID, getAgentNumber, getDaemon, getLogStream, getRunState, getShortDescription, getSpawnHostIP, getSpawnHostName, getSpawnTime, halt, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
FSMAgent
public FSMAgent(AgentState startState)
- Constructs a new FSMAgent with the given start state.
- Parameters:
startState
- The initial state to start in.
getStartState
protected AgentState getStartState()
- Returns a handle to the start state for the FSMAgent.
- Returns:
- The internal starting AgentState.
executeAgent
protected final void executeAgent()
throws java.lang.Exception
- Executes the agent.
- Specified by:
executeAgent
in class Agent
java.lang.Exception
Copyright - 2001 OpenAI Labs. All Rights Reserved.