Module agents :: Class AgentCoordinatedPatrolStrategy
[hide private]
[frames] | no frames]

Class AgentCoordinatedPatrolStrategy

source code


Implements a coordinated patrol strategy. Given points of interest, each agent runs heuristicDivide(), assign ships to locations, and transmits it. Agents vote and decide on suggestion, move to their initial locations, and start patroling.

Instance Methods [hide private]
 
__init__(self, agentIndex, patrolPoints, edgeLengths, rulesOfTheSea)
Initializes the strategy.
source code
 
reset(self)
Resets all coordinated-patrol related data members
source code
 
composeAction(self, agentWorldModel)
Given the (inferred) state of the world, decide on a set of actions.
source code
 
setNavigationTactic(self, agentWorldModel, nextGoal) source code
 
recordStatistics(self) source code
 
processIncomingMsgs(self, agentWorldModel)
Reads incoming msgs from the agentWorldModel and clean its queue
source code
map[shipIndex] = shipStartingState
assignShipsToStates(self, shipPositions, patrolStartingStates)
Implements a matching algorithm
source code
 
allReachedStartingPoints(self) source code
 
getPath(self) source code
 
processMsgStart(self, msgContent)
Processes a msg that notifies ships to start patrol
source code
 
processMsgPosition(self, msgContent)
Processes a msg that notifies other ship's position
source code
 
processMsgPatrolDivision(self, msgContent)
Processes a msg that notifies other ship's patrol suggestion
source code
 
processMsgReachedStart(self, msgContent)
Processes a msg that notifies some ship reached its start pos
source code

Inherited from AgentStrategy: getOutgoingMessage, transmit

Class Variables [hide private]
  TRANSMIT_INITIAL_LOCATION = 1
  COMPUTE_PATROL_ASSIGNMENTS_AND_TRANSMIT = 2
  VOTE = 3
  MOVING_TO_START = 4
  PATROLING = 5
Method Details [hide private]

__init__(self, agentIndex, patrolPoints, edgeLengths, rulesOfTheSea)
(Constructor)

source code 

Initializes the strategy.

Parameters:
  • agentIndex (int) - sort of an agent-id - an agent's index in the array of all agents
  • agentIndex (int) - the name of the file containing edges and nodes from measurements data
  • rulesOfTheSea (boolean) - Tells whether to respect the rules of the sea
Overrides: AgentStrategy.__init__

composeAction(self, agentWorldModel)

source code 

Given the (inferred) state of the world, decide on a set of actions.

Overrides: AgentStrategy.composeAction
(inherited documentation)

processIncomingMsgs(self, agentWorldModel)

source code 

Reads incoming msgs from the agentWorldModel and clean its queue

Parameters:
  • agentWorldModel (AgentWorldModel) - the world model, which contain msgs.

assignShipsToStates(self, shipPositions, patrolStartingStates)

source code 

Implements a matching algorithm

Parameters:
  • shipPositions (map[shipIndex] = (x,y) position) - map of the transmitted positions of ships
  • patrolStartingStates (array of [shipExternalState, ... ] for all ships) - the starting states computed by heuristicDivide
Returns: map[shipIndex] = shipStartingState
mapping of each ship to its patrol starting state

processMsgStart(self, msgContent)

source code 

Processes a msg that notifies ships to start patrol

Parameters:
  • msgContent (None) - no additional information currently needed

processMsgPosition(self, msgContent)

source code 

Processes a msg that notifies other ship's position

Parameters:
  • msgContent (a 3-tuple (shipIndex, x, y)) - the position of the sending ship

processMsgPatrolDivision(self, msgContent)

source code 

Processes a msg that notifies other ship's patrol suggestion

Parameters:
  • msgContent (map[int] = (pos, list-of-positions)) - for each ship, a starting position and a path

processMsgReachedStart(self, msgContent)

source code 

Processes a msg that notifies some ship reached its start pos

Parameters:
  • msgContent (int) - an index of an agent that reached start