bounded-prescience
This repo contains code for the paper Shielding Atari Games with Bounded Prescience (https://arxiv.org/abs/2101.08153) by Mirco Giacobbe, Hosein Hasanbeig, Hjalmar Wijk and Daniel Kroening. In addition to replicating the experiments in the paper and the bounded prescience shield, the repo allows the creation of property-labelled versions of the standard Atari gym environments which can expose safety information for other agents and policies.
Installation
The prescience package needs to be installed through pip:
git clone https://github.com/HjalmarWijk/bounded-prescience.git
cd bounded-prescience
pip3 install .
or alternatively:
pip3 install git+https://github.com/HjalmarWijk/bounded-prescience.git
Properties
| Game | Property | Description | Classification |
|---|---|---|---|
| Alien | death | Losing a life | |
| Amidar | death | Losing a life | |
| Assault | death | Losing a life | |
| Assault | overheat | Losing a life from overheating | Shallow |
| Asterix | death | Losing a life | |
| Asteroids | death | Losing a life | |
| Atlantis | death | Losing a life | |
| BankHeist | death | Losing a life | |
| BankHeist | death | Losing a life | |
| BattleZone | death | Losing a life | |
| BeamRider | death | Losing a life | |
| Berzerk | death | Losing a life | |
| Berzerk | death | Losing a life | |
| Bowling | no-hit | Missing all pins | Minimal |
| Bowling | no-strike | Missing at least one pin | |
| Boxing | knock-out | Getting knocked out | Minimal |
| Boxing | lose | Losing the match | Minimal |
| Boxing | no-enemy-ko | Match ends without knocking out enemy | |
| Breakout | death | Losing a life | |
| Centipede | death | Losing a life | |
| CrazyClimber | death | Losing a life | |
| DemonAttack | death | Losing a life | |
| DemonAttack | death | Losing a life | |
| DemonAttack | death | Losing a life | |
| DoubleDunk | out-of-bounds | Moves out of bounds | Shallow |
| DoubleDunk | shoot-bf-clear | Losing ball due to shooting before clearing* | Shallow |
| Enduro | crash-car | Crashing into another car | |
| FishingDerby | lose | Not winning over the opponent | |
| Freeway | hit | Being hit by car | |
| Frostbite | death | Losing a life | |
| Frostbite | freezing | Losing a life from time running out | |
| Gopher | lose-carrot | Having a carrot eaten | |
| Gravitar | death | Losing a life | |
| Gravitar | fuel | Running out of fuel | Shallow |
| Hero | death | Losing a life | |
| IceHockey | enemy-score | Opponent scores | |
| Jamesbond | death | Losing a life |
* See manual for details on this game rule.
To test properties use the test_property.py script with flags --env [Game name] --prop [Property name]
This simulates a random agent and logs violations. To evaluate properties with human play, use --human flag (requires pygame).
Verification
To check properties for the 9 pre-trained agents evaluated in the paper under a variety of settings see the script check_noops.py To run the ChainerRL agents you first need to download them by running download_models.py (the Atari Zoo agents download dynamically). The scripts chainer_no_shield.sh and atari_zoo_no_shield.sh run all the agents for all propertiesm and write results as a csv in the results folder. Note that Atari Zoo agents need Tensorflow 1 (and AtariZoo) installed, while ChainerRL agents needs Tensorflow 2 and ChainerRL.
Shielding
To check properties using prescience shielding use the --lookahead flag for check_noops.py The shield scripts run this check for all algorithms, properties and shield depths up to 5.
Reference
Please use this bibtex entry if you want to cite this repository in your publication:
@misc{bounded_prescience_repo,
author = {Mirco Giacobbe, Mohammadhosein Hasanbeig, Daniel Kroening, and Hjalmar Wijk},
title = {Shielding Atari Games with Bounded Prescience Code Repository},
year = {2020},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/HjalmarWijk/bounded-prescience}},
}
License
This project is licensed under the terms of the BSD-3-Clause
Metadata
Release files for bounded-prescience 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| bounded-prescience-0.0.3.tar.gz | 13.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bounded_prescience-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.0 kB
Release files / bounded-prescience-0.0.3.tar.gz
| Download URL | bounded-prescience-0.0.3.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c488f40cae75ee44919f0ba001dcdfbd22501ac72597866624fb6d18c3e3ac3
|
|
BLAKE2b-256 checksum How to use checksums |
04d74e530a773d0aef3426da0bb51978a7c84f8698e96ab17df8dc021d4e080a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.6
|
Release files / bounded_prescience-0.0.3-py3-none-any.whl
| Download URL | bounded_prescience-0.0.3-py3-none-any.whl |
|---|---|
| Size | 21.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51792b7b57114375015bbe215b9daef9f0b9f1f20c06ab285a663487c2b9b404
|
|
BLAKE2b-256 checksum How to use checksums |
27a9ce7c36893c12444eda0195afd65e9cfe2650b8514a8167275695a7c7f11c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.7.6
|
Security for bounded-prescience 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.