← Home
ddm petri-net ode theory

Declarative Differential Models (DDM)

A Petri net describes a system declaratively — places hold state, transitions change it, arcs define the rules. A DDM takes that description and encodes it directly as differential equations. We specify what the relationships are, not how to compute them. Constraints like conservation laws and capacity limits live in the equations themselves. The system stays within valid bounds without external enforcement.

From Petri Nets to ODEs

From Petri Net to ODE System

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.

Discrete vs Continuous

Discrete vs Continuous Simulation

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

The continuous approach costs the same whether we have 10 or 10,000 entities. Gradient-based optimization works because the equations are smooth. And we get stability, sensitivity, and equilibrium analysis for free.

In Practice

pflow.xyz runs DDM in the browser. Draw a net, set initial markings and rate constants, run ODE analysis, and watch token flows evolve. The model exports as JSON-LD.

Example: Knapsack Optimization

pflow

In a knapsack model:

Exclusion Analysis

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.

When DDM Breaks Down

DDM models aggregate behavior — populations, not individuals. We can't track "Patient 47" through the system. Discrete conditionals ("if X then Y") don't have a clean continuous analog. And with very small populations (1-2 entities), the continuous approximation is too coarse.

For everything else — optimization, game analysis, workflow modeling, resource allocation — the ODE simulation is fast, the constraints are structural, and the analysis comes free from the incidence matrix.

Further Reading

This topic is covered in depth in Chapter 3: From Discrete to Continuous of Petri Nets as a Universal Abstraction.

×

Follow on Mastodon