de.cesr.lara.houseplant
Class Agent

java.lang.Object
  extended by de.cesr.lara.houseplant.Agent
All Implemented Interfaces:
LaraAgent<Agent,AbstractIrrigationBehaviouralOption<Agent>>, LaraAbstractEventSubscriber, LaraEventSubscriber

public class Agent
extends Object
implements LaraAgent<Agent,AbstractIrrigationBehaviouralOption<Agent>>

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
Agent(String id, String habitationId, LaraEnvironment environment, Map<Class<? extends LaraPreference>,Double> preferences)
          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 memorizes his decision.
 void execute(LaraDecisionConfiguration dBuilder)
          Do some actions based on the agents decision.
 String getAgentId()
          Get the custom agent id.
 double getCurrentAmountOfWaterOfHouseplant()
           
 int getCurrentSunshineDuration()
           
 LaraAgentComponent<Agent,AbstractIrrigationBehaviouralOption<Agent>> getLaraComp()
          Returns the LaraAgentComponent of this agent.
 double getPercentageOfCollaboratorsWhoIrrigatedLastTimestep()
           
 boolean isDecisionDeliberative()
          Is called during the preProcess phase.
 boolean isPlantOk()
          does the agent consider the plant to be ok?
<T extends LaraEvent>
void
onEvent(T event)
          react on events based on the type of the event
 void perceive(LaraDecisionConfiguration dBuilder)
          perceive the relevant environmental properties (sunshine, what did others do and amount of water)
 void setLaraComp(LaraAgentComponent<Agent,AbstractIrrigationBehaviouralOption<Agent>> component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Agent

public Agent(String id,
             String habitationId,
             LaraEnvironment environment,
             Map<Class<? extends LaraPreference>,Double> preferences)
creates an agent. requires a unique identifier string

Parameters:
id -
Method Detail

isPlantOk

public boolean isPlantOk()
does the agent consider the plant to be ok? TODO implement knowledge here?

Returns:
true if agents thinks, plant is ok

getCurrentSunshineDuration

public int getCurrentSunshineDuration()
Returns:
the sunshine duration for the current timestep as perceived from the environment

getPercentageOfCollaboratorsWhoIrrigatedLastTimestep

public double getPercentageOfCollaboratorsWhoIrrigatedLastTimestep()
Returns:
how many percent of the agents collaborators have irrigated the plant in the last timestep

getAgentId

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

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

getLaraComp

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

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

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 memorizes 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.


perceive

public void perceive(LaraDecisionConfiguration dBuilder)
perceive the relevant environmental properties (sunshine, what did others do and amount of water)


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)
react on events based on the type of the event

Specified by:
onEvent in interface LaraEventSubscriber

setLaraComp

public void setLaraComp(LaraAgentComponent<Agent,AbstractIrrigationBehaviouralOption<Agent>> component)
Parameters:
component -

getCurrentAmountOfWaterOfHouseplant

public double getCurrentAmountOfWaterOfHouseplant()
Returns:
current amount of water the houseplant has