Skip to content

gym-sapientino

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

test lint docs codecov

black

OpenAI Gym Sapientino environment using Pygame.

Description

The environment is inspired by a game for kids called Sapientino.

A robot moves on a gridworld-like environment, where each cell can be coloured. When a robot is on a coloured cell, it can run a beep, meaning it has visited the cell.

The environment is compliant with the OpenAI Gym APIs. The idea is that the designer of the experiment should implement the actual reward by wrapping the environment.

Dependencies

The environment is implemented using Pygame.

On Ubuntu, you need the following libraries:

sudo apt-get install python3-dev \
    libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \
    libsdl1.2-dev  libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libfreetype6-dev

On MacOS (not tested):

brew install sdl sdl_ttf sdl_image sdl_mixer portmidi  # brew or use equivalent means
conda install -c https://conda.binstar.org/quasiben pygame  # using Anaconda

Install

Install with pip:

pip install gym_sapientino

Or, install from source:

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
  • Create/activate the virtual environment:
poetry shell --python=python3.7
  • Install development dependencies:
poetry install

Tests

To run tests: tox

To run only the code tests: tox -e py3.7

To run only the linters: - tox -e flake8 - tox -e mypy - tox -e black-check - tox -e isort-check

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

Docs

To build the docs: mkdocs build

To view documentation in a browser: mkdocs serve and then go to http://localhost:8000

License

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

Copyright 2019-2020 Marco Favorito, 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}
}