Papers
Topics
Authors
Recent
Search
2000 character limit reached

Colored-Timed Petri Nets (CTPNs)

Updated 15 January 2026
  • Colored-Timed Petri Nets (CTPNs) are a class of mathematical models that integrate colored tokens and explicit time delays to capture both data values and temporal constraints in concurrent systems.
  • They support hierarchical modularity and efficient symbolic analysis, enabling applications in process mining, workflow verification, and performance analysis of distributed systems.
  • Their rigorous formal semantics facilitate state space exploration, verification of boundedness and liveness, and extraction of performance metrics for practical system insights.

Colored-Timed Petri Nets (CTPNs) constitute a class of mathematical models for concurrent systems in which tokens are distinguished by data values ("colors") and explicitly carry time information. This joint extension of classic Petri nets enables both succinct state representations and the modeling of temporally constrained behaviors. CTPNs serve as foundational models in process mining, scheduling, workflow verification, and the formal performance analysis of distributed and embedded systems. Their rigorous formal semantics support hierarchical modularity, efficient symbolic analysis, and integration with modern data analytics ecosystems (Berti et al., 27 Mar 2025, Pashazadeh et al., 2014).

1. Formal Semantics and Structure

A Colored-Timed Petri Net is defined formally as either a 9-tuple or 10-tuple depending on notational preference, encapsulating colored data domains and explicit time delays:

For the 10-tuple variant used in CPN-Py (Berti et al., 27 Mar 2025),

N=(P,T,A,Σ,V,C,G,E,I,D)N = (P, T, A, \Sigma, V, C, G, E, I, D)

where:

  • PP: finite set of places.
  • TT: finite set of transitions with PT=P \cap T = \varnothing.
  • A(P×T)(T×P)A \subseteq (P \times T) \cup (T \times P): set of directed arcs.
  • Σ={Σ1,...,Σn}\Sigma = \{\Sigma_1, ..., \Sigma_n\}: finite set of color sets (typed data domains), some of which may be “timed.”
  • VV: finite set of typed variables.
  • C:PΣC : P \rightarrow \Sigma: color assignment for places.
  • G:TExpr(V)G : T \rightarrow \mathrm{Expr}(V): guard expressions over transition variables.
  • E:AExpr(V)E : A \rightarrow \mathrm{Expr}(V): multiset expressions for arcs.
  • I:PMultiset(Σ)I : P \rightarrow \mathrm{Multiset}(\Sigma): initial marking.
  • D:TR0D : T \rightarrow \mathbb{R}_{\ge 0}: transition delay function.

A marking is a function M:PMultiset(Σ×R0)M: P \rightarrow \mathrm{Multiset}(\Sigma \times \mathbb{R}_{\ge 0}), with each token potentially carrying a timestamp τ\tau; tokens in untimed places conventionally have τ=0\tau = 0 (Berti et al., 27 Mar 2025, Pashazadeh et al., 2014).

Enabling and Firing

A transition tTt \in T is enabled at marking MM and global clock TcT_c under binding b:VΣb : V \rightarrow \bigcup \Sigma if:

  1. For every input place ptp \in \bullet t, the required multiset E((p,t))[b]E((p, t))[b] can be instantiated by tokens (vi,τi)(v_i, \tau_i) present in M(p)M(p) with τiTc\tau_i \leq T_c.
  2. The guard G(t)[b]G(t)[b] evaluates to true.

When such a transition tt fires:

  • Input tokens are removed based on E((p,t))[b]E((p,t))[b] for all pp.
  • Output tokens are created and assigned timestamps τe+D(t)+δ\tau_e + D(t) + \delta, where τe\tau_e is the latest timestamp among the consumed tokens and δ\delta is any arc-level delay (“@+K” annotation).

This mechanism formalizes the interplay between color (data semantics) and system dynamics with explicit passage of time (Berti et al., 27 Mar 2025, Pashazadeh et al., 2014).

2. Data Structures, Tool Support, and APIs

