Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Error unhashable type: \'list\'\n' when increasing action cost

86 views
Skip to first unread message

Yuchen Liu

unread,
Jun 29, 2022, 6:40:46 AM6/29/22
to Fast Downward
Hi everyone,

I'm trying to use Fast Downward planner (version 21.12+) to find a optimal plan by minimizing the action cost, where I increase the total-cost when performing a move action defined as follows:

(:action move
     :parameters (?r - robot ?z1 ?z2 - zone)
     :precondition (and
         (robot_at ?r ?z1)
         (connect ?z1 ?z2)
      )
     :effect (and
         (not(robot_at ?r ?z1))
         (robot_at ?r ?z2)
         (increase
             (total-cost)
             (+ (dynamic_cost ?z1 ?z2) (* (per_step_cost) (distance ?z1 ?z2))))
         )
)

where dynamic_cost, per_step_cost and distance are defined as functions in the domain file. And I got the following error when executing in command line:

$ ./fast-downward.py domain.pddl problem.pddl --search "astar(blind())"
INFO     planner time limit: None
INFO     planner memory limit: None

INFO     Running translator.
INFO     translator stdin: None
INFO     translator time limit: None
INFO     translator memory limit: None
INFO     translator command line string: /home/yuchen/anaconda3/envs/py38/bin/python3 /home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/translate.py domain.pddl problem.pddl --sas-file output.sas
Parsing...
b'Traceback (most recent call last):\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/translate.py", line 723, in <module>\n    main()\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/translate.py", line 681, in main\n    task = pddl_parser.open(\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/pddl_file.py", line 33, in open\n    return parsing_functions.parse_task(domain_pddl, task_pddl)\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 296, in parse_task\n    domain_name, domain_requirements, types, type_dict, constants, predicates, predicate_dict, functions, actions, axioms \\\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 389, in parse_domain_pddl\n    action = parse_action(entry, type_dict, predicate_dict)\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 272, in parse_action\n    cost = parse_effects(\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 142, in parse_effects\n    tmp_effect = parse_effect(alist, type_dict, predicate_dict)\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 195, in parse_effect\n    [parse_effect(eff, type_dict, predicate_dict) for eff in alist[1:]])\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 195, in <listcomp>\n    [parse_effect(eff, type_dict, predicate_dict) for eff in alist[1:]])\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 210, in parse_effect\n    assignment = parse_assignment(alist)\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 233, in parse_assignment\n    exp = parse_expression(alist[2])\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl_parser/parsing_functions.py", line 221, in parse_expression\n    return pddl.PrimitiveNumericExpression(functionsymbol, exp[1:])\n  File "/home/yuchen/Projects/gdq_py/downward/builds/release/bin/translate/pddl/f_expression.py", line 33, in __init__\n    self.hash = hash((self.__class__, self.symbol, self.args))\nTypeError: unhashable type: \'list\'\n'
translate exit code: 30

Driver aborting after translate
INFO     Planner time: 0.05s

What I've found is that this is possibly because of the action effect "increase", since when I tried some simple effect like:

(increase (total-cost) (distance ?z1 ?z2))

then the planner had no problem with it. And changing search configuration didn't help either.

I'm working on Ubuntu 20.04.4 LTS (64 bit), in a conda environment with Python 3.8, and Fast Downward version 21.12+

So I would like to know if it's allowed to perform multiple arithmetic operations (+ and *) in the "increase" action effect, or is it possible to declare this as a function somewhere else? Many thanks in advance!

Best,
Yuchen

Malte Helmert

unread,
Jun 29, 2022, 11:49:43 AM6/29/22
to fast-d...@googlegroups.com, Yuchen Liu
Dear Yuchen,

Fast Downward does not support the full numerical PDDL expression
syntax, only the fragment that is part of the ":action-costs"
requirement. I am sorry that the error message isn't better.

Here is the page on which the :action-costs syntax is formally introduced:

https://ipc08.icaps-conference.org/deterministic/PddlActionCosts.html

More informally, the only things that are supported for action costs are
increases by constants like this:

(increase (total-cost) 10)

or increases by static atomic numerical fluents like this example by you:

(increase (total-cost) (distance ?z1 ?z2))

Moreover, the action costs must be nonnegative integers.

Best regards,
Malte

On 29.06.22 12:38, Yuchen Liu wrote:
> Hi everyone,
>
> I'm trying to use Fast Downward planner (version 21.12+) to find a
> optimal plan by minimizing the action cost, where I increase the
> total-cost when performing a move action defined as follows:
>
> /(//:actionmove/
> /:parameters(?r- robot ?z1?z2- zone)/
> /:precondition(and/
> /         (robot_at ?r?z1)/
> /         (connect ?z1?z2)/
> /      )/
> /:effect(and/
> /         (not(robot_at ?r?z1))/
> /         (robot_at ?r?z2)/
> /         (increase/
> /             (total-cost)/
> /             (+(dynamic_cost ?z1?z2) (*(per_step_cost) (distance
> ?z1?z2))))/
> /         )/
> /)/
>
> where /dynamic_cost/, /per_step_cost/ and /distance/ are defined as
> /(increase (total-cost) (distance ?z1 ?z2))/
>
> then the planner had no problem with it. And changing search
> configuration didn't help either.
>
> I'm working on Ubuntu 20.04.4 LTS (64 bit), in a conda environment with
> Python 3.8, and Fast Downward version 21.12+
>
> So I would like to know if it's allowed to perform multiple arithmetic
> operations (+ and *) in the "increase" action effect, or is it possible
> to declare this as a function somewhere else? Many thanks in advance!
>
> Best,
> Yuchen
>
> --
> You received this message because you are subscribed to the Google
> Groups "Fast Downward" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fast-downwar...@googlegroups.com
> <mailto:fast-downwar...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fast-downward/548625fe-002b-444b-a211-d2ea3dbe1989n%40googlegroups.com
> <https://groups.google.com/d/msgid/fast-downward/548625fe-002b-444b-a211-d2ea3dbe1989n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Yuchen Liu

unread,
Jun 30, 2022, 7:32:54 AM6/30/22
to Fast Downward
Dear Malte,

Thanks very much for your detailed answer, it's now clear for me :)

Best regards
Yuchen
Reply all
Reply to author
Forward
0 new messages