The Python version of the LINE solver for queueing models.
Requires Python 3.11 or later.
pip install line-solver
To install from source, run pip install . in this folder. Then run line-install to check optional dependencies such as Java and the symbolic backend (it only warns, never fails).
The tutorials ship with the package and run from any directory:
python3 -m line_solver.examples.gettingstarted.tut01_mm1_basics
From a source checkout, python3 mm1.py solves an M/M/1 queue at 50% utilization and prints:
Station JobClass QLen Util RespT ResidT ArvR Tput
Source Class1 0 0 0 0 0 1
Queue Class1 1 0.5 1 1 1 1
You can also open mm1.ipynb in Jupyter. More tutorials are in examples/gettingstarted/.
See the Python manual. The syntax closely mirrors the MATLAB version: compare the examples/gettingstarted/ scripts of the two.
Every solver takes a lang keyword that selects which engine does the work. The model code stays the same:
MVA(model).avg_table() # native Python (default)
MVA(model, lang="java").avg_table() # Java engine (jline.jar)
MVA(model, lang="cpp").avg_table() # C++ engine (line-cli)lang |
Needs | Solvers |
|---|---|---|
"python" |
nothing | all |
"java" |
a Java runtime | all |
"cpp" |
the line-cli binary |
MVA, NC, CTMC, MAM, FLD, SSA, BA, AG, AUTO, JMT, LN (steady state), ENV |
- Java: the JAR is taken from
$LINE_JLINE_JAR, the installed package or a checkout'scommon/, and downloaded automatically if none is found. - C++: the binary is taken from
$LINE_CLI_BINARY, a checkout'scommon/orcpp/build/, orPATH, and downloaded automatically (Linux x86-64) if none is found. From a source checkout you can instead build it withcmake -S cpp -B cpp/build -DCMAKE_BUILD_TYPE=Release && cmake --build cpp/build --target line-cli. It also acceptsarith="exact"orarith="real:<digits>"(16, 32, 64, 128 or 256 digits) for exact or extended-precision arithmetic.
Set LINE_SOLVER_LANG=java (or cpp) to change the default for a session. If the C++ binary cannot be found or run, LINE falls back to native Python with a warning; any other error, including a missing Java runtime for lang="java", is raised.
Symbolic analysis in SolverCTMC and SolverFLD runs on a SageMath service, falling back on sympy when it is not available. To enable it, pull its Docker image once:
docker pull imperialqore/line-sage-rest:latest
LINE then starts and stops the container automatically.
Released under the BSD-3 license.