-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from QuMuLab/amdn
AMDN
- Loading branch information
Showing
64 changed files
with
3,255 additions
and
756 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Usage | ||
|
||
```python | ||
from macq import generate, extract | ||
|
||
print(model.details()) | ||
``` | ||
|
||
**Output:** | ||
```text | ||
``` | ||
|
||
# API Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Usage | ||
|
||
```python | ||
from macq import generate, extract | ||
from macq.trace import PlanningObject, Fluent, TraceList | ||
from macq.observation import PartialObservation | ||
|
||
def get_fluent(name: str, objs: list[str]): | ||
objects = [PlanningObject(o.split()[0], o.split()[1]) for o in objs] | ||
return Fluent(name, objects) | ||
|
||
traces = TraceList() | ||
generator = generate.pddl.TraceFromGoal(problem_id=1801) | ||
|
||
generator.change_goal( | ||
{ | ||
get_fluent("communicated_soil_data", ["waypoint waypoint2"]), | ||
get_fluent("communicated_rock_data", ["waypoint waypoint3"]), | ||
get_fluent( | ||
"communicated_image_data", ["objective objective1", "mode high_res"] | ||
), | ||
} | ||
) | ||
traces.append(generator.generate_trace()) | ||
|
||
generator.change_goal( | ||
{ | ||
get_fluent("communicated_soil_data", ["waypoint waypoint2"]), | ||
get_fluent("communicated_rock_data", ["waypoint waypoint3"]), | ||
get_fluent( | ||
"communicated_image_data", ["objective objective1", "mode high_res"] | ||
), | ||
} | ||
) | ||
traces.append(generator.generate_trace()) | ||
|
||
observations = traces.tokenize(PartialObservation, percent_missing=0.60) | ||
model = extract.Extract( | ||
observations, | ||
extract.modes.ARMS, | ||
upper_bound=2, | ||
min_support=2, | ||
action_weight=110, | ||
info_weight=100, | ||
threshold=0.6, | ||
info3_default=30, | ||
plan_default=30, | ||
) | ||
|
||
print(model.details()) | ||
``` | ||
|
||
**Output:** | ||
```text | ||
Model: | ||
Fluents: (at rover rover0 waypoint waypoint2), (have_soil_analysis rover rover0 waypoint waypoint2), (have_soil_analysis rover rover0 waypoint waypoint3), ... | ||
Actions: | ||
(communicate_image_data rover waypoint mode objective lander waypoint): | ||
precond: | ||
calibrated camera rover | ||
have_rock_analysis rover waypoint | ||
communicated_rock_data waypoint | ||
channel_free lander | ||
at_soil_sample waypoint | ||
at_rock_sample waypoint | ||
add: | ||
calibrated camera rover | ||
at rover waypoint | ||
have_image rover objective mode | ||
channel_free lander | ||
communicated_image_data objective mode | ||
delete: | ||
calibrated camera rover | ||
... | ||
``` | ||
|
||
# API Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Usage | ||
|
||
## Debugging | ||
Include the argument `debug=True` to `Extract` to enable debugging for any | ||
extraction technique. | ||
|
||
*Note: debugging output and interfaces are unique to each method.* | ||
|
||
# API Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Usage | ||
|
||
```python | ||
from macq import generate, extract | ||
from macq.observation import IdentityObservation | ||
|
||
traces = generate.pddl.VanillaSampling(problem_id=123, plan_len=20, num_traces=100).traces | ||
observations = traces.tokenize(IdentityObservation) | ||
model = extract.Extract(observations, extract.modes.OBSERVER) | ||
|
||
print(model.details()) | ||
``` | ||
|
||
**Output:** | ||
```text | ||
Model: | ||
Fluents: at stone stone-03 location pos-04-06, at stone stone-01 location pos-04-06, at stone stone-02 location pos-05-06, at stone stone-06 location pos-07-04, at stone stone-11 ... | ||
Actions: | ||
push-to-goal stone stone-04 location pos-04-05 location pos-04-06 direction dir-up location pos-04-04 player player-01: | ||
precond: | ||
at player player-01 location pos-04-06 | ||
at stone stone-04 location pos-04-05 | ||
clear location pos-05-06 | ||
... | ||
add: | ||
at stone stone-04 location pos-04-04 | ||
clear location pos-04-06 | ||
at-goal stone stone-04 | ||
at player player-01 location pos-04-05 | ||
delete: | ||
at stone stone-04 location pos-04-05 | ||
clear location pos-04-04 | ||
at player player-01 location pos-04-06 | ||
... | ||
``` | ||
|
||
# API Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Usage | ||
|
||
```python | ||
from macq import generate, extract | ||
from macq.observation import AtomicPartialObservation | ||
|
||
traces = generate.pddl.VanillaSampling(problem_id=123, plan_len=2, num_traces=1).traces | ||
observations = traces.tokenize(AtomicPartialObservation, percent_missing=0.10) | ||
model = Extract(observations, extract.modes.SLAF) | ||
print(model.details()) | ||
``` | ||
|
||
**Output:** | ||
```text | ||
Model: | ||
Fluents: clear location pos-06-09, clear location pos-02-05, clear location pos-08-08, clear location pos-10-05, ... | ||
Actions: | ||
move player player-01 direction dir-left location pos-05-02 location pos-06-02: | ||
precond: | ||
add: | ||
delete: | ||
(clear location pos-05-02) | ||
(at player player-01 location pos-06-02) | ||
... | ||
... | ||
``` | ||
|
||
# API Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Usage Documentation | ||
|
||
## Trace Generation | ||
- [VanillaSampling](extract/observer/#usage) | ||
|
||
## Tokenization | ||
- [IdentityObservation](extract/observer#usage) | ||
- [AtomicPartialObservation](extract/slaf#usage) | ||
|
||
## Extraction Techniques | ||
- [Observer](extract/observer#usage) | ||
- [SLAF](extract/slaf#usage) | ||
- [ARMS](extract/arms#usage) | ||
- [AMDN](extract/amdn#usage) | ||
|
||
|
||
# API Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
""" | ||
.. include:: ../docs/index.md | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,15 @@ | ||
from .model import Model | ||
from .extract import Extract, modes, IncompatibleObservationToken, SLAF | ||
from .learned_fluent import LearnedFluent | ||
from .learned_action import LearnedAction | ||
from .model import Model, LearnedAction | ||
from .extract import Extract, modes | ||
from .exceptions import IncompatibleObservationToken | ||
from .model import Model | ||
|
||
__all__ = [ | ||
"LearnedAction", | ||
"LearnedFluent", | ||
"Model", | ||
"Extract", | ||
"modes", | ||
"IncompatibleObservationToken", | ||
"LearnedAction", | ||
"SLAF", | ||
"LearnedFluent", | ||
] | ||
] |
Oops, something went wrong.