ANMLReader
- class unified_planning.io.ANMLReader(env: Environment | None = None)[source]
Bases:
objectClass that offers the capability, with the
parse_problem, to create aProblemfrom an ANML file.The assumptions made in order for this Reader to work are the followings:
statements containing the duration of an action are not mixed with other statements (
duration == 3 and at(l_from);).the action duration can be set with:
duration == expression;duration := expression;duration CT expression and duration CT expression, whereCTare Compare Tokens, so>,>=,<and<=.
All the other ways to define the duration of an Action are not supported.
Statements containing both conditions and effects are not supported (
(at(l_from) == true) := false);or(at(l_from) == true) and (at(l_from) := false);).Quantifier body does not support intervals, they can only be defined outside.
Forall over the assignments are not nested.
Only one effect can be specified in a forall over assignments.
No conditions can be specified ina forall over assignments, 2 different foralls must be specified.
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.