Giter Site home page Giter Site logo

pyrddlgym-project / rddlrepository Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 1.0 26.94 MB

Hosts domain and instance RDDL files, covering problems from a wide range of disciplines, integration with the pyRDDLGym ecosystem.

Home Page: https://pyrddlgym.readthedocs.io/en/latest/rddlrepo.html

License: Other

Python 100.00%
benchmarks mdp rddl-domains planning rddl

rddlrepository's Introduction

rddlrepository

Purpose:

Contents

Installation

We require Python 3.8+ and numpy. To install via pip:

pip install rddlrepository

To install via github

git clone https://github.com/pyRDDLGym-project/rddlrepository.git

To make use of the existing visualizers, you also require pyRDDLGym (pip install pyRDDLGym).

Usage

Domains

The core object for extracting domains and their instances is the RDDLRepoManager object:

from rddlrepository.core.manager import RDDLRepoManager
manager = RDDLRepoManager(rebuild=True)

Note

rebuild instructs the manager to rebuild the manifest, which is an index containing the locations of all domains and instances for fast access. While you do not need this option in normal operation, in case you add your own domains or the manifest becomes corrupt, you can force it to be recreated.

To list all domains in rddlrepository:

print(manager.list_problems())

Problems are organized by context (e.g. year of the competition, standalone):

print(manager.list_context())
print(manager.list_problems_by_context("standalone"))   # list all standalone problems
print(manager.list_problems_by_context("ippc2018"))     # list all problems from IPPC 2018

Instances

The information for a specific domain is a ProblemInfo instance:

problem_info = manager.get_problem("EarthObservation_ippc2018")

To list all the instances of a domain:

print(problem_info.list_instances())

To return the paths of the domain and instance (1)

print(problem_info.get_domain())
print(problem_info.get_instance("1"))

To return the pyRDDLGym visualizer class:

viz_class = problem_info.get_visualizer()

Loading the Environment in pyRDDLGym

This information can be used in pyRDDLGym to instantiate an OpenAI Gym environment:

import pyRDDLGym
env = pyRDDLGym.make(domain=problem_info.get_domain(), instance=problem_info.get_instance("1"))
env.set_visualizer(problem_info.get_visualizer())

However, a shorter way is:

import pyRDDLGym
env = pyRDDLGym.make("EarthObservation_ippc2018", "1")

In either case, env is an instance of OpenAI Gym's Env class with the reset() and step() function already implemented for you!

Registering your Own Problems

To register a new context in rddlrepository for later access:

manager.register_context("MyContext")

To register a new problem in a given context for later access:

domain_content = """
    domain ... {
    ...
    }
"""
manager.register_domain("MyDomain", "MyContext", domain_content,
                        desc="a description of this domain", viz="ModuleName.ClassName") 

Here, "ModuleName.ClassName" refers to the Module name and the Class name of the visualizer (optional).

To register an instance for an existing domain for later access:

instance_content = """
    instance ... {
    ...
    }
"""
problem_info.register_instance("MyInstance", instance_content)

Domains Included

A downloadable PDF file listing all domains currently supported in rddlrepository can be found here.

Domains are broken down into contexts, which includes some standalone domains, as well as domains used in the past competitions:

rddlrepository's People

Contributors

ataitler avatar iliathesmirnov avatar mike-gimelfarb avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aimee-fu

rddlrepository's Issues

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.