Git Product home page Git Product logo

gym-sapientino's Introduction

gym-sapientino

PyPI PyPI - Python Version PyPI - Status PyPI - Implementation PyPI - Wheel GitHub

test lint docs codecov

black

Description

This is a configurable Gynmasium environment that implements one or more agents moving in a plane. The software was originally inspired by a game for kids called Sapientino, but it has been extended in various ways.

Each agent moves on a 2D environment, where each cell can be coloured or blank. When a robot is on a coloured cell, it can execute a beep action, meaning it has visited the cell (this is meant to represent any interaction with the current location).

Features

The environment is compliant with the Gymnasium APIs.

Agents There can be one or more agents in the same map. Each agent has its own action space.

Actions There are three default action spaces. The first allows the agent to move in the four cardinal directions. The second requires the agent to rotate by 90°, then move in discrete steps. The third instead allows the agent to accellerate and decelerate both in the angular and linear coordinates. This last modality does not implement a grid-world environment. For these actions, and how to implement your own, you can see gym_sapientino/core/actions.py.

Observations The Sapientino class has a dictionary observation space that contains all the current information. For personalizing the observation space you can subclass the Features class in gym_sapientino/wrappers/observations.py. We provide discrete and continuous features wrappers.

Rewards It is possible to specify per-step rewards, but for general reward functions, the user should wrap this environment.

Map The map can be easily configured using ASCII strings. For example, combining

|P bB g |
| bp G r|
|G   pg |
| rpG PB|
|rP Bg b|

with ContinuousCommand generates:

continuous control gif

For a more complete documentation of how to use the environment, and the available options see this notebook.

Install

Install with pip:

pip install gym_sapientino

Or, for a more updated version, install from github:

git clone https://github.com/whitemech/gym-sapientino.git
cd gym-sapientino
pip install .

Development

  • Clone the repo:
git clone https://github.com/whitemech/gym-sapientino.git
cd gym-sapientino
  • Install Poetry
  • Optionally select the Python version:
poetry env use python3.9
  • Install with development dependencies:
poetry install

Tests

To run tests: tox

Please look at the tox.ini file for the full list of supported commands and tests.

License

gym-sapientino is released under the GNU General Public License v3.0 or later (GPLv3+).

Copyright 2019-2020 Marco Favorito, Roberto Cipollone, Luca Iocchi

Authors

Credits

The code is largely inspired by RLGames

If you want to use this environment in your research, please consider citing this conference paper:

@inproceedings{Giacomo2019FoundationsFR,
  title={Foundations for Restraining Bolts: Reinforcement Learning with LTLf/LDLf Restraining Specifications},
  author={Giuseppe De Giacomo and L. Iocchi and Marco Favorito and F. Patrizi},
  booktitle={ICAPS},
  year={2019}
}

gym-sapientino's People

Contributors

cipollone avatar marcofavorito avatar

Stargazers

 avatar

Watchers

 avatar  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.