Example #1
0
File: SPAgent.py Project: fmgc/abss
 def setAction(self, action):
         
     if isinstance(action, ActRequest):
         self.__requestsMade.append(action.getTarget())
         
     Agent.setAction(self,action)
     
Example #2
0
File: SPAgent.py Project: fmgc/abss
 def __init__(self, public, goal):
     """
     SPAgent constructor.
     
     public is the initial SPAgentState
     goal is the goal SPAgentState
     """
     Agent.__init__(self)
     
     # the images of known agents
     self.__images = dict()
     
     # the known states of others
     self.__knownState = dict()
     
     # the requests this agent received from others
     self.__requestsReceived = dict()
     
     # the requests this agent made to others
     self.__requestsMade = list()	
     
     # the neighbors of this agent
     self.__neighbors = dict()
     
     # the public state
     self.__publicState = public
     
     # the goal state
     self.__goalState = goal
     
     # the last agent that made an intervention on this agent
     self.__deltaSource = None
     
     # the available actions to deliberation in this time-step
     self.__options = list()
     
     # control if it is necessary to update options
     self.__optionsAreDirty = True 
Example #3
0
File: SPAgent.py Project: fmgc/abss
 def processStimulus(self):
     Agent.processStimulus(self)
     
     stimulus = self.getStimulus()
     for k in stimulus.keys():
         source = stimulus[k].source
         currentState = stimulus[k].state         
         previousState = self.__neighbors[k]
         
         deltaValue = currentState.distanceTo(self.__goalState) - previousState.distanceTo(self.__goalState)
         
         self.__updateImage(source, deltaValue)
         self.__neighbors[k] = currentState
    
     self.__optionsAreDirty = True
     return {
     	'images': self.__images,
     	'neighbors': self.__neighbors,
     	'requestsReceived': self.__requestsReceived,
     	'requestsMade': self.__requestsMade,
     	'publicState': self.__publicState,
     	'goalState': self.__goalState,
     	'deltaSource': self.__deltaSource
     }