MAPDDLWriter

class unified_planning.io.MAPDDLWriter(problem: MultiAgentProblem, explicit_false_initial_states: bool | None = False, unfactored: bool | None = False, needs_requirements: bool = True, rewrite_bool_assignments: bool = False)[source]

Bases: object

This class can be used to write a MultiAgentProblem in MA-PDDL. The constructor of this class takes the problem to write and 4 flags:

  • explicit_false_initial_states determines if this writer includes initially false predicates in the problem :init,

  • unfactored when False this writer prints a domain and a problem for every agent, if True generates a single domain and a single problem,

  • needs_requirements determines if the printed problem must have the :requirements,

  • rewrite_bool_assignments determines if this writer will write non constant boolean assignment as conditional effects.

print_ma_domain_agent(agent_name)[source]

Prints to std output the MA-PDDL domain.

print_ma_problem_agent(agent_name)[source]

Prints to std output the MA-PDDL problem.

get_ma_domains() Dict[source]

Returns the MA-PDDL domains.

get_ma_domain_agent(agent_name) str[source]

Returns the MA-PDDL agent domain.

get_ma_problems() Dict[source]

Returns the MA-PDDL problems.

get_ma_problem_agent(agent_name) str[source]

Returns the MA-PDDL agent problem.

write_ma_domain(directory_name)[source]

Dumps to file the MA-PDDL domains.

write_ma_problem(directory_name)[source]

Dumps to file the MA-PDDL problems.

get_predicates_functions(obj: Agent | MAEnvironment, is_private: bool = False)[source]
get_item_named(name: str) Type | Action | Fluent | Object | Parameter | Variable | Agent | Method | Task[source]

Since MA-PDDL has a stricter set of possible naming compared to the unified_planning, when writing a Problem it is possible that some things must be renamed. This is why the MAPDDLWriter offers this method, that takes a MA-PDDL name and returns the original unified_planning data structure that corresponds to the MA-PDDL entity with the given name.

This method takes a name used in the MA-PDDL domain or MA-PDDL problem generated by this MAPDDLWriter and returns the original item in the unified_planning Problem.

Parameters:

name – The name used in the generated MA-PDDL.

Returns:

The unified_planning model entity corresponding to the given name.

get_ma_pddl_name(item: Type | Action | Fluent | Object | Parameter | Variable) str[source]

This method takes an item in the MultiAgentProblem and returns the chosen name for the same item in the MA-PDDL problem or MA-PDDL domain generated by this MAPDDLWriter.

Parameters:

item – The unified_planning entity renamed by this MAPDDLWriter.

Returns:

The MA-PDDL name of the given item.