ddm petri-net ode theory

Declarative Differential Models (DDM)

Declarative Differential Models (DDM) refer to a modeling approach where the entire system's behavior—states, transitions, constraints, and objectives—is described declaratively and encoded directly within a set of differential equations or differential-algebraic equations (DAEs).

Core Properties

  1. Declarative: We specify what the system's relationships and constraints are, not how to compute them. The system is described by its rules and relationships, not step-by-step instructions.

  2. Differential / DAE-based: The model is encoded as systems of differential equations (continuous or hybrid dynamics). These equations govern how the system evolves over time.

  3. Constraint Embedding: Physical or logical constraints (e.g., conservation laws, capacity limits) are baked directly into the equations. The system operates within valid bounds without requiring external enforcement.

  4. Optimization-Ready: DDMs naturally integrate with optimization techniques, allowing parameters to be learned or fine-tuned directly within the model.

From Petri Nets to ODEs

A Petri net can be converted to an ODE system using mass-action kinetics:

For each place in the net:

dM(p)/dt = Σ(incoming flow) - Σ(outgoing flow)

Where the flow through each transition follows:

rate(T) = k × M(P1)^w1 × M(P2)^w2 × ...

This transforms discrete token dynamics into continuous flow—tokens become concentrations, firing becomes flux.

Why Continuous?

Discrete Simulation ODE Simulation
Track individual events Track population-level dynamics
"Patient 1 arrives at 8:15" "Patients arrive at rate 10/hour"
Slow: must process every event Fast: solves continuous equations
Scales with event count Scales with equation count

Advantages of the continuous approach:

How-To with pflow.xyz

pflow.xyz provides a browser-based environment for DDM:

  1. Design the Petri net - Add places, transitions, and arcs visually
  2. Set initial markings - Configure starting tokens for each place
  3. Configure rates - Assign rate constants to transitions
  4. Run ODE analysis - Simulate continuous dynamics
  5. Visualize results - Watch token flows evolve over time

The model exports as JSON-LD, making it portable and composable.

Example: Knapsack Optimization

pflow

In a knapsack model:

Exclusion Analysis

One powerful technique: disable transitions to measure contribution.

By setting a transition's rate to zero, we can observe:

This replaces combinatorial search with targeted simulation.

Applications

Trade-offs

DDM works best when:

DDM is less suited when:

Further Reading

Key Takeaways

  1. DDM encodes systems as differential equations, not procedural code
  2. Constraints become structure, automatically enforced by the model
  3. Continuous simulation enables fast exploration of complex systems
  4. Mass-action kinetics bridges Petri net structure and ODE dynamics
  5. pflow.xyz makes DDM accessible in the browser