massim.competition2007
Class GridSimulationAgent

java.lang.Object
  extended by massim.framework.simulation.AbstractSimulationAgent
      extended by massim.gridsimulations.SimulationAgentExtend
          extended by massim.competition2007.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.
 
Method Summary
 boolean canPush(GridSimulationWorldState simulationstate, java.lang.String nextAction, int x, int y)
          Test, if pushing possible
 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[] agentstates)
           
 InitialStickyPerception createInitialPerception(WorldState simstate, AgentState[] agentstates)
           
 Perception createPerception(WorldState simstate, AgentState[] agentstates)
           
 AgentState getAgentState()
          Retrieve agent state.
 void processAction(Action a, WorldState simstate, AgentState[] agentstates)
           
 void setAgentParameter(AgentParameter agentpar)
          Set agent creation parameter.
 void updateWorldState(WorldState simstate, SimulationAgent[] agents)
          take charge of agent's direction in world state. in the case, two or more agents wants to move in the same cell, only one of them can move in and the others will be set back to their old positions. in other words if the first agent wants to move to the cell, where another agent (also the second) stands. he will try to push the second agent away in a free cell .the push action can only success when the second agent does not want to perform a movement in his last simulation step and this simulation step(his actions can be "skip", "invalid" "pick", "drop", "mark", "unmark").
 
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.

Method Detail

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[] agentstates)

processAction

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

updateWorldState

public void updateWorldState(WorldState simstate,
                             SimulationAgent[] agents)
take charge of agent's direction in world state. in the case, two or more agents wants to move in the same cell, only one of them can move in and the others will be set back to their old positions. in other words if the first agent wants to move to the cell, where another agent (also the second) stands. he will try to push the second agent away in a free cell .the push action can only success when the second agent does not want to perform a movement in his last simulation step and this simulation step(his actions can be "skip", "invalid" "pick", "drop", "mark", "unmark"). when the first agent can not push the second. his action will be set as "skip"

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

canPush

public boolean canPush(GridSimulationWorldState simulationstate,
                       java.lang.String nextAction,
                       int x,
                       int y)
Test, if pushing possible

Parameters:
nextAction -
x -
y -
Returns:

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

createInitialPerception

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

createFinalPerception

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


Copyright © 2012. All Rights Reserved.