Skip to content

Add tagging system for WorkPrecision and filtering helpers#178

Open
ChrisRackauckas-Claude wants to merge 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:tagging-infrastructure
Open

Add tagging system for WorkPrecision and filtering helpers#178
ChrisRackauckas-Claude wants to merge 1 commit intoSciML:masterfrom
ChrisRackauckas-Claude:tagging-infrastructure

Conversation

@ChrisRackauckas-Claude
Copy link
Contributor

Summary

  • Adds a tags::Vector{Symbol} field to WorkPrecision for categorizing algorithms (e.g., :rosenbrock, :stiff, :imex, :reference)
  • Tags specified via :tags key in setups dicts, propagated through all WorkPrecisionSet constructors (ODE, BVP, RODE, Ensemble, Nonlinear)
  • New filtering helpers: filter_by_tags, exclude_by_tags, get_tags, unique_tags, merge_wp_sets
  • Plot recipe extended with tags, include_tags, exclude_tags kwargs for direct tag-based filtering in plot calls
  • Fully backward compatible — tags default to empty, all existing APIs unchanged

Usage

setups = [
    Dict(:alg => Rosenbrock23(), :tags => [:rosenbrock, :2nd_order, :stiff]),
    Dict(:alg => Rodas5P(),      :tags => [:rosenbrock, :5th_order, :stiff]),
    Dict(:alg => TRBDF2(),       :tags => [:bdf, :2nd_order, :stiff]),
    Dict(:alg => KenCarp4(),     :tags => [:sdirk, :4th_order, :stiff, :imex]),
    Dict(:alg => Tsit5(),        :tags => [:rk, :5th_order, :nonstiff, :reference]),
    Dict(:alg => CVODE_BDF(),    :tags => [:bdf, :sundials, :reference]),
]
wp_set = WorkPrecisionSet(prob, abstols, reltols, setups; appxsol=test_sol)

# Filter and plot
plot(wp_set, tags=(:rosenbrock,))
plot(wp_set, tags=(:5th_order,), include_tags=(:reference,))
rosenbrock_set = filter_by_tags(wp_set, :rosenbrock)
no_reference = exclude_by_tags(wp_set, :reference)

Test plan

  • All existing tests pass (benchmark, convergence, stochastic WP, plot recipes, etc.)
  • New tagging tests: 24 tests covering all new functionality
  • Backward compatibility: setups without :tags key produce empty tags
  • Works with all problem types (ODE, BVP, RODE, Ensemble, Nonlinear)

Part of #177 (Phase 1: Core tagging infrastructure)

🤖 Generated with Claude Code

Add a `tags` field to `WorkPrecision` allowing algorithms to be categorized
with symbolic tags (e.g., `:rosenbrock`, `:stiff`, `:reference`). Tags are
specified via the `:tags` key in setups dicts and propagated through all
WorkPrecisionSet constructors (ODE, BVP, RODE, Ensemble, Nonlinear).

New exported functions:
- `filter_by_tags(wp_set, tags...)` - filter by ALL tags (AND logic)
- `exclude_by_tags(wp_set, tags...)` - exclude entries with ANY tag (OR logic)
- `get_tags(wp_set)` - get tags for each entry
- `unique_tags(wp_set)` - all unique tags in the set
- `merge_wp_sets(sets...)` - combine multiple WorkPrecisionSets

Plot recipe extended with `tags`, `include_tags`, and `exclude_tags` kwargs
for tag-based filtering directly in plot calls.

Fully backward compatible - tags default to empty, all existing APIs unchanged.

Closes SciML#177 (Phase 1)

Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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