de.cesr.lara.components.agents.impl
Class LDefaultAgentComp<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>

java.lang.Object
  extended by de.cesr.lara.components.agents.impl.LDefaultAgentComp<A,BO>
Type Parameters:
A - type of agent
BO - the type of behavioural options memorised in the BO memory The type of agent this agent component belongs to
All Implemented Interfaces:
LaraAgentComponent<A,BO>, LaraEnvironmentListener, LaraAbstractEventSubscriber, LaraInternalEventSubscriber

public class LDefaultAgentComp<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
extends Object
implements LaraAgentComponent<A,BO>


Field Summary
protected  A agent
          the agent the component belongs to
protected  LaraBOMemory<BO> boMemory
          memory for behavioural options
protected  Map<LaraDecisionConfiguration,LaraDecisionData<A,BO>> decisionData
          the agents decision module
protected static Map<LaraDecisionConfiguration,LaraDeliberativeChoiceComponent> defaultDeliberativeChoiceComponents
          Deliberative choice components according to LaraDecisionConfiguration.
protected  Map<LaraDecisionConfiguration,LaraDeliberativeChoiceComponent> deliberativeChoiceCompents
          Deliberative choice components according to LaraDecisionConfiguration.
protected  Map<String,Double> doubleProperties
          DODOC describe this feature properties
protected  LaraEnvironment environment
          environment
protected  LEventbus eventBus
           
protected  LaraMemory<LaraProperty<?,?>> memory
          a collection of the agents behavioural options
protected  LaraPostprocessorComp<A,BO> postProcessorComp
           
protected  Collection<Class<? extends LaraPreference>> preferences
          a collection of the agents preferenceWeights
protected  Map<Class<? extends LaraPreference>,Double> preferenceWeights
          a collection of the agents preferenceWeights towards preferenceWeights
protected  LaraPreprocessor<A,BO> preprocessor
          Since each agent may have different strategies and modes of action selection, each agent is assigned an instance of LaraPreprocessor .
protected  LaraBOPreselector.Accuracy preselectingBOaccuracy
          accuracy
 
Constructor Summary
LDefaultAgentComp(A agent, LaraEnvironment env)
          Simplest Constructor (e.g. social environment, geographical environment)
 
Method Summary
 void addPreferenceWeights(LPrefEntry... prefEntry)
          Set the agent's preferenceWeights towards its preferences.
 void addPreferenceWeights(Map<Class<? extends LaraPreference>,Double> preferenceWeights)
          Set the agent's preference weights towards its preferences.
 void decide(LaraDecisionConfiguration decisionConfig)
          Executes decision making for the given LaraDecisionConfiguration: Simulates the agent's decision making process.
 void envPropertyChanged(LAbstractEnvironmentalProperty<?> envProperty)
          Called by the LaraEnvironment to inform about property changes.
 LaraBOMemory<BO> getBOMemory()
          Get the LaraBOMemory (for behavioural options) of this agent.
 LaraDecisionData<A,BO> getDecisionData(LaraDecisionConfiguration dConfiguration)
          Returns the LaraDecisionData object associated with the given LaraDecisionConfiguration.
 Iterable<LaraDecisionData<A,BO>> getDecisionDataIterable()
          Returns an iterator that iterates over all LaraDecisionDatas.
static LaraDeliberativeChoiceComponent getDefaultDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration)
           
 LaraDeliberativeChoiceComponent getDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration)
          Returns the LaraDeliberativeChoiceComponent that shall be used for the given decision configuration.
 double getDoubleProperty(String name)
           
 LaraEnvironment getEnvironment()
          Get the environment this agent belongs to by its type
 LaraMemory<LaraProperty<?,?>> getGeneralMemory()
          Get the LaraMemory (for general properties) of this agent.
 int getNumDecisionDataObjects()
          The number of LaraDecisionData objects currently stored at the agent.
 Double getPreferenceWeight(Class<? extends LaraPreference> preference)
           
 Map<Class<? extends LaraPreference>,Double> getPreferenceWeights()
           
 void onInternalEvent(LaraEvent event)
          LAgentPreprocessEvent: If no LaraPreprocessor was set, the default preprocessor is set now.
 void removeDecisionData(LaraDecisionConfiguration dConfiguration)
          Removes the LaraDecisionData that is associated with the specified LaraDecisionConfiguration.
 void setBOMemory(LaraBOMemory<BO> boMemory)
          Set the agent's behavioural options memory
static void setDefaultDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration, LaraDeliberativeChoiceComponent comp)
           
 void setDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration, LaraDeliberativeChoiceComponent comp)
          Sets the LaraDeliberativeChoiceComponent that shall be used for the given decision configuration.
 void setDoubleProperty(String name, double value)
           
 void setGeneralMemory(LaraMemory<LaraProperty<?,?>> memory)
          Set the agent's general property memory
 void setPostProcessor(LaraPostprocessorComp<A,BO> postprocesor)
          Sets the post-processor component.
 void setPreprocessor(LaraPreprocessor<A,BO> preprocessor)
          Set the agent's pre-processor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultDeliberativeChoiceComponents

