Skip to content

Commit

Permalink
Merge pull request #505 from aiplan4eu/small-fixes
Browse files Browse the repository at this point in the history
Small improvements in command-line and ActionInstance creation
  • Loading branch information
alvalentini authored Oct 24, 2023
2 parents 12ae998 + ef69564 commit 4b06821
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion unified_planning/cmd/up.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def main(args=None):
show_supported_kind=parsed_args.show_kind,
)
else:
raise NotImplementedError
parser.print_help()


def oneshot_planning(
Expand Down
2 changes: 1 addition & 1 deletion unified_planning/io/pddl_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ def _write_problem(self, out: IO[str]):
pass
else:
out.write(f" (= {converter.convert(f)} {converter.convert(v)})")
if self.problem.kind.has_actions_cost():
if self.problem.kind.has_actions_cost() or self.problem.kind.has_plan_length():
out.write(f" (= (total-cost) 0)")
out.write(")\n")
goals_str: List[str] = []
Expand Down
6 changes: 5 additions & 1 deletion unified_planning/plans/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,17 @@ def __init__(
), "Typing not respected"
self._agent = agent
self._action = action
self._params = tuple(auto_promote(params))
self._params: Tuple["up.model.FNode", ...] = tuple(auto_promote(params))
assert len(action.parameters) == len(self._params)
for param, assigned_value in zip(action.parameters, self._params):
if not param.type.is_compatible(assigned_value.type):
raise UPTypeError(
f"Incompatible parameter type assignment. {assigned_value} can't be assigned to: {param}"
)
if not assigned_value.is_constant():
raise UPTypeError(
f"An ActionInstance parameter must be a constant: {assigned_value} is not."
)
assert motion_paths is None or isinstance(
motion_paths, dict
), "Typing not respected"
Expand Down

0 comments on commit 4b06821

Please sign in to comment.