Metadata-Version: 2.4
Name: line-solver
Version: 3.0.9.0
Summary: Simulation and algorithms for queueing theory
License: BSD-3
License-File: AUTHORS
License-File: LICENSE
Author: Giuliano Casale
Author-email: g.casale@imperial.ac.uk
Requires-Python: >=3.11
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Provides-Extra: gpu
Provides-Extra: native
Provides-Extra: symbolic
Requires-Dist: matplotlib (>=3.10.6,<4.0.0)
Requires-Dist: mcp (>=2.0,<3.0)
Requires-Dist: networkx (>=3.6,<4.0)
Requires-Dist: numpy (>=2.3.3,<3.0.0)
Requires-Dist: pandas (>=2.3.2,<3.0.0)
Requires-Dist: scipy (>=1.16.2,<2.0.0)
Requires-Dist: sympy (>=1.10) ; extra == "symbolic"
Requires-Dist: torch (>=2.0.0) ; extra == "native" or extra == "gpu"
Requires-Dist: websockets (>=12.0,<13.0)
Project-URL: Homepage, https://line-solver.sourceforge.net
Description-Content-Type: text/markdown

# LINE Solver for Python
The Python version of the [LINE solver](http://line-solver.sf.net) for queueing models.

## Installation
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).

## Quick start
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/`.

## Documentation
See the [Python manual](https://line-solver.sourceforge.net/doc/LINE-user-python.pdf). The syntax closely mirrors the MATLAB version: compare the `examples/gettingstarted/` scripts of the two.

## Choosing the engine (`lang=`)
Every solver takes a `lang` keyword that selects which engine does the work. The model code stays the same:
```python
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's `common/`, and downloaded automatically if none is found.
- **C++**: the binary is taken from `$LINE_CLI_BINARY`, a checkout's `common/` or `cpp/build/`, or `PATH`, and downloaded automatically (Linux x86-64) if none is found. From a source checkout you can instead build it with
  `cmake -S cpp -B cpp/build -DCMAKE_BUILD_TYPE=Release && cmake --build cpp/build --target line-cli`.
  It also accepts `arith="exact"` or `arith="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 backend (optional)
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.

## License
Released under the [BSD-3 license](http://opensource.org/licenses/BSD-3-Clause).

