Class StochPetriNetExamples
This class contains Java implementations that mirror the example notebooks found in jar/src/main/java/jline/examples/java/basic/stochPetriNet/. Each method demonstrates a specific Petri net concept using models from the basic package.
The examples cover: - Basic open and closed Petri net structures - Multiple firing modes and batch processing - Inhibiting conditions and complex token flows - Various stochastic distributions in transitions - Multi-class token systems
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMain method demonstrating selected Petri net examples.static voidstatic voidBasic open stochastic Petri net (spn_basic_open.ipynb).static voidClosed Petri net with four places (spn_closed_fourplaces.ipynb).static voidClosed Petri net with two places (spn_closed_twoplaces.ipynb).static void`spn_colored_gspn.m`: a colored generalized stochastic Petri net.static void`spn_fluid_dae.m`: fluid (mean-field) analysis of a stochastic Petri net.static voidCompeting transitions Petri net (spn_fourmodes.ipynb).static voidInhibiting transitions Petri net (spn_inhibiting.ipynb).static void`spn_lpbounds.m`: bound a stochastic Petri net by linear programming.static voidOpen Petri net with seven places (spn_open_sevenplaces.ipynb).static voidPareto-distributed transition firing (spn_pareto_service.ipynb).static void`spn_productform_nc.m`: solve a stochastic Petri net analytically with NC.static void`spn_queueing_place.m`: a closed queueing Petri net (QPN) with two queueing places.static voidBatch processing Petri net (spn_twomodes.ipynb).static void`test_spn_nrm_open.m`: the SSA Next-Reaction-Method path on OPEN nets.
-
Constructor Details
-
StochPetriNetExamples
public StochPetriNetExamples()
-
-
Method Details
-
spn_pareto_service
Pareto-distributed transition firing (spn_pareto_service.ipynb).Simulation only: the golden holds the JMT row at the reference's seed and run length.
- Throws:
Exception
-
spn_basic_closed
- Throws:
Exception
-
spn_basic_open
Basic open stochastic Petri net (spn_basic_open.ipynb).Shows fundamental open Petri net structure with source, place, transition, and sink.
- Throws:
Exception
-
spn_twomodes
Batch processing Petri net (spn_twomodes.ipynb).Demonstrates batch token processing where transitions require and produce multiple tokens.
- Throws:
Exception
-
spn_fourmodes
Competing transitions Petri net (spn_fourmodes.ipynb).Shows resource competition between transitions requiring different numbers of tokens.
- Throws:
Exception
-
spn_inhibiting
Inhibiting transitions Petri net (spn_inhibiting.ipynb).Demonstrates inhibitor arcs that prevent firing when tokens are present in certain places.
- Throws:
Exception
-
spn_closed_twoplaces
Closed Petri net with two places (spn_closed_twoplaces.ipynb).Simple closed system demonstrating token circulation between two places with different service rates.
- Throws:
Exception
-
spn_closed_fourplaces
Closed Petri net with four places (spn_closed_fourplaces.ipynb).More complex closed system with tokens cycling through four different places using multiple transitions.
- Throws:
Exception
-
spn_open_sevenplaces
Open Petri net with seven places (spn_open_sevenplaces.ipynb).Complex open system demonstrating token flow through multiple places with varied routing probabilities.
- Throws:
Exception
-
spn_productform_nc
`spn_productform_nc.m`: solve a stochastic Petri net analytically with NC.NC's
recmethod is the first ANALYTICAL route LINE offers for a Petri net: CTMC builds the explicit generator, SSA and LDES simulate, FLD fluidises. It works in three steps, each with its own reference:Spn_pfdecides whether the net has a product form and derives the per-place factors g_l, by complex balance (Coleman-Henderson-Taylor, Perform. Eval. 26(3), 1996);Mdd_recevaluates G as ONE memoised walk of the decision diagram holding the reachable set (Balsamo-Marin-Stojic, FGCS 111 (2020) 475-490);Spn_metricsreads the mean tokens, the utilisations and the throughputs off masked walks of the same diagram.
Two nets are solved. The first is a closed cycle, which a queueing network could also express. The second FORKS: Tf consumes one token and produces two, so the marking is not a conserved job population and there is no queueing-network counterpart, which is the limitation the MDD-rec paper opens with.
- Throws:
Exception- if a solver encounters an error
-
spn_lpbounds
`spn_lpbounds.m`: bound a stochastic Petri net by linear programming.BA's
spnlpfamily is the first BOUNDING route LINE offers for a Petri net, and it needs neither a generator nor a product form. It relaxes the stationary chain to a MOMENT POLYTOPE (the uniformized evolution equation written for E[X_p], E[X_p^2] and E[X_p1 X_p2], plus behavioural and probabilistic inequalities) and then minimises and maximises each reported measure over it. Every stationary point of the true chain satisfies every row, so the two optima bracket the exact value.Reference: Z. Liu, "Performance Analysis of Stochastic Timed Petri Nets Using Linear Programming Approach", IEEE Trans. Software Engineering 24(11), 1998, 1014-1030.
- Throws:
Exception- if a solver encounters an error
-
spn_queueing_place
`spn_queueing_place.m`: a closed queueing Petri net (QPN) with two queueing places.A queueing place embeds a scheduling station inside a Petri-net place: an arriving token is served by the place's embedded queue and, on completion, moves to a depository from which the output transitions consume it. A CPU (single-server FCFS) and a think stage (infinite server) here exchange a fixed population of N tokens through two immediate transitions, which is the queueing-Petri-net rendering of a machine-repairman model, so MVA on the equivalent Delay+Queue network cross-validates it exactly.
- Throws:
Exception- if a solver encounters an error
-
spn_colored_gspn
`spn_colored_gspn.m`: a colored generalized stochastic Petri net.A GSPN mixes timed transitions, which fire after a random delay, with immediate ones, which fire as soon as they are enabled and consume no time. It is colored when the tokens carry a type, which in LINE is a job class: a place holds one marking per color and a transition declares one mode per color. Two colors circulate between a buffer and a server; the immediate transition admits a token only into an empty server, through inhibitor arcs on BOTH colors, and the firing weights arbitrate the conflict when both colors are waiting. CTMC eliminates the vanishing markings by stochastic complementation and solves the 8 tangible states exactly; SSA reproduces them by simulation.
- Throws:
Exception- if a solver encounters an error
-
spn_fluid_dae
`spn_fluid_dae.m`: fluid (mean-field) analysis of a stochastic Petri net.A GSPN is a density-dependent Markov population process: the marking is the population, a transition mode is a reaction, and the firing rate
lambda*min(enabling degree, servers)is the same min() non-linearity the min-normal closure of FLD exists to smooth. Thedaemethod is the one that can carry it, because a Petri net needs three things stated as EQUATIONS rather than integrated: the P-invariants, which hold to solver tolerance instead of integrator tolerance; the firing FLOW of an immediate transition, an algebraic unknown pinned by the constraint that its input place holds no mass; and a bounded place, a linear inequality on the marking.FLD resolves to
daeon any model holding a Transition node, so no method has to be named. Unlike every other solver of a Petri net in LINE it also returns a SECOND MOMENT: the marking covariance of the linear noise approximation, onFluidResult.petri.- Throws:
Exception- if a solver encounters an error
-
test_spn_nrm_open
`test_spn_nrm_open.m`: the SSA Next-Reaction-Method path on OPEN nets.A Source feeds a Place whose tokens drain through a Transition to a Sink. Before the Source-arrival reaction was added the fed Place stayed empty and the run threw "Deadlock: no transition is enabled".
Each net asserts that the solver actually ran method
nrm(never a silent serial fallback) and that the simulated marking mean and throughput match the analytic M/M/1 result: a Source Exp(lambda) feeding a single-server Transition Exp(mu) is an M/M/1 queue at the Place, with mean tokens rho/(1-rho) and throughput lambda. The canonical net is cross-checked against JMT.- Throws:
Exception- if a solver encounters an error
-
main
Main method demonstrating selected Petri net examples.- Throws:
Exception
-