protected static Map<LaraDecisionConfiguration,LaraDeliberativeChoiceComponent> defaultDeliberativeChoiceComponents
Deliberative choice components according to LaraDecisionConfiguration. Contains default for key NULL.


agent

protected A extends LaraAgent<A,BO> agent
the agent the component belongs to


decisionData

protected Map<LaraDecisionConfiguration,LaraDecisionData<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>> decisionData
the agents decision module


deliberativeChoiceCompents

protected Map<LaraDecisionConfiguration,LaraDeliberativeChoiceComponent> deliberativeChoiceCompents
Deliberative choice components according to LaraDecisionConfiguration. Contains default for key NULL.


preferences

protected Collection<Class<? extends LaraPreference>> preferences
a collection of the agents preferenceWeights


preferenceWeights

protected Map<Class<? extends LaraPreference>,Double> preferenceWeights
a collection of the agents preferenceWeights towards preferenceWeights


memory

protected LaraMemory<LaraProperty<?,?>> memory
a collection of the agents behavioural options


boMemory

protected LaraBOMemory<BO extends LaraBehaviouralOption<?,? extends BO>> boMemory
memory for behavioural options


preprocessor

protected LaraPreprocessor<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>> preprocessor
Since each agent may have different strategies and modes of action selection, each agent is assigned an instance of LaraPreprocessor . (SH)


postProcessorComp

protected LaraPostprocessorComp<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>> postProcessorComp

environment

protected LaraEnvironment environment
environment


eventBus

protected LEventbus eventBus

preselectingBOaccuracy

protected LaraBOPreselector.Accuracy preselectingBOaccuracy
accuracy


doubleProperties

protected Map<String,Double> doubleProperties
DODOC describe this feature properties

Constructor Detail

LDefaultAgentComp

public LDefaultAgentComp(A agent,
                         LaraEnvironment env)
Simplest Constructor (e.g. social environment, geographical environment)

Parameters:
agent -
env -
Method Detail

getDefaultDeliberativeChoiceComp

public static LaraDeliberativeChoiceComponent getDefaultDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration)

setDefaultDeliberativeChoiceComp

public static void setDefaultDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration,
                                                    LaraDeliberativeChoiceComponent comp)
Parameters:
dConfiguration -
comp -

addPreferenceWeights

public void addPreferenceWeights(LPrefEntry... prefEntry)
Description copied from interface: LaraAgentComponent
Set the agent's preferenceWeights towards its preferences.

Specified by:
addPreferenceWeights in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>

addPreferenceWeights

public void addPreferenceWeights(Map<Class<? extends LaraPreference>,Double> preferenceWeights)
Description copied from interface: LaraAgentComponent
Set the agent's preference weights towards its preferences.

Specified by:
addPreferenceWeights in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Parameters:
preferenceWeights - the preferenceWeights to set
See Also:
LaraAgentComponent.addPreferenceWeights(java.util.Map)

decide

public void decide(LaraDecisionConfiguration decisionConfig)
Description copied from interface: LaraAgentComponent
Executes decision making for the given LaraDecisionConfiguration: Simulates the agent's decision making process.

Specified by:
decide in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Parameters:
decisionConfig - decision builder that identifies the decision to execute
See Also:
LaraAgentComponent.decide(de.cesr.lara.components.decision.LaraDecisionConfiguration)

envPropertyChanged

public void envPropertyChanged(LAbstractEnvironmentalProperty<?> envProperty)
Description copied from interface: LaraEnvironmentListener
Called by the LaraEnvironment to inform about property changes.

Specified by:
envPropertyChanged in interface LaraEnvironmentListener
Parameters:
envProperty - Created by Sascha Holzhauer on 10.12.2009
See Also:
LaraEnvironmentListener.envPropertyChanged(de.cesr.lara.components.environment.impl.LAbstractEnvironmentalProperty)

getBOMemory

public LaraBOMemory<BO> getBOMemory()
Description copied from interface: LaraAgentComponent
Get the LaraBOMemory (for behavioural options) of this agent.

Specified by:
getBOMemory in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
agent's behavioural option memory
See Also:
LaraAgentComponent.getGeneralMemory()

getDecisionData

public LaraDecisionData<A,BO> getDecisionData(LaraDecisionConfiguration dConfiguration)
Description copied from interface: LaraAgentComponent
Returns the LaraDecisionData object associated with the given LaraDecisionConfiguration. If the object does not exist, it is created. NOTE: The LDC parameter should not be bounded since it would require the LaraBehaviouralOption (which calls this method) to restricts its agent parameter's BO parameter.

Specified by:
getDecisionData in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
the decision data associated with the given decision builder.

getDecisionDataIterable

public Iterable<LaraDecisionData<A,BO>> getDecisionDataIterable()
Description copied from interface: LaraAgentComponent
Returns an iterator that iterates over all LaraDecisionDatas.

Specified by:
getDecisionDataIterable in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
the iterator
See Also:
LaraAgentComponent.getDecisionDataIterable()

getDeliberativeChoiceComp

