Termination conditions - #88
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds new termination-condition building blocks to ComputerAdaptiveTesting.jl and introduces a dedicated test suite to validate their behavior, while also exposing a criterion “direction” helper (should_minimize) and making the simulation recorder more defensive when building dataframes.
Changes:
- Add
LengthBoundedTerminationandStateCriterionThresholdTerminationtermination conditions. - Introduce
should_minimizeas a public API inNextItemRules(with a default implementation) and use it for criterion-threshold termination logic. - Add comprehensive tests for termination conditions and wire them into
test/runtests.jl; harden recorder dataframe preparation against missingdatafields.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/TerminationConditions.jl |
Adds new termination-condition types and exports them. |
src/NextItemRules/prelude/criteria.jl |
Introduces a default should_minimize function and documentation. |
src/NextItemRules/NextItemRules.jl |
Marks should_minimize as part of the public API surface. |
src/Sim/recorder.jl |
Avoids property access errors when recording entries don’t contain data. |
test/termination_conditions.jl |
New test coverage for termination-condition behavior and delegation. |
test/runtests.jl |
Includes the new termination-conditions test file in the test suite. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
116
to
119
| for (name, value) in pairs(recording.data) | ||
| if value.data isa AbstractVector | ||
| if hasproperty(value, :data) && value.data isa AbstractVector | ||
| label = haskey(value, :label) ? Symbol(value.label) : name | ||
| cols = (; |
| Whether lower values of a criterion are better. By convention criteria in this | ||
| package are minimised, so this defaults to `true`. | ||
| """ | ||
| should_minimize(::Union{ItemCriterion, CriterionBase}) = true |
Comment on lines
+62
to
+66
| struct LengthBoundedTermination{InnerT <: TerminationCondition} <: TerminationCondition | ||
| min_length::Int64 | ||
| max_length::Int64 | ||
| termination_condition::InnerT | ||
| end |
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
frankier
force-pushed
the
termination-conditions
branch
from
August 1, 2026 11:09
dbe0aad to
ab71989
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.