AI-Planning / AI-Planning/pddl

Effects 'When' and 'ForAll' lack instantiate method

オープン
#180 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
177
フォーク
43
平均マージ
49分
マージ済み PR(30日)
1

説明

### Subject of the issue
The recent action instantiation feature (#158) is useful. However, the current implementation fails for actions with a `(forall ...)` effect.

```
'Forall' object has no attribute 'instantiate'
File "/home/jjewett/miniforge3/envs/skillet/lib/python3.11/site-packages/pddl/action.py", line 93, in instantiate
effect=self.effect.instantiate(instantiation) if self.effect else None,
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/jjewett/project/embodied-repair/conditional_repair/.dev/fastd.py", line 21, in
grounded = action.instantiate([obj])
^^^^^^^^^^^^^^^^^^^^^^^^^
```

This is because pddl.logic.effects.ForAll is treated as a Formula in action.effect, but does not implement `instantiate`.

```
>>> action.effect.__repr__
'Forall(frozenset({Variable(p)}), (friendly ?o ?p))'
```

### Your environment
- OS: Ubuntu 24.04
- Python version: 3.11.14
- Package Version 0.4.5

### Steps to reproduce
```
(define (domain hello-world)
(:requirements :typing :conditional-effects )
(:predicates
(hello-said)
(friendly ?o ?p)
)

; This action changes the state from not said to said
(:action say-hello
:parameters (?o)
:precondition (and )
:effect (and (forall (?p) (friendly ?o ?p)))
)
)

(define (problem hello-world-problem)
(:domain hello-world)
(:objects
o1 p1 p2 - object
)
(:init

)
(:goal (friendly o1 p1)
)
)
```

```
domain = DomainParser()(domain_str)
problem = ProblemParser()(problem_str)

obj = next(iter(problem.objects))
action = next(iter(domain.actions))
grounded = action.instantiate([obj])
```

### Expected behaviour

It should not error out. `ForAll` should instantiate its effect. `When` should instantiate its condition and effect.

### Actual behaviour
pddl.logic.effects.ForAll gives the error showed above.

pddl.logic.effects.When gives a similar error.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。