Skip to content

Termination conditions - #88

Merged
frankier merged 2 commits into
mainfrom
termination-conditions
Aug 1, 2026
Merged

Termination conditions#88
frankier merged 2 commits into
mainfrom
termination-conditions

Conversation

@frankier

@frankier frankier commented Aug 1, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 LengthBoundedTermination and StateCriterionThresholdTermination termination conditions.
  • Introduce should_minimize as a public API in NextItemRules (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 missing data fields.

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 thread src/Sim/recorder.jl
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
@github-actions

github-actions Bot commented Aug 1, 2026

Copy link
Copy Markdown

Benchmark Results

main ab71989... main / ab71989...
next_item_rules/4pl/mean_point_mepv_10 2.36 ± 0.012 ms 2.36 ± 0.013 ms 1 ± 0.0075
next_item_rules/4pl/mean_point_mepv_bare 0.921 ± 0.0058 ms 0.918 ± 0.0075 ms 1 ± 0.01
next_item_rules/4pl/mode_point_mepv_10 1.9 ± 0.0067 ms 1.9 ± 0.0081 ms 1 ± 0.0055
next_item_rules/4pl/mode_point_mepv_bare 0.844 ± 0.0048 ms 0.841 ± 0.006 ms 1 ± 0.0092
time_to_load 2.28 ± 0.06 s 2.29 ± 0.033 s 0.996 ± 0.03

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@frankier
frankier force-pushed the termination-conditions branch from dbe0aad to ab71989 Compare August 1, 2026 11:09
@frankier
frankier merged commit 9b96de2 into main Aug 1, 2026
3 checks passed
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.

2 participants