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

Class AgentTrackingPatrolStrategy

source code


Implements a basic patrol strategy. Given points of interest, just travel along the cycle they define

Instance Methods [hide private]
 
__init__(self, agentIndex, trackedShipIndices, trackingShipIndices, trackingDistance, positionOffsets, rulesOfTheSea)
Initializes the strategy.
source code
 
reset(self) source code
 
composeAction(self, agentWorldModel)
Implements the abstract method, see documentation of the abstract method.
source code
 
setNextPointAndNavigationTacticIfNeeded(self, agentWorldModel) source code
 
computeNextGoal(self, agentWorldModel)
Computes the next goal for the tracking strategy.
source code
 
computedAvgPosOfTrackedShips(self, agentWorldModel) source code
 
computedAvgPosOfTrackingShips(self, agentWorldModel) source code
 
setNavigationTactic(self, agentWorldModel, nextGoal) source code
 
getPath(self) source code
 
recordStatistics(self) source code
 
processIncomingMsgs(self, agentWorldModel)
Reads incoming msgs from the agentWorldModel and clean its queue
source code
 
processMsgTrackingPoint(self, msgContent)
Processes a msg that notifies the tracking point - avg location of tracked ships
source code
 
processMsgNavigationCentralPoint(self, msgContent)
Processes a msg that notifies the central navigation point - the point from which ship offsets are computed
source code
 
processMsgPositionAssignments(self, msgContent)
Processes a msg that notifies other ship's patrol suggestion
source code
map[shipIndex] = shipStartingState
assignShipsToStates(self, shipPositions, targets)
Implements a matching algorithm
source code
 
getTrackedShipLocations(self, agentWorldModel)
returns a list of x,y coordinates of tracked ships
source code
 
getTrackingShipLocations(self, agentWorldModel)
returns a list of x,y coordinates of tracking ships
source code
 
generateNewTargets(self, goal, trackingPoint)
Given the new goal and vector offsets - generate new targets.
source code

Inherited from AgentStrategy: getOutgoingMessage, transmit

Class Variables [hide private]
  TRANSMIT_LOCATION = 1
  COMPUTE_PATROL_ASSIGNMENTS_AND_TRANSMIT = 2
  VOTE_AND_SET_NAV_TARGET = 3
Method Details [hide private]

__init__(self, agentIndex, trackedShipIndices, trackingShipIndices, trackingDistance, positionOffsets, 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
  • trackedShipIndices (a list of integer indices) - a list of indices of tracked ships
  • trackingShipIndices (a list of integer indices) - a list of indices of tracking ships
  • trackingDistance (a floating point number) - a (close to) maximal distance for tracking/sensing
  • positionOffsets (a list of numpy 2d vectors) - offsets for all tracking ships
  • rulesOfTheSea (boolean) - Tells whether to respect the rules of the sea
Overrides: AgentStrategy.__init__

composeAction(self, agentWorldModel)

source code 

Implements the abstract method, see documentation of the abstract method.

Overrides: AgentStrategy.composeAction

processIncomingMsgs(self, agentWorldModel)

source code 

Reads incoming msgs from the agentWorldModel and clean its queue

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

processMsgTrackingPoint(self, msgContent)

source code 

Processes a msg that notifies the tracking point - avg location of tracked ships

Parameters:
  • msgContent (a tuple (int, numpy.array[(x,y)])) - (suggestingShipIndex, suggestedTrackingPoint)

processMsgNavigationCentralPoint(self, msgContent)

source code 

Processes a msg that notifies the central navigation point - the point from which ship offsets are computed

Parameters:
  • msgContent (a tuple (int, numpy.array[(x,y)])) - (suggestingShipIndex, suggestedNavigationPoint)

processMsgPositionAssignments(self, msgContent)

source code 

Processes a msg that notifies other ship's patrol suggestion

Parameters:
  • msgContent (map[int] = (pos)) - for each ship, a target position

assignShipsToStates(self, shipPositions, targets)

source code 

Implements a matching algorithm

Parameters:
  • shipPositions (map[shipIndex] = (x,y) position) - map of the transmitted positions of ships
  • targets (array of [(x,y), ... ] for all ships) - the target locations for tracking
Returns: map[shipIndex] = shipStartingState
mapping of each ship to its patrol starting state