env_client module¶

Client to play multi-armed bandits problem against. Many distribution of arms are supported, default to Bernoulli.


env_client.py [–markovian | –dynamic] [–port=<PORT>] [–host=<HOST>] [–speed=<SPEED>] <json_configuration> env_client.py (-h|–help) env_client.py –version


-h –help Show this screen. –version Show version. –markovian Whether to use a Markovian MAB problem (default is simple MAB problems). –dynamic Whether to use a Dynamic MAB problem (default is simple MAB problems). –port=<PORT> Port to use for the TCP connection [default: 10000]. –host=<HOST> Address to use for the TCP connection [default:]. –speed=<SPEED> Speed of emission, in milliseconds [default: 1000].

env_client.default_configuration = {'arm_type': 'Bernoulli', 'params': {(0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9)}}¶

Example of configuration to pass from the command line. '{"arm_type": "Bernoulli", "params": (0.1, 0.5, 0.9)}'


Return a valid configuration dictionary to initialize a MAB environment, from the input string.

env_client.send_message(sock, message)[source]¶

Send this message to the socket.

env_client.client(env, host, port, speed)[source]¶

Launch a client that:

  • uses sockets to listen to input and reply

  • create a MAB environment from a JSON configuration (exactly like main.py when it reads configuration.py)

  • then receives choice arm from the network, pass it to the MAB environment, listens to his reward = draw(arm) feedback, and sends this back to the network.


Like a safe exec() on a dictionary that can contain special values:

  • strings are interpreted as variables names (e.g., policy names) from the current globals() scope,

  • list are transformed to tuples to be constant and hashable,

  • dictionary are recursively transformed.


Take arguments, construct the learning policy and starts the server.