Skip to content

Clarify steady state #635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Clarify steady state #635

wants to merge 1 commit into from

Conversation

dweindl
Copy link
Member

@dweindl dweindl commented Jul 3, 2025

An attempt to clarify what we consider steady state in the context of PEtab.

@dweindl dweindl requested a review from a team as a code owner July 3, 2025 05:02
condition will be simulated until a steady state is reached.
condition will be simulated until a steady state is reached. The system is
considered to be at steady state once the time derivative of all
differential entities is almost zero, even if there are discontinuities in
Copy link
Collaborator

Choose a reason for hiding this comment

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

Say that this is up to the individual tools to implement what „almost zero“ is?

An attempt to clarify what we consider steady state in the context of PEtab.
Copy link
Member

@dilpath dilpath left a comment

Choose a reason for hiding this comment

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

Thanks!

Comment on lines +399 to +404
condition will be simulated until a steady state is reached. The system is
considered to be at steady state once the time derivative of all
differential entities is almost zero (where "almost zero" is to be defined by
the simulator or user), even if there are discontinuities in
the model (e.g., due to events) that may change the model state
at a later time point.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
condition will be simulated until a steady state is reached. The system is
considered to be at steady state once the time derivative of all
differential entities is almost zero (where "almost zero" is to be defined by
the simulator or user), even if there are discontinuities in
the model (e.g., due to events) that may change the model state
at a later time point.
condition will be simulated until a steady state is reached. In the most
general case in PEtab, the mathematical model is an initial value problem
with a system of explicit differential-algebraic equations.
A steady-state occurs when the differential state variables become
constant then stay constant, given the algebraic constraints and initial
condition. In the absence of analytical steady states, numerically
determining whether a steady state has been reached is difficult and
is both method- and problem-specific; hence, this is left to the simulator
and user.

I don't think it's enough to write "once the time derivative [...] is almost zero", since this might contradict the user's understanding of what steady state means for their particular model.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hm, my main intention was to clarify how events interact with steady states. It feels like this change makes it as unclear as it was before.

when the differential state variables become
constant then stay constant, given the algebraic constraints and initial
condition

Does that mean that we only reach a steady state once we can be sure that no event would ever occur that could change the state? Or does it mean that events should be ignored? If so, it contradicts with that we want events to handled during steady state simulations.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, there can be no later change in the state, due to an event or otherwise (e.g. extremely slow dynamics). The simulator/user needs to decide for themselves whether they are sufficiently satisfied that they have found the steady state. If someone comes along later and finds that the state actually changes at a later time point, then the first user/simulator is incorrect. We should not write a definition that claims the first user is actually correct?

Copy link
Member

Choose a reason for hiding this comment

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

I don't see a contradiction since we are still requiring that the simulator/user decides whether to ignore potential future events or not. But guiding this decision is out-of-scope of PEtab IMO

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we can do that and at the same time say we promote reproducible simulations. If we really want that I would prefer to somehow impose a minimum simulation time before a steady state can be reached.

We still have to test this in some meaningful way in the testsuite.

Copy link
Member Author

Choose a reason for hiding this comment

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

After further discussion with @dilpath: the steady state definition should probably also include assignment rule targets, and for t=inf measurements, observables.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thinking about the whole issue again, I agree with Dilan's initial point. We should not prevent tools from doing the right thing. Formally, the steady-state condition would be d x / d t = 0 and no time-dependent events for any t > t c u r , which we should state here. If a tool ignores the latter condition, there is a chance it won't find the right steady state and we probably shouldn't justify that.

I think we should avoid attempting to define what the right steady-state is.

Let's say we have a model where x follows logistic growth and there is an event with trigger alpha*t-x that changes the carrying capacity. This event clearly changes steadystate, but it only triggers for some specific values for growth rate/alpha. In this simple example, you might get lucky and precompute whether an event is going to trigger or not, but that essentially will require computing the explicit solution which will not be available in general.

Asking tools to figure out whether there is going to be another event is asking something impossible, which we should not do.

Copy link
Contributor

Choose a reason for hiding this comment

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

Overall, if we want reproducibillity, assuming we define steady-state as dx/d t=0, then saying the first point that fulfill dx/dt=0 for t>tmin should be sufficient? Maybe then in the spec, we can highlight that this might imply triggering of events during steady-state simulations (and if the user does not want events to trigger during steady-state simulations, there are always ways to code events such they cannot be triggered, that is for example how Brannmark benchmark model handles it currently)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Asking tools to figure out whether there is going to be another event is asking something impossible, which we should not do.

I see that point. However, I wouldn't want to say that some tool that is better at doing that should stop doing that.

How about we don't change the definition of a steady state, but just say that tools may stop at dx/dt=0, and that it's on the modeler to avoid any situations where this could cause problems?
It may not be perfect in terms of reproducibility, but that problem starts long before (unspecified integration tolerances, steady state tolerances, ...).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Asking tools to figure out whether there is going to be another event is asking something impossible, which we should not do.

I see that point. However, I wouldn't want to say that some tool that is better at doing that should stop doing that.

How about we don't change the definition of a steady state, but just say that tools may stop at dx/dt=0, and that it's on the modeler to avoid any situations where this could cause problems? It may not be perfect in terms of reproducibility, but that problem starts long before (unspecified integration tolerances, steady state tolerances, ...).

fine with me.

Comment on lines +501 to +502
measurements (the same definition of steady state as in the
:ref:`v2_experiments_table` applies here).
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
measurements (the same definition of steady state as in the
:ref:`v2_experiments_table` applies here).
measurements (the same definition of steady state as in the
:ref:`v2_experiments_table` applies here, with the additional
sanity check that the steady state occurs during the final
experiment period).

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.

4 participants