Issue1249

Title EagerSearch: reinserting open nodes on cheaper paths (issue1140) creates pure duplicates for open lists that depend neither on g nor on the path
Priority bug Status chatting
Superseder Nosy List masataro
Assigned To Keywords
Optional summary
(this summary is initally rewitten by claude and then modified by me)

Since https://issues.fast-downward.org/issue1140 (e408c7d03, included in 24.06), EagerSearch re-inserts an open node into the open list every time a cheaper path to it is found.
This is necessary for A* and weighted A*. However, when the open list's keys depend on neither g nor the path,
the re-insert adds a pure duplicate entry and another round of evaluator calls, and gains nothing.

https://issues.fast-downward.org/msg11668 mentions the slowdown but did not investigate the cause.

I noticed this significant slowdown when I rebased my AAAI2026 O(1)MCTS paper on the newer version of FD.
O(1) MCTS uses eager search and its node insertion into a tree is much more expensive than on priority queues,
so it amplifies the effect.

Context

- Before 24.06: when g-value decreased on an open node, it was re-inserted only if reopen_closed=true. Otherwise only update_parent was called.
- Problem found in issue1140: with reopen_closed=false, A* with blind() does not return optimal plans. The open node kept the key of the original, more expensive path.
- issue1140's change: the is_open() branch of EagerSearch::step() now always inserts nodes.
- The same code is in the current main and in release-26.6.

Why this is wasteful for open lists that are g-independent and path-independent 

- eager_greedy (GBFS) with h-only keys reaches the re-insert path often. On plateaus, a shorter path to a node that is still open turns up all the time.
- The new entry has the same key, because g is not part of it. It is later popped, found closed and skipped.
- OpenList::insert first calls is_dead_end(eval_context), which evaluates every evaluator on a fresh EvaluationContext. (is it cached?)
- For alt([...]) lists, AlternationOpenList::do_insertion forwards the entry to every sublist. Each one gets a duplicate, and it may also affect boosting?

Reinsertion is meaningful only when

1. The key uses g. This is the A* case, for example sum([g, h]).
2. A heuristic h is path-dependent e.g. landmark heuristic.

Proposal

Skip the reinsertion only when neither condition holds. The parent and g-value are updated in every case.

1. Add virtual bool Evaluator::uses_g() const.
   - Evaluator::uses_g() returns false.
   - GEvaluator returns true.
   - Heuristic, ConstEvaluator, PrefEvaluator and the random evaluators return false.
   - Sum, max, weighted, deferred and plateau evaluators forward to their sub-evaluators.
2. Add virtual bool OpenList::uses_g() const. Each open list delegates to the sublists or the evaluator it uses.
3. Add an option reinsert_on_new_g = {auto, always, never} with default auto. It is resolved once in EagerSearch::initialize(), after the path-dependent evaluators have been collected:
   - auto: reinsert_on_new_g = !path_dependent_evaluators.empty() || open_list->uses_g()
   - always: today's behaviour.
   - never: the pre-24.06 behaviour, useful for reproducing old results.
   - up to debate whether this is necessary.

The option is orthogonal to reopen_closed, which concerns closed nodes.

Created on 2026-12-02.22:03:39 by masataro, last changed by masataro.

Summary
(this summary is initally rewitten by claude and then modified by me)

Since https://issues.fast-downward.org/issue1140 (e408c7d03, included in 24.06), EagerSearch re-inserts an open node into the open list every time a cheaper path to it is found.
This is necessary for A* and weighted A*. However, when the open list's keys depend on neither g nor the path,
the re-insert adds a pure duplicate entry and another round of evaluator calls, and gains nothing.

https://issues.fast-downward.org/msg11668 mentions the slowdown but did not investigate the cause.

I noticed this significant slowdown when I rebased my AAAI2026 O(1)MCTS paper on the newer version of FD.
O(1) MCTS uses eager search and its node insertion into a tree is much more expensive than on priority queues,
so it amplifies the effect.

Context

