Skip to content

static predicates of a domain are not in Step.State #210

@arashHaratian

Description

@arashHaratian

Hi,

I am working with the following files: dom_files.zip

I tried to get all the grounded predicates from a state, and just noticed that the static predicates (IS-GOAL, IS-NONGOAL, MOVE-DIR) are not in the state.

My code is as follow (I make a Generator and then I would read the IPC plan file. Lastly I create my own transition):

PATH = 'dom_files'

generator = Generator(f'{PATH}/domain.pddl', f'{PATH}/p01.pddl')
plan = generator.generate_plan(True, f'{PATH}/p01.plan')
trace = (generator.generate_single_trace_from_plan(plan))


# GENERATING TRANSITIONS FOR EACH ACTION NAME
transitions = {}  ## ACTION_NAME: [[PRE1, POST1], [PRE2, POST2], ...]
for time_step in range(len(trace)-1):
    current_action_name = trace[time_step].action.name
    current_state = trace[time_step].state
    next_state = trace[time_step + 1].state
    if current_action_name not in transitions.keys():
        transitions[current_action_name] = [[current_state, next_state]]
    else:
        transitions[current_action_name].append([current_state, next_state])

# GETTING ALL THE PREDICATE NAMES
pred_names = set()
pre, post = transitions['push-to-nongoal'][0]
for grounded_pred in pre:
    pred_names.add(grounded_pred.name)

print(pred_names)

Although I am new to MACQ, I am aware that I can make transitions using TraceList.tokenize(IdentityObservation).get_all_transitions(), but still the static predicates are not in the state. Also I searched the documentation and I found out about get_obs_static_fluents() but it just checks for the predicates that are already in the state.

Is there any step that I am missing?
Also is there anyway to read the p01.trajectory file directly?

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions