LDES (LINE Discrete Event Simulator)

The LDES solver is a discrete-event simulator implemented using the SSJ (Stochastic Simulation in Java) library in the JAR backend. It has similar support as JMT in terms of models, but it is lighter and thus tends to run faster. Both MATLAB and Python call the JAR backend via subprocess.

MethodAlgorithmReference
defaultDiscrete-event simulation (SSJ in JAR)

Key Options

OptionValuesDefaultDescription
samplesinteger200,000Maximum service completion events to simulate
seedinteger23000Random seed; use -1 for a random seed
tranfiltermser5, fixed, nonemser5Warmup detection method. mser5 uses the MSER-5 adaptive algorithm; fixed discards a fixed fraction (see warmupfrac)
warmupfrac0.0–1.00.20Fraction of events discarded as warmup when tranfilter=fixed
cimethodobm, bm, spectral, noneobmConfidence interval method. obm = overlapping batch means; bm = non-overlapping batch means; spectral = Heidelberger–Welch spectral analysis (log-periodogram regression at low frequencies, accounts for batch autocorrelation, gives wider but more honest CIs)
obmoverlap0.0–1.00.50Batch overlap fraction for cimethod=obm
cnvgonbooleanfalseStop early when CI half-width / mean falls below cnvgtol for all metrics
cnvgtol0.0–1.00.05Relative precision threshold for convergence stopping (5% by default)
replicationsinteger1Number of independent parallel replications; when >1 uses cross-replication variance for CIs

Example

This example demonstrates solving a simple M/M/1 queue using the LDES solver with discrete-event simulation. LDES is primarily implemented in the JAR backend using the SSJ (Stochastic Simulation in Java) library.

% Create a simple M/M/1 queue
model = Network('M/M/1 Example');
source = Source(model, 'Source');
queue = Queue(model, 'Queue1', SchedStrategy.FCFS);
sink = Sink(model, 'Sink');

jobclass = OpenClass(model, 'Class1');
source.setArrival(jobclass, Exp(0.9));
queue.setService(jobclass, Exp(1.0));

model.link(Network.serialRouting(source, queue, sink));

% Solve with LDES (via JAR backend)
solver = LDES(model, 'samples', 5000, 'seed', 12345);

% Display average performance metrics
LDES(model).avgTable()

Output:

LDES analysis [method: default, lang: matlab] completed.

ans =
  2×8 table
    Station    JobClass     QLen      Util      RespT     ResidT     ArvR       Tput
    _______    ________    ______    _______    ______    ______    _______    _______
    Source      Class1          0          0         0         0          0    0.89856
    Queue1      Class1     8.2105    0.88742    9.1954    9.1954    0.89856    0.89315
import jline.lang.*;
import jline.lang.constant.SchedStrategy;
import jline.lang.nodes.*;
import jline.lang.processes.Exp;
import jline.solvers.NetworkAvgTable;
import jline.solvers.ldes.LDES;

public class LDESExample {
    public static void main(String[] args) {
        // Create a simple M/M/1 queue
        Network model = new Network("M/M/1 Example");

        Source source = new Source(model, "Source");
        Queue queue = new Queue(model, "Queue1", SchedStrategy.FCFS);
        Sink sink = new Sink(model, "Sink");

        OpenClass jobclass = new OpenClass(model, "Class1");
        source.setArrival(jobclass, Exp.fitRate(0.9));
        queue.setService(jobclass, Exp.fitRate(1.0));

        model.link(Network.serialRouting(source, queue, sink));

        // Solve with LDES (LINE Discrete Event Simulator)
        LDES solver = new LDES(model);
        solver.options.samples = 5000;
        solver.options.seed = 12345;

        // Display average performance metrics
        NetworkAvgTable avgTable = solver.avgTable;
        System.out.println(avgTable);
    }
}

Output:

LDES analysis [method: default, lang: java] completed.

Station    JobClass     QLen      Util      RespT     ResidT     ArvR       Tput
Source     Class1       0.0       0.0       0.0       0.0        0.0        0.89856
Queue1     Class1       8.2105    0.88742   9.1954    9.1954     0.89856    0.89315
from line_solver import *

# Create a simple M/M/1 queue
model = Network('M/M/1 Example')

source = Source(model, 'Source')
queue = Queue(model, 'Queue1', SchedStrategy.FCFS)
sink = Sink(model, 'Sink')

jobclass = OpenClass(model, 'Class1')
source.setArrival(jobclass, Exp(0.9))
queue.setService(jobclass, Exp(1.0))

model.link(Network.serialRouting(source, queue, sink))

# Solve with LDES (via JAR backend)
solver = LDES(model, samples=5000, seed=12345)

# Display average performance metrics
print(solver.avg_table)

Output:

LDES analysis [method: default, lang: python] completed.

  Station  JobClass    QLen     Util      RespT    ResidT     ArvR      Tput
0  Source    Class1     0.0      0.0       0.0      0.0        0.0       0.89856
1  Queue1    Class1     8.2105   0.88742   9.1954   9.1954     0.89856   0.89315