massim.competition2009
Class GridSimulationAgent

java.lang.Object
  extended by massim.framework.simulation.AbstractSimulationAgent
      extended by massim.gridsimulations.SimulationAgentExtend
          extended by massim.competition2009.GridSimulationAgent
All Implemented Interfaces:
SimulationAgent

public class GridSimulationAgent
extends SimulationAgentExtend

This class deals with the agent state, his actions and perceptions.


Constructor Summary
GridSimulationAgent()
          The constructor instantiates the agentstate und the action
 
Method Summary
 int computeProbability(int fap, int mfap, int mng, int ng)
          This method computes for each agent his probabilty of action failure
 FinalPerception createFinalPerception(WorldState simstate, AgentState[] as)
           
 InitialStickyPerception createInitialPerception(WorldState simstate, AgentState[] as)
           
 Perception createPerception(WorldState simstate, AgentState[] as)
           
 GridSimulationAgentAction getAction()
          Get the current action of this agent
 AgentState getAgentState()
          Retrieve agent state.
 void processAction(Action a, WorldState simstate, AgentState[] agentstates)
           
 void setAction(Action newAction)
          Set the new action for this agent
 void setAction(java.lang.String action)
          Set the new action for this agent
 void setAgentParameter(AgentParameter agentpar)
          Set agent creation parameter.
 void setGrid(WorldState simstate)
          Set the GridSimulationWorldState
 void updateWorldState(WorldState simstate, SimulationAgent[] agents)
          take charge of agent's positions in world state.
 
Methods inherited from class massim.gridsimulations.SimulationAgentExtend
moveAction
 
Methods inherited from class massim.framework.simulation.AbstractSimulationAgent
getAgent, setAgent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GridSimulationAgent

public GridSimulationAgent()
The constructor instantiates the agentstate und the action

Method Detail

setGrid

public void setGrid(WorldState simstate)
Set the GridSimulationWorldState

Parameters:
simstate -

setAction

public void setAction(Action newAction)
Set the new action for this agent

Parameters:
action - Action

setAction

public void setAction(java.lang.String action)
Set the new action for this agent

Parameters:
action - Action as string

getAction

public GridSimulationAgentAction getAction()
Get the current action of this agent

Returns:
action GridSimulationAgentAction

getAgentState

public AgentState getAgentState()
Description copied from interface: SimulationAgent
Retrieve agent state.

Returns:
corresponding agent state.

setAgentParameter

public void setAgentParameter(AgentParameter agentpar)
Description copied from interface: SimulationAgent
Set agent creation parameter. Implementating this method is useful to know what exact properties this agent might have.

Specified by:
setAgentParameter in interface SimulationAgent
Overrides:
setAgentParameter in class AbstractSimulationAgent
Parameters:
agentpar - agent parameters to use

createPerception

public Perception createPerception(WorldState simstate,
                                   AgentState[] as)

processAction

public void processAction(Action a,
                          WorldState simstate,
                          AgentState[] agentstates)

updateWorldState

public void updateWorldState(WorldState simstate,
                             SimulationAgent[] agents)
take charge of agent's positions in world state. in the case, two or more agents want to move in the same cell, only one of them can move in the others will be set back to their old positions.

Specified by:
updateWorldState in class SimulationAgentExtend
Parameters:
simstate - is the WorldState

createInitialPerception

public InitialStickyPerception createInitialPerception(WorldState simstate,
                                                       AgentState[] as)

createFinalPerception

public FinalPerception createFinalPerception(WorldState simstate,
                                             AgentState[] as)

computeProbability

public int computeProbability(int fap,
                              int mfap,
                              int mng,
                              int ng)
This method computes for each agent his probabilty of action failure

Parameters:
fap - failureActionProbability
mfap - maxFailureActionProbability
mng - maxNumberOfGoldItems
ng - numberOfGoldItems (current)
Returns:
value of probability


Copyright © 2012. All Rights Reserved.