PoliciesMultiPlayers.CentralizedCycling module¶
CentralizedCycling: a multi-player policy which uses a centralized intelligence to affect users an offset, each one take an orthogonal arm based on (offset + t) % nbArms.
It allows to have absolutely no collision, if there is more channels than users (always assumed).
And it is perfectly fair on every run: each chosen arm is played successively by each player.
Note that it is NOT affecting players on the best arms: it has no knowledge of the means of the arms, only of the number of arms nbArms.
-
class
PoliciesMultiPlayers.CentralizedCycling.
Cycling
(nbArms, offset)[source]¶ Bases:
PoliciesMultiPlayers.BaseCentralizedPolicy.BaseCentralizedPolicy
Cycling: select an arm as (offset + t) % nbArms, with offset being decided by the CentralizedCycling multi-player policy.
-
nbArms
= None¶ Number of arms
-
offset
= None¶ Offset
-
t
= None¶ Internal time
-
__module__
= 'PoliciesMultiPlayers.CentralizedCycling'¶
-
-
class
PoliciesMultiPlayers.CentralizedCycling.
CentralizedCycling
(nbPlayers, nbArms, lower=0.0, amplitude=1.0)[source]¶ Bases:
PoliciesMultiPlayers.BaseMPPolicy.BaseMPPolicy
CentralizedCycling: a multi-player policy which uses a centralize intelligence to affect users an offset, each one take an orthogonal arm based on (offset + t) % nbArms.
-
__init__
(nbPlayers, nbArms, lower=0.0, amplitude=1.0)[source]¶ nbPlayers: number of players to create (in self._players).
nbArms: number of arms.
Examples:
>>> import random; random.seed(0); import numpy as np; np.random.seed(0) >>> s = CentralizedCycling(2, 3) >>> [ child.choice() for child in s.children ] [2, 1] >>> [ child.choice() for child in s.children ] [0, 2] >>> [ child.choice() for child in s.children ] [1, 0] >>> [ child.choice() for child in s.children ] [2, 1]
To get a list of usable players, use
s.children
.Warning:
s._players
is for internal use
-
nbPlayers
= None¶ Number of players
-
nbArms
= None¶ Number of arms
-
children
= None¶ List of children, fake algorithms
-
__module__
= 'PoliciesMultiPlayers.CentralizedCycling'¶
-