Skip to content

[ENHANCEMENT] Support first-class events (mid-simulation perturbations) in Boolean simulation #10

Description

@carissableker

Is your feature request related to a problem? Please describe.
continuous_simulation supports node_events which forces a node to a given value at a specific time, optionally holding it for a duration. This is implemented via a sequence of scipy.integrate.solve_ivp segments split at each event time (ContinuousMixin.continuous_simulation) in booldog/continuous/ode_factory.py. boolean_simulation has no equivalent: it wraps pyboolnet's state-transition-graph construction, building the full reachable STG from the initial state(s) in one call, so there's no "current time" during the run to attach a trigger to.

Current workaround
Construct a new initial state with the target node(s) pre-set, and start a fresh boolean_simulation from there. See Case (ii) in tutorials/tutorial-advanced.ipynb, which uses inactivate_state() + set_node_state() to simulate an "egf"/"tnfa" trigger. This works but requires the user to manually manage state construction and result-stitching themselves, with no chained-segment result object like ContinuousSimulationResult.

Describe the solution you'd like
Wrap the existing workaround into a first-class API, analogous to continuous_simulation's segment-based approach:

  • Accept a node_events-style parameter (list of {step_or_condition, node, value}).
  • Internally, run boolean_simulation up to each event point, force the node value in the resulting state, and re-launch from there.
  • Needs a design decision on what "event time" means for a Boolean simulation (a step count, a reached-attractor condition, or something else) since discrete Boolean simulation doesn't have a single natural time axis the way ODE integration does.

Additional context
Came up in review, which asked whether events are supported the same way across both simulation modes. Opening to track idea/interest.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions