GithubHelp home page GithubHelp logo

gavin231mao / rl-for-sequential-assembly Goto Github PK

View Code? Open in Web Editor NEW

This project forked from b4be1/rl-for-sequential-assembly

0.0 0.0 0.0 13.84 MB

Scripts accompanying the paper "Reinforcement Learning for Sequential Assembly of SL-Blocks"

License: MIT License

Python 100.00%

rl-for-sequential-assembly's Introduction

Reinforcement Learning for Sequential Assembly of SL-Blocks

This repository contains Grasshopper files and Python scripts for running sequential assembly experiments from the paper "Reinforcement Learning for Sequential Assembly of SL-Blocks". Reinforcement learning library Stable-Baselines3 is used for training the agents, while the environments are implemented in Grasshopper โ€” an algorithmic modeling tool for Rhino.

Installation

Required Rhino/Grasshopper plugins can be downloaded from Food4Rhino and installed as described on their respective pages

  • Hoopsnake
  • Matrixtoolbox
  • Pufferfish
  • Treesloth
  • Yellow
  • Zebra

If the plugin Yellow is not available, file yellow.gha provided here in Grasshopper Files can be used as a substitute. As is common for all plugins, you may need to check the box "Unblock" in the file properties to prevent Windows from blocking it.

For a general description of the interface between Grasshopper and Stable-Baselines3, see Grasshopper Gym. It is recommended to use Anaconda to get a running Python installation under Windows.

Training and Evaluating Agents

The basic script train-and-eval.py provides the code for training and evaluating agents. To run the training, execute the command

python train-and-eval.py --algorithm="PPO" --save-path="DESIRED_PATH"

Here you need to specify the algorithm (either PPO or DQN) and the path where the model should be saved. Later, to evaluate the saved model, execute the command

python train-and-eval.py --algorithm="PPO" --load-path="DESIRED_PATH"

Before executing these commands, start the Hoopsnake loop inside the Grasshopper file Reinforcement Learning Interface.gh located in the Grasshopper Files directory. Parameters of the reinforcement learning algorithms can be adjusted directly in the train-and-eval.py script where DQN and PPO objects are created (lines 92โ€“102).

Experiments on 2D and 3D Curves

Python scripts for training DQN and PPO agents on the 2D and 3D curves described in the paper are provided in the folder Python Files with the parameters are already pre-specified. Detailed instructions on how to use those scripts and how to modify the Grasshopper environment in Reinforcement Learning Interface.gh can be found in the accompanying video Reinforcement Learning for Sequential Assembly of SL-Blocks in Grasshopper. Other algorithms used as baselines in the paper are implemented directly in Grasshopper in the file Evolutionary Algorithm and Greedy Algorithm for SL-Blocks.gh. Pre-trained weights for DQN and PPO agents are available in the directories DQN-Experiments and PPO-Experiments.

rl-for-sequential-assembly's People

Contributors

b4be1 avatar

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.