CPN-Py provides a direct Python mapping of the CTPN semantic structure (Berti et al., 27 Mar 2025):

  • Class Place: Attributes include name, colorset, timed.
  • Class Transition: Holds name, list of variables, guard (as a Python string), and transition_delay.
  • Class Arc: Connects places and transitions, annotates expressions for token manipulation and arc delays.
  • Class [CPN](https://www.emergentmind.com/topics/causal-probabilistic-network-cpn): Manages places, transitions, and arcs, plus interface methods for step and state manipulation.
  • Class Marking: Encodes the net state as a mapping from place to lists of timed tokens; supports timestamped token insertion, removal, and global clock tracking.
  • Class EvaluationContext: Python context/environment for evaluating guards and expressions, supporting user-provided code.
  • ColorSetParser: Converts ML-like color set definitions into internal data structures; supports both standard types and user-custom “timed” sets.

This fully object-oriented, extensible API enables CTPN construction, simulation, state space exploration, and integration with Python-based data science toolchains (e.g., PM4Py) (Berti et al., 27 Mar 2025).

3. Modeling Patterns and Hierarchical Composition

CTPNs model a wide range of systems, from simple sequential workflows to complex, modular architectures.

Example: Timed Queueing

A simple M/M/1 queue can be modeled with three places (Arrivals, InService, Departed), color sets for tokens (e.g., real-timed customers), and transitions for Arrival and Service events. Token timestamps capture arrival/service completion, with transitions governed by sampling functions such as exponential distributions.

1
2
3
4
5
6
7
8
9
10
11
12
from cpnpy.cpn.colorsets import ColorSetParser
from cpnpy.cpn.cpn_imp import Place, Transition, Arc, CPN, Marking, EvaluationContext
parser = ColorSetParser()
cs = parser.parse_definitions("colset REAL = real timed;")
REAL = cs["REAL"]
p_arr = Place("Arrivals", REAL)
p_dep = Place("Departed", REAL)
t_arr = Transition("Arrive", variables=[], guard="True", transition_delay=0)
arc_arr_out = Arc(t_arr, p_arr, "ExpArrival() @+0")
t_srv = Transition("Serve", variables=["x"], guard="True", transition_delay=0)
arc_srv_in  = Arc(p_arr, t_srv, "x")
arc_srv_out = Arc(t_srv, p_dep, "x @+ExpService()")
Arbitrary guard logic and random distributions are accommodated via the evaluation context, supporting discrete-event and stochastic simulation (Berti et al., 27 Mar 2025).

Hierarchical Nets

Hierarchical composition is realized via “substitution transitions” or module fusion. Any CTPN can be used as a module and, by defining interface place sets, can be plugged into a parent net: this supports scalable construction of layered process models, modular enterprise architectures, or composable scheduling blocks (Berti et al., 27 Mar 2025, Pashazadeh et al., 2014).

4. State Space, Verification, and Analysis

Reachability analysis for CTPNs considers not only colored states but the global timing context. State space analyzers, such as the one in CPN-Py, execute breadth-first enumeration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function build_reachability_graph(cpn, M0, ctx):
  Q  queue containing M0
  visited  {M0}
  RG  empty graph
  while Q not empty:
    M  Q.pop()
    for t in cpn.transitions:
      for binding b in all_bindings(t, M, ctx):
        if enabled(t, b, M):
          M' ← fire(t, b, M, ctx)
          RG.add_edge( M, (t,b), M' )
          if M' not in visited:
            visited.add(M')
            Q.push(M')
  return RG
Analysis proceeds to identify strongly connected components (SCCs), dead markings, liveness of transitions (by infinite occurrence in terminal SCCs), and compute place bounds. Markings combine symbolic token values and timestamps, with the global clock forming part of the state signature. Such analyzers facilitate formal verification of boundedness, absence of deadlocks, and liveness properties, as well as invariant and temporal property checks (Berti et al., 27 Mar 2025, Pashazadeh et al., 2014).

Application: Single-Processor Scheduling

CTPNs have been used to encode non-preemptive single-processor scheduling, where each process token is a record-valued colored token with fields for process ID, arrival time, service time, waiting time, and more. Four scheduling policies are encoded via guard and update logic (FCFS, SJF, PR, HRRN), with each process’s progress and timing tracked as tokens move between NewTasks, ReadyQueue, Running, and Finished. This model allows direct extraction of Gantt charts and formal verification of deadline/throughput properties (Pashazadeh et al., 2014).

5. Interchange, Discovery, and Data-Centric Integration

CPN-Py and related tools support:

  • PM4Py Integration: Direct hooks allow event logs to be used for process discovery, guard/decision mining, and timing distribution fitting (“stochastic replay”). Inductive process mining algorithms extract control-flow nets, and guard/timing discovery annotates CTPNs with empirically derived semantics. The returned context is a Python environment, ready for simulation or further analysis (Berti et al., 27 Mar 2025).
  • JSON Interchange Format: A standardized schema describes all core structures (color sets, places, transitions, arcs, initial marking). Tokens can be defined by value and timestamp. This format is suitable for LLM-assisted model generation, validation, and ecosystem-wide tool interoperability.
    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    {
      "colorSets": [{ "name":"INT","def":"int timed;" }],
      "places":[ { "id":"P_In","colorset":"INT","tokens":[{"value":1,"time":0}]} ],
      "transitions":[ {"id":"T","variables":["x"],"guard":"x>0","delay":1} ],
      "arcs":[
        {"id":"a1","source":"P_In","target":"T","expr":"x"},
        {"id":"a2","source":"T","target":"P_Out","expr":"x+1 @+2"}
      ]
    }
    Models can be imported/exported and converted to/from CPN Tools XML stubs, making the approach compatible with a range of formal methods and process mining frameworks (Berti et al., 27 Mar 2025).

6. Performance Properties and Practical Significance

The explicit data and time modeling of CTPNs lead to several verifiable properties relevant to both research and practice:

  • Boundedness: For systems with no unbounded token creation and finitely many places, all markings remain bounded by construction (Pashazadeh et al., 2014).
  • Conservation Laws: Domain-specific invariants (e.g., fixed total number of processes) can be verified,

M(NewTasks)+M(ReadyQueue)+M(Running)+M(Finished)=N|M(\mathit{NewTasks})| + |M(\mathit{ReadyQueue})| + |M(\mathit{Running})| + |M(\mathit{Finished})| = N

  • Liveness and Deadlock-freedom: CTPNs can encode and check necessary system liveness properties—e.g., every eligible scheduling step will eventually fire, modulo blocking conditions (Pashazadeh et al., 2014).
  • Temporal Properties: Properties such as processes meeting deadlines can be checked in CTL/LTL against the reachability graph.
  • Visualization and Reporting: The timestamped token representation supports Gantt chart extraction and time-based trace analysis, directly reflecting system progress (Pashazadeh et al., 2014).

These strengths position CTPNs as a bridge between discrete-event formalism and contemporary data-driven analytics workflows (Berti et al., 27 Mar 2025).

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Colored-Timed Petri Nets (CTPNs).