PoliciesMultiPlayers.CentralizedMultiplePlay module

CentralizedMultiplePlay: a multi-player policy where ONE policy is used by a centralized agent; asking the policy to select nbPlayers arms at each step.

class PoliciesMultiPlayers.CentralizedMultiplePlay.CentralizedChildPointer(mother, playerId)[source]

Bases: PoliciesMultiPlayers.ChildPointer.ChildPointer

Centralized version of the ChildPointer class.

__str__()[source]

Return str(self).

__repr__()[source]

Return repr(self).

__module__ = 'PoliciesMultiPlayers.CentralizedMultiplePlay'
class PoliciesMultiPlayers.CentralizedMultiplePlay.CentralizedMultiplePlay(nbPlayers, nbArms, playerAlgo, uniformAllocation=False, *args, **kwargs)[source]

Bases: PoliciesMultiPlayers.BaseMPPolicy.BaseMPPolicy

CentralizedMultiplePlay: a multi-player policy where ONE policy is used by a centralized agent; asking the policy to select nbPlayers arms at each step.

__init__(nbPlayers, nbArms, playerAlgo, uniformAllocation=False, *args, **kwargs)[source]
  • nbPlayers: number of players to create (in self._players).

  • playerAlgo: class to use for every players.

  • nbArms: number of arms, given as first argument to playerAlgo.

  • uniformAllocation: Should the affectations of users always be uniform, or fixed when UCB indexes have converged? First choice is more fair, but linear nb of switches, second choice is not fair, but cst nb of switches.

  • *args, **kwargs: arguments, named arguments, given to playerAlgo.

Examples:

>>> from Policies import *
>>> s = CentralizedMultiplePlay(2, 3, UCB)
>>> [ child.choice() for child in s.children ]
[2, 0]
  • To get a list of usable players, use s.children.

  • Warning: s._players is for internal use ONLY!

nbPlayers = None

Number of players

player = None

Only one policy

children = None

But nbPlayers children, fake algorithms

nbArms = None

Number of arms

uniformAllocation = None

Option: in case of multiplay plays, should the affectations of users always be uniform, or fixed when UCB indexes have converged? First choice is more fair, but linear nb of switches, second choice is not fair, but cst nb of switches

choices = None

Choices, given by first call to internal algorithm

affectation_order = None

Affectation of choices to players

__str__()[source]

Return str(self).

_startGame_one(playerId)[source]

Pass the call to the player algorithm.

_getReward_one(playerId, arm, reward)[source]

Pass the call to the player algorithm.

_choice_one(playerId)[source]

Use the player algorithm for the 1st decision, for each players, then use it.

_handleCollision_one(playerId, arm, reward=None)[source]

Cannot be called!

_estimatedOrder_one(playerId)[source]

Use the centralized algorithm to estimate ranking of the arms.

__module__ = 'PoliciesMultiPlayers.CentralizedMultiplePlay'