ANMLReader

class unified_planning.io.ANMLReader(env: Environment | None = None)[source]

Bases: object

Class that offers the capability, with the parse_problem, to create a Problem from an ANML file.

The assumptions made in order for this Reader to work are the followings:

  1. statements containing the duration of an action are not mixed with other statements ( duration == 3 and at(l_from); ).

  2. the action duration can be set with:

    • duration == expression;

    • duration := expression;

    • duration CT expression and duration CT expression, where CT are Compare Tokens, so >, >=, < and <=.

    All the other ways to define the duration of an Action are not supported.

  3. Statements containing both conditions and effects are not supported ( (at(l_from) == true) := false); or (at(l_from) == true) and (at(l_from) := false); ).

  4. Quantifier body does not support intervals, they can only be defined outside.

  5. Forall over the assignments are not nested.

  6. Only one effect can be specified in a forall over assignments.

  7. No conditions can be specified ina forall over assignments, 2 different foralls must be specified.

  8. Conditional effects are not supported inside an expression block.

parse_problem(problem_filename: str | Sequence[str], problem_name: str | None = None) Problem[source]

Takes in input a filename containing an ANML problem and returns the parsed Problem.

Check the class documentation for the assumptions made for this parser to work.

Parameters:
  • problem_filename – The path to the file containing the ANML problem or to the files to concatenate to obtain the complete problem.

  • problem_name – Optionally, the name to give to the created problem; if it is None, problem_filename will be set as the problem name.

Returns:

The Problem parsed from the given anml file.

parse_problem_string(problem_str: str, problem_name: str | None = None) Problem[source]

Takes in input a string representing an ANML problem and returns the parsed Problem.

Check the class documentation for the assumptions made for this parser to work.

Parameters:
  • problem_str – The string representing the ANML problem.

  • problem_name – Optionally, the name to give to the created problem.

Returns:

The Problem parsed from the given anml file.