Skip to content

fix: use only finished points of ArchiveAsync in stagnation terminators - #393

Merged
be-marc merged 1 commit into
mainfrom
fix/stagnation-async
Oct 27, 2026
Merged

be-marc merged 1 commit into
mainfrom
fix/stagnation-async

Conversation

@be-marc

@be-marc be-marc commented Oct 27, 2026

Copy link
Copy Markdown
Member

Fixes #392

Summary

TerminatorStagnation and TerminatorStagnationHypervolume read archive$data. For an ArchiveAsync this includes queued and running points with NA targets, so $is_terminated() returned NA and the workers crashed with missing value where TRUE/FALSE needed. The minimum-size check also used n_evals, which counts failed points.

Both terminators now use archive$finished_data for async archives and compare its row count against iters. Batch archives are unchanged.

Verification

New redis-backed tests push finished and queued points into an ArchiveAsync and check that only finished points count.

library(bbotk)
mirai::daemons(2)
rush::rush_plan(n_workers = 2, worker_type = "mirai")
objective = ObjectiveRFun$new(
  fun = function(xs) { Sys.sleep(0.2); list(y = -as.numeric(Sys.time())) },
  domain = ps(x = p_dbl(0, 1)),
  codomain = ps(y = p_dbl(tags = "minimize"))
)
instance = oi_async(objective,
  terminator = trm("combo", list(trm("evals", n_evals = 30), trm("stagnation", iters = 5))))
opt("async_random_search")$optimize(instance)
# previously: "missing value where TRUE/FALSE needed"

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@be-marc
be-marc merged commit 4b3ef00 into main Oct 27, 2026
6 checks passed
@be-marc
be-marc deleted the fix/stagnation-async branch October 27, 2026 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TerminatorStagnation errors with async optimizers (ArchiveAsync)

1 participant