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

Class AgentWorldModel

source code



This class is a base class for all the models an agent
can have about the world.
A subclass should implement a specific model of the world,
and a specific way to process percepts for this model.
There can be multiple ways to process percepts for any
given model, so an example class hierarchy could be:
  
                -------------------
                | AgentWorldModel |
                -------------------
                    /                            ----------          ----------
              | Model1 |          | Model2 |
              ----------          ----------
              /       \                 \ 
-------------------  ------------------  .
|with method 1 to |  |with method 2 to|   .
|processPercepts  |  |processPercepts |    .
|for Model1       |  |for Model1      |
-------------------  ------------------

Instance Methods [hide private]
 
__init__(self)
Every world model contains a queue for incoming messages.
source code
 
processPercepts(self, perceptsList)
For a given concrete model, this method implements a specific method of updating this model from percepts.
source code
A list of ShipExternalState
getEstimatedStatesOfOtherShips(self, selfIndex)
Get a list of estimated ShipExternalState of all other ships in the system.
source code
A list of ShipExternalState
getEstimatedStatesOfShips(self, shipIndices)
Get a list of estimated ShipExternalState of all other ships indexed by shipIndices.
source code
ShipExternalState
getEstimatedExtShipState(self)
Get the estimated ShipExternalState as estimated by the world model.
source code
numpy array (vector)
getEstimatedWindVector(self)
Get the estimated wind vector in the location of the ship.
source code
numpy array (vector)
getEstimatedWaterVector(self)
Get the estimated water vector in the location of the ship.
source code
Obstacles
getEstimatedObstaclesList(self)
Get a list of estimated obstacle shapes.
source code
 
cleanMsgQueue(self) source code
 
receiveMsg(self, msg)
Append a message to the queue
source code
Method Details [hide private]

__init__(self)
(Constructor)

source code 

Every world model contains a queue for incoming messages. Note that outgoing msgs are inside strategy. TODO: does this design need change?

processPercepts(self, perceptsList)

source code 

For a given concrete model, this method implements a specific method of updating this model from percepts. This is just an extra layer of flexibility, in case there are multiple methods to update percepts for the same model.

Parameters:
  • perceptsList (PerceptList) - A list of percepts to be processed

getEstimatedStatesOfOtherShips(self, selfIndex)

source code 

Get a list of estimated ShipExternalState of all other ships in the system.

Parameters:
  • selfIndex (int) - The index of the ship controlled by the agent - we don't want to include it in the returned states.
Returns: A list of ShipExternalState
A list of estimated states of all other ships in the system

getEstimatedStatesOfShips(self, shipIndices)

source code 

Get a list of estimated ShipExternalState of all other ships indexed by shipIndices.

Parameters:
  • selfIndex (list[int]) - The indices of the ships for which location is estimated
Returns: A list of ShipExternalState
A list of estimated states of all other ships in the system

getEstimatedExtShipState(self)

source code 

Get the estimated ShipExternalState as estimated by the world model.

Returns: ShipExternalState
An estimation of the ship's real state according to our AgentWorldModel.

getEstimatedWindVector(self)

source code 

Get the estimated wind vector in the location of the ship.

Returns: numpy array (vector)
an estimation of the wind vector (speed and direction) in the agent's location according to our AgentWorldModel.

getEstimatedWaterVector(self)

source code 

Get the estimated water vector in the location of the ship.

Returns: numpy array (vector)
an estimation of the water vector (speed and direction) in the agent's location according to our AgentWorldModel.

getEstimatedObstaclesList(self)

source code 

Get a list of estimated obstacle shapes.

Returns: Obstacles
an estimation of the obstacles shapes (and positions) according to our AgentWorldModel.