Skip to content

Combining multiple run criteria #1295

@alice-i-cecile

Description

@alice-i-cecile

What problem does this solve or what need does it fill?

As programs grow in complexity, it becomes increasingly common to need to combine more than one run criteria.

This is particularly true with FixedTimeStep.

Currently, RunCriteria cannot be chained ergonomically. Instead, you have to wrap the internal logic in a custom run criteria. This is trickier than expected, and limits code reuse.

What solution would you like?

Run criteria should be able to be chained together in the obvious way: ideally by calling .with_run_criteria more than once in a builder pattern.

While the correct behavior is clearly a logical AND for simple boolean outputs, the presence of YesAndLoop (and soon NoAndLoop) complicates the desired logic here.

This behavior is currently used by our State logic, but not really anywhere else; changing how they work may resolve this difficulty for us.

What alternative(s) have you considered?

Currently, RunCriteria cannot be chained ergonomically. Instead, you have to wrap the internal logic in a custom run criteria. This is trickier than expected, and limits code reuse.

Additional context

This issue was prompted by discussion on Discord about the problem, ultimately caused by a user wanting to add an extra run criteria to a system that was running on a FixedTimeStep.

The inability to nicely chain run criteria prevents us from using them for more complex core functionality down the line.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-FeatureA new feature, making something new possible

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions