macq
MAcq: The Model Acquisition Toolkit
This library is a collection of tools for planning-like action model acquisition from state trace data. It contains a reimplementation from many existing works, and generalizes some of them to new settings.
Example Usage
from macq import generate, extract
from macq.observation import IdentityObservation, AtomicPartialObservation
# get a domain-specific generator: uses api.planning.domains problem_id/
# generate 100 traces of length 20 using vanilla sampling
traces = generate.pddl.VanillaSampling(problem_id = 123, plan_len = 20, num_traces = 100).traces
traces.generate_more(10)
action = traces[0][0].action
traces.get_usage(action)
# [0.05, 0.05, ..., 0.05]
trace = traces[0]
len(trace)
# 20
trace.fluents
trace.actions
trace.get_pre_states(action) # get the state before each occurance of action
trace.get_post_states(action) # state after each occurance of action
trace.get_total_cost()
Survey
You can find the full scope of papers considered in the survey (implemented and otherwise) at http://macq.planning.domains . This repository of model acquisition techniques will be added to over time.
Related Survey Papers
- A Review of Machine Learning for Automated Planning (see Fig 2)
- A Review of Learning Planning Action Models (see Tbl 3)
Citing this work
@inproceedings{macq-keps-2022,
author = {Ethan Callanan and Rebecca De Venezia and Victoria Armstrong and Alison Paredes and Tathagata Chakraborti and Christian Muise},
title = {MACQ: A Holistic View of Model Acquisition Techniques},
booktitle = {The ICAPS Workshop on Knowledge Engineering for Planning and Scheduling (KEPS)},
year = {2022}
}
General API
Trace Generation
These are the various methods implemented to generate the base trace data.
| Algorithm | Description |
|---|---|
| VanillaSampling | Samples actions uniformly at random |
| RandomGoalSampling | Samples goals by taking a random subset of a state reached after a random walk |
| FDRandomWalkSampling | Random walk based on a heuristic-driven depth calculation (algorithm introduced in the FD planning system) |
| TraceFromGoal | Generates a trace from a given domain/problem (with a goal state) |
| CSV | Reads a CSV file to generate a trace |
Tokenization
Once trace data is loaded, you can process the traces to produce lists of observations. The methods range from the identity observation (constaining the same data as original traces) to noisy and/or partially observable observations.
| Algorithm | Description |
|---|---|
| IdentityObservation | Unmodified versions of the input traces |
| PartialObservation | Observations with a subset of the fluents hidden in the states |
| AtomicPartialObservation | Similar to PartialObservation, except everything is stored as atomic strings (not fluents and parameters) |
| ActionObservation | Observations with only the actions listed (i.e., states discarded) |
| NoisyObservation | Observations with added noise to the fluents |
| NoisyPartialObservation | Observations with added noise to the fluents and a subset of the fluents hidden in the states |
| NoisyPartialDisorderedParallelObservation | Observations with added noise to the fluents and a subset of the fluents hidden in the states, with the actions disordered and parallelized |
Extraction Techniques
Depending on the observation type, different extraction techniques can be used to extract the relevant information from the observations. These are currently the techniques implemented:
| Algorithm | Trace Type | Paper |
|---|---|---|
| Observer | IdentityObservation | [1] |
| SLAF | AtomicPartialObservation | [1] |
| ARMS | PartialObservation | [1, 2] |
| AMDN | NoisyPartialDisorderedParallelObservation | [1] |
| LOCM | ActionObservation | [1, 2] |