class
PddlDomainManages the information from the PDDL domain and task definition.
Methods
- def _parse_actions(self, domain_def) -> None
- Fetches the PDDL actions into self.actions
- def _parse_constants(self, domain_def) -> None
- Fetches the constants into self._constants.
- def _parse_expr(self, load_d, existing_entities: typing.Dict[str, rearrange_pddl.PddlEntity]) -> typing.Union[pddl_logical_expr.LogicalExpr, pddl_predicate.Predicate]
- Similar to self.parse_predicate for logical expressions. If load_d is a string, it will be parsed as a predicate.
- def _parse_expr_types(self, domain_def)
- Fetches the types from the domain into self._expr_types.
- def _parse_predicates(self, domain_def) -> None
- Fetches the PDDL predicates into self.predicates.
- def apply_action(self, action: pddl_action.PddlAction) -> None
- Helper to apply an action with the simulator info.
- def bind_actions(self) -> None
- Expand all quantifiers in the actions. This should be done per instance bind in case the typing changes.
- def bind_to_instance(self, sim: rearrange_sim.RearrangeSim, env: rearrange_task.RearrangeTask) -> None
- Attach the domain to the simulator. This does not bind any entity values, but creates self._sim_info which is needed to check simulator backed values (like truth values of predicates).
- def expand_quantifiers(self, expr: pddl_logical_expr.LogicalExpr) -> typing.Tuple[pddl_logical_expr.LogicalExpr, typing.List[typing.Dict[rearrange_pddl.PddlEntity, rearrange_pddl.PddlEntity]]]
- def find_entities(self, entity_type: rearrange_pddl.ExprType) -> typing.Iterable[rearrange_pddl.PddlEntity]
- Returns all the entities that match the condition.
- def get_entity(self, k: str) -> rearrange_pddl.PddlEntity
- Gets an entity from the all_entities dictionary by key name.
- def get_ordered_actions(self) -> typing.List[pddl_action.PddlAction]
- Gets an ordered list of all possible PDDL actions in the environment based on the entities in the environment. Note that this is different from the agent actions. These are the PDDL actions as defined in the domain file.
- def get_ordered_entities_list(self) -> typing.List[rearrange_pddl.PddlEntity]
- Gets all entities sorted alphabetically by name.
- def get_possible_actions(self, filter_entities: typing.Optional[typing.List[rearrange_pddl.PddlEntity]] = None, allowed_action_names: typing.Optional[typing.List[str]] = None, restricted_action_names: typing.Optional[typing.List[str]] = None, true_preds: typing.Optional[typing.List[pddl_predicate.Predicate]] = None) -> typing.List[pddl_action.PddlAction]
- def get_possible_predicates(self) -> typing.List[pddl_predicate.Predicate]
- Get all predicates that COULD be true. This is independent of the simulator state and is the set of compatible predicate and entity arguments. The same ordering of predicates is returned every time.
- def get_true_predicates(self) -> typing.List[pddl_predicate.Predicate]
- Get all the predicates that are true in the current simulator state.
- def is_expr_true(self, expr: pddl_logical_expr.LogicalExpr) -> bool
- Helper to check expression truth value from simulator info.
- def parse_only_logical_expr(self, load_d: typing.Dict[str, typing.Any], existing_entities: typing.Dict[str, rearrange_pddl.PddlEntity]) -> pddl_logical_expr.LogicalExpr
- Parse a dict config into a LogicalExpr. Will only populate the LogicalExpr with the entities from existing_entities.
- def parse_predicate(self, pred_str: str, existing_entities: typing.Optional[typing.Dict[str, rearrange_pddl.PddlEntity]] = None) -> pddl_predicate.Predicate
- def register_episode_entity(self, pddl_entity: rearrange_pddl.PddlEntity) -> None
- Add an entity to appear in self.all_entities. Clears every episode. Note that pddl_entity.name should be unique. Otherwise, it will overide the existing object with that name.
- def register_type(self, expr_type: rearrange_pddl.ExprType)
- Add a type to self.expr_types. Clears every episode
- def set_actions(self, actions: typing.Dict[str, pddl_action.PddlAction]) -> None
Special methods
- def __init__(self, domain_file_path: str, cur_task_config: typing.Optional[DictConfig] = None, read_config: bool = True)
Properties
- actions: typing.Dict[str, pddl_action.PddlAction] get
- all_entities: typing.Dict[str, rearrange_pddl.PddlEntity] get
- expr_types: typing.Dict[str, rearrange_pddl.ExprType] get
- Mapping from the name of the type to the ExprType definition.
- sim_info: rearrange_pddl.PddlSimInfo get
- Info from the simulator instance needed to interface the planning domain with the simulator. This property is used for all calls in the PDDL code that must interface with the simulator.