Package: bounded-prescience
bounded-prescienceThis 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.InstallationThe 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.gitPropertiesGamePropertyDescriptionClassificationAliendeathLosing a lifeAmidardeathLosing a lifeAssaultdeathLosing a lifeAssaultoverheatLosing a life from overheatingShallowAsterixdeathLosing a lifeAsteroidsdeathLosing a lifeAtlantisdeathLosing a lifeBankHeistdeathLosing a lifeBankHeistdeathLosing a lifeBattleZonedeathLosing a lifeBeamRiderdeathLosing a lifeBerzerkdeathLosing a lifeBerzerkdeathLosing a lifeBowlingno-hitMissing all pinsMinimalBowlingno-strikeMissing at least one pinBoxingknock-outGetting knocked outMinimalBoxingloseLosing the matchMinimalBoxingno-enemy-koMatch ends without knocking out enemyBreakoutdeathLosing a lifeCentipededeathLosing a lifeCrazyClimberdeathLosing a lifeDemonAttackdeathLosing a lifeDemonAttackdeathLosing a lifeDemonAttackdeathLosing a lifeDoubleDunkout-of-boundsMoves out of boundsShallowDoubleDunkshoot-bf-clearLosing ball due to shooting before clearing*ShallowEndurocrash-carCrashing into another carFishingDerbyloseNot winning over the opponentFreewayhitBeing hit by carFrostbitedeathLosing a lifeFrostbitefreezingLosing a life from time running outGopherlose-carrotHaving a carrot eatenGravitardeathLosing a lifeGravitarfuelRunning out of fuelShallowHerodeathLosing a lifeIceHockeyenemy-scoreOpponent scoresJamesbonddeathLosing a life* Seemanualfor 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).VerificationTo 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.ShieldingTo 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.ReferencePlease 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}},
}LicenseThis project is licensed under the terms of theBSD-3-Clause