Class SimpleState
- Direct Known Subclasses:
DumbDoctor.DoctorBelief
,GuessNumberGame.MyAgentState
,State
,Test_BasicAgent_budgeting.MyState
,Test_BasicAgent.MyState
,Test_DynamicGoalStructure.MyState
,Test_Tactic.IntState
BasicAgent
or its subclasses). For most uses, you
will need to extend/subclass this class to enable your agents to track
whatever domain specific information that your agents need to track.
An instance of this class represents the semantical part of an agent's state. By 'semantical' we mean that the instance is intended to contain information that is relevant for solving the agent's goals. In particular, instances of this class do not expose information relevant only for the agent's internal control of its execution. The latter information is, and should be, hidden from you.
As the root class, an instance of this class actually contains no domain specific semantical information. This may sound contradictive with what we just said above, but this is actually reasonable: there is no way to know upfront what kind of problems you want to solve with agents, therefore we cannot provide none either. If you need information that the agent should track, you need to extend this class to introduce the needed fields to hold that information. The exception to this is the following. Any instance S of this class does get the following:
- A message queue containing incoming messages (instances of
nl.uu.cs.aplib.multiAgentSupport
) for the agent that owns S. The queue itself is not exposed. Instead, the agent can access it through a number of exposed methods, e.g. to check if a message of a certain type is present in the queue and to pop it out. - A pointer to the
Environment
used by the agent, thus allowing the agent to inspect the Environment, and to send commands to it.
- Author:
- wish
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Environment
A pointer to theEnvironment
associated to the agent that owns this state.(package private) Logger
A logger.(package private) BasicAgent
A pointer to the agent that owns this state. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionenv()
Return theEnvironment
associated with the state.protected void
Write the string to the logger attached to this state, with the specified logging level.owner()
setEnvironment(Environment env)
Every instance of this class requires an instance to theEnvironment
that is used by the agent that owns this state.void
updateState(String agentId)
This method should send an observe() command to theEnvironment
(that is attached to this state) to send back a new observation from the perspective of the specified agent.
-
Field Details
-
env
Environment envA pointer to theEnvironment
associated to the agent that owns this state. -
owner
BasicAgent ownerA pointer to the agent that owns this state. -
logger
Logger loggerA logger. Don't set this logger yourself. When you attach this state to an agent, the methodwill set this to the right logger.
-
-
Constructor Details
-
SimpleState
public SimpleState()
-
-
Method Details
-
setEnvironment
Every instance of this class requires an instance to theEnvironment
that is used by the agent that owns this state. This methods allows you to set this state's pointer to the given environment.- Parameters:
env
- The Environment we want to associate with this state.- Returns:
- The method simply returns this state to allow it to be used in the Fluent Interface style.
-
updateState
This method should send an observe() command to theEnvironment
(that is attached to this state) to send back a new observation from the perspective of the specified agent. This method subsequently uses this fresh observation to update itself.Since this SimpleState does not actually has any state information, being just a 'simple' state, this method updateState() does not actually update anything. Override this method to implement a more elaborate scheme of updating state.
-
env
Return theEnvironment
associated with the state. -
owner
-
log
Write the string to the logger attached to this state, with the specified logging level.
-