Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
multiple_virtual_envs Refresh target net Dec 2, 2018
simple_virtual_env Readme and documentation Nov 28, 2018
LICENSE Initial commit Nov 22, 2018 add Bibtex citing to README Dec 4, 2018
requirements.txt Requirements.txt Nov 29, 2018



Here you can find two simple examples of server-client reinforcement learning.

  • simple_virtual_env shows how to start environment on server and use it by making HTTP requests
  • multiple_virtual_envs shows how to start more then one environment and use them



pyramid - Framework for simple HTTP server creation

gym - OpenAI framework with base environments. Here just for example

numpy - Mathematics framework


torch - See for details

torchvision - See for details

requests - Framework for making HTTP requests

numpy - Mathematics framework


  1. Install dependencies
  2. Start server by running python
  3. Start client by running python

By default server and client assumes that host is localhost and port is 1800.

You can pass specific host by using key --host and port by using --port.

Additionally in multiple_virtual_envs example you can pass count of virtal (client) and real (server) environments running by using --count. Remember that count of virtual and real environments should be the same. Also you can pass episodes per explorer count by using --episodes.


One virtual environments example

Server starts one HTTP server that running real environment and handle requests.


Code in is basic pytorch example copied from here. The only difference is that we use virtual environment instead real.

Multiple virtual environments example

Server now creates multiple servers and starts it in separated processes.

Client runs three different types of processes:

  1. Training worker handles replays and updates DQN network
  2. Model worker generates actions by observations using specific agent
  3. Exploration workers sends actions to environments and receives observations and rewards


This is only description of the files contents. Please, see code for details.

  • model directory contains everything that connected with DQN and agents
    • model/ file contains model_worker function and DQN wrappers which provide Actor.act(observation) interface
    • model/ - simple DQN implementation
  • workers directory contains all workers except model_worker
    • workers/ file contains DQN trainer. It consumes replays from the replay queue and optimizes DQN parameters
    • workers/ file contains HTTP server worker which runs real CartPole environment and resolves requests
    • workers/ contains worker that receives observations and rewards from environment, puts translation to the replay queue and makes next action which given by agent
    • workers/ - virtual environment which provides interface similar to real environment but instead making calculations itself makes HTTP request to corresponding real environment on server

Citing this framework:

  author       = {Ivan Sosin and
                  Oleg Svidchenko and
                  Aleksandra Malysheva and
                  Daniel Kudenko and
                  Aleksei Shpilman},
  title        = {{Framework for Deep Reinforcement Learning with 
                   GPU-CPU Multiprocessing}},
  month        = dec,
  year         = 2018,
  doi          = {10.5281/zenodo.1938263},
  url          = {}


You can’t perform that action at this time.