Code Monkey home page Code Monkey logo

federatedrl's Introduction

Federated Reinforcement Learning

We try to allow multiple reinforcement learning agents to learn optimal control policy on their own IoT devices of the same type but with slightly different dynamics. For such multiple IoT devices, there is no guarantee that an agent who interacts only with one IoT device and learns the optimal control policy will also control another IoT device well. Therefore, we may need to apply independent reinforcement learning to each IoT device individually, which requires a costly or time-consuming effort.

To solve this problem, we propose a new federated reinforcement learning architecture where each agent working on its independent IoT device shares their learning experience (i.e., the gradient of loss function) with each other, and transfers a mature policy model parameters into other agents. They accelerate its learning process by using mature parameters. We incorporate the Actor-Critic PPO algorithm into each agent in the proposed collaborative architecture and propose an efficient procedure for the gradient sharing and the model transfer.

We use Quanser's Qube-servo 2 as the real device. We also used CartPole from OpenAI Gym as the simulation environment.

Related Paper

  1. "Federated Reinforcement Learning for Training Control Policies on Multiple IoT Devices." Sensors 20, no. 5, 1359, 2020. (in English)
  2. "Learning Performance Improvement Using Federated Reinforcement Learning Based on Distributed Multi-Agents" in Proceedings of KICS Fall Conference 2019, November, Seoul, Korea, 2019. (in Korean)

Execute the Proposed Federated Reinforcement Learning in Simulation Environment

  • Set-up the hyper-parameter
    • modify main_constants.py in "rl_main" folder
      • ex) the number of workers, Whether or not to use the gradient sharing, Whether or not to use the transfer learning, and PPO's hyper-parameters
  • Execution
    • python main.py

Environment Configuration

1. Create Environment

2. OpenAI Gym Install

3. Package Install & requirements.txt Configuration

  • pip freeze > requirements.txt

4. Mosquitto Install

  • Mosquitto install

  • Execute the mosquitto service

    • For Mac
      • /usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.conf
    • For Linux
      • mosquitto
  • Test the subscribe

    • mosquitto_sub -h [address] -p [port] -t [topic]
    • mosquitto_sub -h 127.0.0.1 -p 1883 -t "topic"
  • Test the publication

    • mosquitto_pub -h [address] -p [port] -t [topic] -m [content]
    • mosquitto_pub -h 127.0.0.1 -p 1883 -t "topic" -m "test messgae"

5. Execution

  • Execute chief
    • python main_only_chief.py
  • Execute worker
    • python main_only_one_worker.py
  • Execute main for the test
    • OpenAI Gym CartPole
    • python main.py

Reference

federatedrl's People

Contributors

glenn89 avatar

Stargazers

Yuchen Wu avatar

Forkers

wozaimoyu

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.