Skip to content

Scripts

Christian Muise edited this page Apr 5, 2020 · 1 revision

Script Usage

There are two locations scripts related to PRP: (1) the src/ folder which contains scripts to run and validate PRP, and (2) the prp-scripts/ folder. Here, the scripts that are generally more useful are described in greater detail (for information on running PRP, see the usage page).


Translating Policies

  • Location: prp-scripts/translate_policy.py
  • Usage: python prp-scripts/translate_policy.py > human_policy.pol
  • Details: The translate script converts a PRP policy (output using the parameter --debug-output 2) into a human-readable format. The output is printed to standard out, and the above usage example will pipe the result into the human_policy.pol file. The way to interpret this output is as if it were a big if-then-else statement. Reading from top to bottom, the first partial state that matches the full state of the world is the item that should be executed. Included with the items are (1) the partial state that should match, (2) the action that should be executed, (3) the distance to the goal in the weak plan that generated this item, and (4) whether or not the item is strong cylic (meaning that the policy is guaranteed to be strong cyclic in any state matching the partial state).
  • Note: For now, this script must be run from the same directory as the policy.out and output files (i.e., the directory you ran the prp script from).

FOND Plan Validation

  • Location: prp-scripts/validator.py
  • Usage: python validator.py <domain> <problem> <solution> <interpreter>
  • Dependencies: The script requires the networkx package.
  • Details: The FOND validator simulations the reachable state space of the input domain, problem, and policy. Note that this can become very large very quickly for some problems. The parameter indicates what software generated the FOND plan (either 'prp' or 'grendel'), and the parameter corresponds to the output (for PRP it is the human_policy.pol, which can be generated as described above). If you would like to see another interpreter added, just let me know -- I would be glad to help get it up and running.

General Validator Script

  • Location: src/validate-prp
  • Usage: ./validate-prp <domain> <problem> [--keep-files]
  • Details: This script wraps the following items: (1) the invocation of PRP, (2) the translation of the output policy, (3) the validation of the generated plan, and (4) a graphviz dot file containing the reachable state space. If --keep-files is used, the intermediate files are retained.

A-B Testing Versions of PRP

  • Locaiton: prp-scripts/policy_experiment.py and prp-scripts/policy_analyze.py
  • Usage: python policy_experiment.py prp -domain all and python policy_analyze.py ab-compare -res1 <results directory> -res2 <results directory>
  • Details: When you run the policy_experiment.py, it will use PRP in it's default configuration and run over a standard set of FOND domains. Check prp-scripts/domains.py to see the different options. A directory RESULTS will be created, and you just need to rename it so that you can run another version of PRP to produce a second directory for comparison. This is primarily intended for checking if improvements made to the planner have any negative effect. Coverage, IPC time score, and IPC-like policy size score are provided.

Fault Tolerant Planning

  • Location: prp-scripts/fault-tolerant-conversion.py
  • Usage: python fault-tolerant-conversion.py
  • Details: Fault tolerant planning is a variation of non-deterministic planning where faulty outcomes will only occur a bounded number of times (see this paper for a nice description of the problem). The fault-tolerant-conversion script is an interactive interface to augment a FOND planning domain with fault tolerant info (e.g., marking outcomes as faulty, setting the maximum number of faults, etc). Once processed, the resulting domain can be saved locally. The encoding used does not require any modification to the problem files, but relies on conditional effects to update the number of faults. The options available in the menu system are as follows (added description in brackets):
  1. See the list of actions. (the names of all actions in the domain)
  2. Set the maximum number of faults. (this must be done before 3-4)
  3. Identify a faulty outcome. (interactively choose a single outcome)
  4. Make the domain 1-primary normative. (makes every outcome but one faulty for all actions)
  5. Show domain statistics.
  6. Print the domain.
  7. Save the domain.
  8. Reload the domain. (resets the domain to its original form)
  9. Quit.
Clone this wiki locally