Skip to main content

Shielding Atari Games with Bounded Prescience

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bounded-prescience-0.0.3.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

bounded_prescience-0.0.3-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file bounded-prescience-0.0.3.tar.gz.

File metadata

  • Download URL: bounded-prescience-0.0.3.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for bounded-prescience-0.0.3.tar.gz
Algorithm Hash digest
SHA256 5c488f40cae75ee44919f0ba001dcdfbd22501ac72597866624fb6d18c3e3ac3
MD5 69f3c86177419cd88118071433dff38e
BLAKE2b-256 04d74e530a773d0aef3426da0bb51978a7c84f8698e96ab17df8dc021d4e080a

See more details on using hashes here.

File details

Details for the file bounded_prescience-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: bounded_prescience-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for bounded_prescience-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 51792b7b57114375015bbe215b9daef9f0b9f1f20c06ab285a663487c2b9b404
MD5 51456d5910b65f8088898f6600a8a008
BLAKE2b-256 27a9ce7c36893c12444eda0195afd65e9cfe2650b8514a8167275695a7c7f11c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page