- Before 24.06: when g-value decreased on an open node, it was re-inserted only if reopen_closed=true. Otherwise only update_parent was called.
- Problem found in issue1140: with reopen_closed=false, A* with blind() does not return optimal plans. The open node kept the key of the original, more expensive path.
- issue1140's change: the is_open() branch of EagerSearch::step() now always inserts nodes.
- The same code is in the current main and in release-26.6.

Why this is wasteful for open lists that are g-independent and path-independent 

- eager_greedy (GBFS) with h-only keys reaches the re-insert path often. On plateaus, a shorter path to a node that is still open turns up all the time.
- The new entry has the same key, because g is not part of it. It is later popped, found closed and skipped.
- OpenList::insert first calls is_dead_end(eval_context), which evaluates every evaluator on a fresh EvaluationContext. (is it cached?)
- For alt([...]) lists, AlternationOpenList::do_insertion forwards the entry to every sublist. Each one gets a duplicate, and it may also affect boosting?

Reinsertion is meaningful only when

1. The key uses g. This is the A* case, for example sum([g, h]).
2. A heuristic h is path-dependent e.g. landmark heuristic.

Proposal

Skip the reinsertion only when neither condition holds. The parent and g-value are updated in every case.

1. Add virtual bool Evaluator::uses_g() const.
   - Evaluator::uses_g() returns false.
   - GEvaluator returns true.
   - Heuristic, ConstEvaluator, PrefEvaluator and the random evaluators return false.
   - Sum, max, weighted, deferred and plateau evaluators forward to their sub-evaluators.
2. Add virtual bool OpenList::uses_g() const. Each open list delegates to the sublists or the evaluator it uses.
3. Add an option reinsert_on_new_g = {auto, always, never} with default auto. It is resolved once in EagerSearch::initialize(), after the path-dependent evaluators have been collected:
   - auto: reinsert_on_new_g = !path_dependent_evaluators.empty() || open_list->uses_g()
   - always: today's behaviour.
   - never: the pre-24.06 behaviour, useful for reproducing old results.
   - up to debate whether this is necessary.

The option is orthogonal to reopen_closed, which concerns closed nodes.
Messages
msg12197 (view) Author: masataro Date: 2026-12-02.22:38:50
The bug from issue1140 shows up in 23.06.0 and not in 24.06.0 or the current main. I ran the issue's example.sas with eager(blind, reopen_closed=false). The optimal plan is b c e with cost 3.

  ┌───────────────────────────────────────┬───────────────────┬────────────────┐
  │                Version                │       Plan        │      Cost      │
  ├───────────────────────────────────────┼───────────────────┼────────────────┤
  │ 23.06.0 (release-23.06.0, 2023-07-31) │ b_0_1 d_1_3 f_3_4 │ 4 (suboptimal) │
  ├───────────────────────────────────────┼───────────────────┼────────────────┤
  │ 24.06.0 (release-24.06.0, 2024-10-10) │ b_0_1 c_1_2 e_2_4 │ 3 (optimal)    │
  ├───────────────────────────────────────┼───────────────────┼────────────────┤
  │ current main (00e3620, 2026-11-20)    │ b_0_1 c_1_2 e_2_4 │ 3 (optimal)    │
  ├───────────────────────────────────────┼───────────────────┼────────────────┤
  │ our branch, default (auto)            │ b_0_1 c_1_2 e_2_4 │ 3 (optimal)    │
  ├───────────────────────────────────────┼───────────────────┼────────────────┤
  │ our branch, reinsert_on_new_g=never   │ b_0_1 d_1_3 f_3_4 │ 4 (suboptimal) │
  └───────────────────────────────────────┴───────────────────┴────────────────┘

  - 23.06.0 gives the wrong plan the issue reports, [b, d, f].
  - The default `auto` resolves to reinsert here, because the open list contains g().
  - Our branch with `never` reproduces the 23.06 result.
msg12196 (view) Author: masataro Date: 2026-12-02.22:09:40
https://github.com/aibasel/downward/pull/322
History
Date User Action Args
2026-12-02 22:38:50masatarosetmessages: + msg12197
2026-12-02 22:09:40masatarosetmessages: + msg12196
nosy: + masataro
status: unread -> chatting
2026-12-02 22:03:39masatarocreate