Giter Club home page Giter Club logo

auto-shaping's Introduction

Logo

Specification-based library for automatic reward shaping.

License Python 3.10 Workflow Status Code style: black

⚠️ Disclaimer

This repository aims to provide a unified library for automatic reward shaping and reimplements the methods described in the table below. However, it is not meant to validate the results of the original papers.

If you are a reproducibility reviewer for HPRS, please refer to the original codebase.

Methods

Method Signal Soundness Dense Signal Multi-Objective Objective Prioritization Status
TLTL[1] ✔️ ✔️
BHNR[2] ✔️ ✔️
HPRS[4] ✔️ ✔️ ✔️ ✔️ ✔️
PAM[4] ✔️ ✔️ ✔️ ✔️
Rank-Preserving Reward[5] ✔️ ✔️ ✔️ ✔️

✔️ Supported

❌ Not supported

👷 Work in progress

Specification Language

The task specification consists of a set of requirements, as in [4]. The requirement syntax is as follows:

formula ::= f(state) ~ 0
requirement ::= ensure <formula> | achieve <formula> | conquer <formula> | encourage <formula>

where f is a function of the state dictionary state and ~ is a comparison operator in <, <=, >, >=.

Examples

To run the examples, ensure to install the extra requirements:

pip install -r examples/requirements.txt

Then, you can train an agent with stable-baselines3 and auto-shaping

  1. using default specifications from the configuration file in configs/
  2. using a custom specification by passing it as an argument
  3. benchmarking the agent with multiple reward shaping

Citation

If you use this code in your research, please cite the following paper:

@misc{berducci2022hierarchical,
    title={Hierarchical Potential-based Reward Shaping from Task Specifications}, 
    author={Luigi Berducci and Edgar A. Aguilar and Dejan Ničković and Radu Grosu},
    year={2022},
    eprint={2110.02792},
    archivePrefix={arXiv},
    primaryClass={cs.LG}
}

References

[1] "Reinforcement learning with temporal logic rewards." Li, et al. IROS 2017.

[2] "Structured reward shaping using signal temporal logic specifications." Balakrishnan, et al. IROS 2019.

[3] "Multi-objectivization of reinforcement learning problems by reward shaping." Brys, et al. IJCNN 2014.

[4] "Hierarchical Potential-based Reward Shaping." Berducci, et al. Under Review.

[5] "Receding Horizon Planning with Rule Hierarchies for Autonomous Vehicles." Veer, et al. ICRA 2023.

auto-shaping's People

Contributors

luigiberducci avatar

Watchers

 avatar

auto-shaping's Issues

benchmark of shaping methods on a set of environments

Benchmark of all the shaping methods in a set of standard environments

Environments:

  • Cartpole
    • ⬛ ⬛ ⬛ Default
    • ⬛ ⬛ ⬛ TLTL
    • ⬛ ⬛ ⬛ BHNR
    • ⬛ ⬛ ⬛ HPRS
  • Bipedal Walker
    • ⬛ ⬛ ⬛ Default
    • ⬛ ⬛ ⬛ TLTL
    • ⬛ ⬛ ⬛ BHNR
    • ⬛ ⬛ ⬛ HPRS
  • Bipedal Walker Hardcore
    • ⬛ ⬛ ⬛ Default
    • ⬛ ⬛ ⬛ TLTL
    • ⬛ ⬛ ⬛ BHNR
    • ⬛ ⬛ ⬛ HPRS
  • Lunar Lander
    • ⬛ ⬛ ⬛ Default
    • ⬛ ⬛ ⬛ TLTL
    • ⬛ ⬛ ⬛ BHNR
    • ⬛ ⬛ ⬛ HPRS

For each of them, use specifications from the HPRS paper.
Train for multiple seeds till convergence (k=3) and make the learning curves available on wandb.

examples

Examples:

  • how to use default configurations in standard environments
  • how to use a custom specification
  • how to train with RL libraries (sb3, omnisafe)

For each example, either create python script or jupyter notebook.
Comment code and explain it.

config file bipedal walker

Open issues:

  • How can we use in the reward spec variables that are not in the observed state? (e.g., x in bipedal walker)
  • How can we compactly specify collections of variables in the spec? (e.g., lidar = [l1, l2, ..., l10] in bipedal walker)

documentation

create basic documentation to explain the goal of the library, its methods, and how to use it.

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.