Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert minecraft to non-numeric pddl #27

Open
wants to merge 32 commits into
base: numeric
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9f943d3
Convert move/pickup/drop actions to non-numeric
camall3n Nov 23, 2022
511344b
Add missing parameters & clean up long lines
camall3n Nov 26, 2022
b86baef
Change var name ?i -> ?b for block-related actions
camall3n Nov 26, 2022
c75fafd
Implement apply/craft actions
camall3n Nov 26, 2022
0f56df8
Clean up params for remaining actions
camall3n Nov 26, 2022
6d28ce0
Implement hit/destroy actions
camall3n Nov 26, 2022
f396117
Fix tabs/spaces issue
camall3n Dec 12, 2022
3b45dea
Add missing effects for moving east/west
camall3n Dec 12, 2022
8195457
Fix off-by-one issue in block-hitting skills (3 -> 2)
camall3n Dec 12, 2022
1477c4f
Remove 'REMOVE' comments
camall3n Dec 12, 2022
1a17b3c
Update destroy-block actions w.r.t. off-by-one issue (3 -> 2)
camall3n Dec 12, 2022
2986cef
Fix incorrect variable name
camall3n Dec 12, 2022
203f9da
Add missing agent-has-n-things preconditions
camall3n Dec 12, 2022
42c6a3f
Remove TODO comments
camall3n Dec 12, 2022
a2e3002
Fix incorrect variable name
camall3n Dec 13, 2022
f0e1ff1
Remove unused item-hits
camall3n Dec 13, 2022
a45350f
Account for both start & end colors during craft-bed action
camall3n Dec 13, 2022
d5e017f
Remove most numerics in problem file, add counts/positions/colors
camall3n Dec 13, 2022
6094c04
Remove unused item-hits
camall3n Dec 13, 2022
dad3d93
Remove unused binary operators
camall3n Dec 13, 2022
6b291e3
Fix variable names
camall3n Dec 13, 2022
5916ea1
Rename domain to avoid conflicts
camall3n Dec 13, 2022
b8ee30a
Remove :fluents requirement
camall3n Dec 13, 2022
d4ba2d3
Add missing predicate: neq
camall3n Dec 13, 2022
6b1434d
Fix 'not' literals to have valid syntax
camall3n Dec 13, 2022
3ee9d81
Fix 'exists' conditions involving multiple parameters
camall3n Dec 13, 2022
601c2b9
Fix incorrect parameter name x -> z
camall3n Dec 20, 2022
f24aef7
Fix color checking for craft-bed
camall3n Dec 20, 2022
93cd8d6
Remove initial position/color for non-present objects
camall3n Dec 20, 2022
99e08c6
Simplify domain slightly to satisfy FD translator
camall3n Dec 22, 2022
c81b5b7
Add pickling/loading of intermediate sas_task representation
camall3n Jan 4, 2023
7b1a42d
Add comment about where to add state constraints
camall3n Jan 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions oo_scoping/downward_translate/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ def parse_args():
argparser.add_argument(
"--scope",
default=False,
action='store_true',
help="Whether or not to run scoping (default: %(default)s)",
)
argparser.add_argument(
"--load",
default=False,
action='store_true',
help="Whether or not to load pickled sas_task (default: %(default)s)",
)
argparser.add_argument(
"--invariant-generation-max-time",
default=300,
Expand Down
52 changes: 38 additions & 14 deletions oo_scoping/downward_translate/translate_and_scope.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#! /usr/bin/env python3


from argparse import Namespace
import os
import pickle
import sys
import traceback
from typing import Iterable
Expand Down Expand Up @@ -759,22 +761,43 @@ def dump_statistics(sas_task):

def main():
timer = timers.Timer()
with timers.timing("Parsing", True):
task = pddl_parser.open(
domain_filename=options.domain, task_filename=options.task
)
if not options.load:
with timers.timing("Parsing", True):
task = pddl_parser.open(
domain_filename=options.domain, task_filename=options.task
)

with timers.timing("Normalizing task"):
normalize.normalize(task)

with timers.timing("Normalizing task"):
normalize.normalize(task)
if options.generate_relaxed_task:
# Remove delete effects.
for action in task.actions:
for index, effect in reversed(list(enumerate(action.effects))):
if effect.literal.negated:
del action.effects[index]

if options.generate_relaxed_task:
# Remove delete effects.
for action in task.actions:
for index, effect in reversed(list(enumerate(action.effects))):
if effect.literal.negated:
del action.effects[index]
sas_task = pddl_to_sas(task)

sas_task = pddl_to_sas(task)
remaining_options = Namespace(
scope = options.scope,
sas_file = options.sas_file,
sas_file_correct = options.sas_file_correct,
write_erfs = options.write_erfs,
)

with open('sas_task.pkl', 'wb') as file:
pickle.dump(sas_task, file)
with open('options.pkl', 'wb') as file:
pickle.dump(remaining_options, file)
print(f'Saved sas_task and options to pickle files.')
else:
with open('sas_task.pkl', 'rb') as file:
sas_task = pickle.load(file)
with open('options.pkl', 'rb') as file:
remaining_options = pickle.load(file)
options.copy_args_to_module(remaining_options)
print(f'Loaded sas_task and options from pickle files.')

dump_statistics(sas_task)

Expand All @@ -796,7 +819,8 @@ def main():
)
goal_cond = scoping_sas_parser.make_goal_cond(sas_task.goal.pairs, str2var_dict)
rel_pvars, cl_pvars, rel_skills = scope(
goals=goal_cond, skills=cae_triples, start_condition=init_cond_list
goals=goal_cond, skills=cae_triples, start_condition=init_cond_list,
# state_constraints= TODO,
)
sas_file_scoped = get_scoped_file_path(options.sas_file)

Expand Down
Loading