Skip to main content

Numeric Safe Action Model Learning algorithm implementation in Python

Project description

Numeric Safe Action Model Learning Framework

SAM learning algorithm for numeric action model learning.

Installation

The following explains how to install the SAM-Learning framework. Notice, the code works on linux machines due to its dependencies on planners and validators that only work on linux machines.

Needed external tools:

  1. ENHSP solver - can be downloaded from here. 2. Note - for this code we require the binary code of the latest version of ENHSP (20 currently) with the jar file.
  2. Metric-FF planner - can be downloaded from here. In this algorithm, we use version 2.1 of Metric-FF which is the latest version.
  3. VAL validation algorithm - can be downloaded from here. Use the instructions given in the repository to install VAL.

Environment variables

  • 'METRIC_FF_DIRECTORY': Directory of the compiled metric-FF planner.
    • <path to containing directory>/Metric-FF-v2.1/
  • 'ENHSP_FILE_PATH': Path to the compiled ENHSP planner (the jar file).
    • <path to containing directory>/enhsp.jar
  • 'CONVEX_HULL_ERROR_PATH': Path to the file that will contain the errors raised from the convex hull algorithm. Used for future debugging purposes.
    • <path to containing directory>/convex_hull_error.txt
  • 'VALIDATOR_DIRECTORY': Directory containing VAL compiled code.
    • <path to containing directory>/VAL/

Code initialization

  • Clone the content of the repository from GitHub.
  • Install the dependencies using pip install -r requirements.txt.
  • Set the required environment variables.
  • Run the tests using pytest on the code to validate the installation.

Usage

To run the algorithm end-to-end there are three stages:

  1. trajectory creation.
  2. model learning.
  3. validation.

The first stage is the trajectory creation stage, which is independent of the latter stages. The second and third stages are dependent on the first stage since the process will not run without trajectories. The algorithm returns a safe action model that can be validated using the VAL algorithm.

  • Create a directory containing the domain file, the problems and, in case that the tested domain is numeric, a mapping file that contains a mapping of the preconditions to their respected fluents. For example - sattelite_fluents.json.
{
    "turn_to": ["(fuel ?s)", "(slew_time ?d_new ?d_prev)"],
    "switch_on": [],
    "switch_off": [],
    "calibrate": [],
    "take_image": ["(data_capacity ?s)", "(data ?d ?m)"]
}

License

This work is licensed under the MIT License.

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

n-sam-1.0.1.tar.gz (10.9 kB view details)

Uploaded Source

File details

Details for the file n-sam-1.0.1.tar.gz.

File metadata

  • Download URL: n-sam-1.0.1.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for n-sam-1.0.1.tar.gz
Algorithm Hash digest
SHA256 b31b3ebce7c2bf0996832b2b349f58856efc8232192f2bd31c5e94b09bd65269
MD5 a68e06e7ad2b42fbf709df28cda63260
BLAKE2b-256 4acc098f92a8e68ce97c0a1225348bdc620c732243ad090ee92729712085b866

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