public LaraDeliberativeChoiceComponent getDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration)
Description copied from interface: LaraAgentComponent
Returns the LaraDeliberativeChoiceComponent that shall be used for the given decision configuration.

Specified by:
getDeliberativeChoiceComp in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
See Also:
LaraAgentComponent.getDeliberativeChoiceComp(de.cesr.lara.components.decision.LaraDecisionConfiguration)

getDoubleProperty

public double getDoubleProperty(String name)
Specified by:
getDoubleProperty in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Parameters:
name - the property's name
Returns:
the double value of that property - NaN if property does not exist

getEnvironment

public LaraEnvironment getEnvironment()
Description copied from interface: LaraAgentComponent
Get the environment this agent belongs to by its type

Specified by:
getEnvironment in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
environment the agent is embedded in
See Also:
LaraAgentComponent.getEnvironment()

getGeneralMemory

public LaraMemory<LaraProperty<?,?>> getGeneralMemory()
Description copied from interface: LaraAgentComponent
Get the LaraMemory (for general properties) of this agent.

Specified by:
getGeneralMemory in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
agent's general property memory
See Also:
LaraAgentComponent.getGeneralMemory()

getNumDecisionDataObjects

public int getNumDecisionDataObjects()
Description copied from interface: LaraAgentComponent
The number of LaraDecisionData objects currently stored at the agent.

Specified by:
getNumDecisionDataObjects in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
the number of decision data objects
See Also:
LaraAgentComponent.getNumDecisionDataObjects()

getPreferenceWeight

public Double getPreferenceWeight(Class<? extends LaraPreference> preference)
Specified by:
getPreferenceWeight in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
agent's preference weight regarding the given preference

getPreferenceWeights

public Map<Class<? extends LaraPreference>,Double> getPreferenceWeights()
Specified by:
getPreferenceWeights in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Returns:
a map of the agents preferenceWeights
See Also:
LaraAgentComponent.getPreferenceWeights()

onInternalEvent

public void onInternalEvent(LaraEvent event)
LAgentPreprocessEvent: If no LaraPreprocessor was set, the default preprocessor is set now. However, it is recommended to use a global configurator before.

Specified by:
onInternalEvent in interface LaraInternalEventSubscriber
Type Parameters:
T -
Parameters:
event -

removeDecisionData

public void removeDecisionData(LaraDecisionConfiguration dConfiguration)
Description copied from interface: LaraAgentComponent
Removes the LaraDecisionData that is associated with the specified LaraDecisionConfiguration.

Specified by:
removeDecisionData in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
See Also:
LaraAgentComponent.removeDecisionData(de.cesr.lara.components.decision.LaraDecisionConfiguration)

setBOMemory

public void setBOMemory(LaraBOMemory<BO> boMemory)
Description copied from interface: LaraAgentComponent
Set the agent's behavioural options memory

Specified by:
setBOMemory in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Parameters:
boMemory - the new BO memory
See Also:
LaraAgentComponent.setBOMemory(de.cesr.lara.components.container.memory.LaraBOMemory)

setDeliberativeChoiceComp

public void setDeliberativeChoiceComp(LaraDecisionConfiguration dConfiguration,
                                      LaraDeliberativeChoiceComponent comp)
Description copied from interface: LaraAgentComponent
Sets the LaraDeliberativeChoiceComponent that shall be used for the given decision configuration. Note: if possible, use the same instance of the LaraDeliberativeChoiceComponent for all agents to save memory.

Specified by:
setDeliberativeChoiceComp in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
See Also:
LaraAgentComponent.setDeliberativeChoiceComp(de.cesr.lara.components.decision.LaraDecisionConfiguration, de.cesr.lara.components.decision.LaraDeliberativeChoiceComponent)

setDoubleProperty

public void setDoubleProperty(String name,
                              double value)
Specified by:
setDoubleProperty in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Parameters:
name - the name of existing or new property
value - the property's (new) value

setGeneralMemory

public void setGeneralMemory(LaraMemory<LaraProperty<?,?>> memory)
Description copied from interface: LaraAgentComponent
Set the agent's general property memory

Specified by:
setGeneralMemory in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
Parameters:
memory - agent's general property memory
See Also:
LaraAgentComponent.setGeneralMemory(LaraMemory)

setPostProcessor

public void setPostProcessor(LaraPostprocessorComp<A,BO> postprocesor)
Description copied from interface: LaraAgentComponent
Sets the post-processor component.

Specified by:
setPostProcessor in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
See Also:
LaraAgentComponent.setPostProcessor(de.cesr.lara.components.postprocessor.LaraPostprocessorComp)

setPreprocessor

public void setPreprocessor(LaraPreprocessor<A,BO> preprocessor)
Description copied from interface: LaraAgentComponent
Set the agent's pre-processor.

Specified by:
setPreprocessor in interface LaraAgentComponent<A extends LaraAgent<A,BO>,BO extends LaraBehaviouralOption<?,? extends BO>>
See Also:
LaraAgentComponent.setPreprocessor(de.cesr.lara.components.preprocessor.LaraPreprocessor)