de.cesr.lara.template
Class MyAgent

java.lang.Object
  extended by de.cesr.lara.template.MyAgent
All Implemented Interfaces:
LaraAgent<MyAgent,MyAbstractBehaviouralOption<MyAgent>>, LaraAbstractEventSubscriber, LaraEventSubscriber

public class MyAgent
extends Object
implements LaraAgent<MyAgent,MyAbstractBehaviouralOption<MyAgent>>

As we do agent based modeling the agent makes up the heart of our model. The agent implements the interface LaraAgent - this is neceassary to provide an abstract view of the agent the LARA architecture can interact with.


Constructor Summary
MyAgent(String id, MyEnvironment environment)
          creates an agent. requires a unique identifier string
 
Method Summary
 void decide(LaraDecisionConfiguration dBuilder)
          this is called in the end of an decision process. the agent looks for the best decision and acts according to the decision he made. in our case he memorises his decision.
 void execute(LaraDecisionConfiguration dBuilder)
          Do some actions based on the agents decision.
 String getAgentId()
          Get the custom agent id.
 LaraAgentComponent<MyAgent,MyAbstractBehaviouralOption<MyAgent>> getLaraComp()
          Returns the LaraAgentComponent of this agent.
 boolean isDecisionDeliberative()
          Is called during the preProcess phase.
<T extends LaraEvent>
void
onEvent(T event)
          Will be called with an event as a parameter when an event the subscriber subscribed to occurs.
 void perceive(LaraDecisionConfiguration dBuilder)
          perceive the two environmental properties
 void setLaraComp(LaraAgentComponent<MyAgent,MyAbstractBehaviouralOption<MyAgent>> component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MyAgent

public MyAgent(String id,
               MyEnvironment environment)
creates an agent. requires a unique identifier string

Parameters:
id -
Method Detail

decide

public void decide(LaraDecisionConfiguration dBuilder)
this is called in the end of an decision process. the agent looks for the best decision and acts according to the decision he made. in our case he memorises his decision.


execute

public void execute(LaraDecisionConfiguration dBuilder)
Do some actions based on the agents decision. In this case (which is typical) change the environment.


getAgentId

public String getAgentId()
Description copied from interface: LaraAgent
Get the custom agent id.

Specified by:
getAgentId in interface LaraAgent<MyAgent,MyAbstractBehaviouralOption<MyAgent>>
Returns:
agent id string
See Also:
LaraAgent.getAgentId()

getLaraComp

public LaraAgentComponent<MyAgent,MyAbstractBehaviouralOption<MyAgent>> getLaraComp()
Description copied from interface: LaraAgent
Returns the LaraAgentComponent of this agent.

Specified by:
getLaraComp in interface LaraAgent<MyAgent,MyAbstractBehaviouralOption<MyAgent>>
Returns:
component Lara agent component
See Also:
LaraAgent.getLaraComp()

isDecisionDeliberative

public boolean isDecisionDeliberative()
Is called during the preProcess phase. Determines if decision making in this timestep is done by habit or deliberative.

Returns:
true/false

onEvent

public <T extends LaraEvent> void onEvent(T event)
Description copied from interface: LaraEventSubscriber
Will be called with an event as a parameter when an event the subscriber subscribed to occurs. Implement this to react on events. Typically you would start doing something like if (event instanceof VeryInterestingEvent) { //do something smart }

Specified by:
onEvent in interface LaraEventSubscriber

perceive

public void perceive(LaraDecisionConfiguration dBuilder)
perceive the two environmental properties


setLaraComp

public void setLaraComp(LaraAgentComponent<MyAgent,MyAbstractBehaviouralOption<MyAgent>> component)
Parameters:
component -