THE GUIDE
Alleria documentation
From a model on disk to a solution in Python. Read the current workflows; running the solver requires source access.
Alleria, previously Hermes, now supports from alleria import solve_file and the alleria_api command. Existing Hermes imports and commands continue to work. The source repository BruninLima/alleria is currently private. With existing repository access, install from the checkout; the distributions are alleria-solver and alleria-native, with compatibility imports for Hermes users. Public visitors can read this guide and explore the browser examples without installing the solver.
Install from source.
The commands below are for collaborators who already have access to the repository. A public visitor cannot clone it. This documentation and the interactive browser examples remain available without source access.
You need Git, a recent stable Rust toolchain with Rust 2024 edition support, and Python 3.10 or later for the wrapper. On Windows, use Visual Studio Build Tools with the MSVC C++ workload; macOS needs Xcode Command Line Tools, and Linux needs a C/C++ build toolchain.
git clone https://github.com/BruninLima/alleria.git
cd alleria
cargo build --release --bin alleria_api
python -m pip install -e ./pythonThis builds the CLI and installs the Python wrapper in your active environment. No published Alleria package is assumed. You can now solve LP/MPS files with the CLI backend.
Run the compiled binary as ./target/release/alleria_api.exe. The Python wrapper finds the executable automatically when installed from this checkout.
Start with Python.
Use solve_file with a linear LP or MPS model. backend="auto" tries the native module first and falls back to the CLI for file-based models.
from alleria import solve_file
result = solve_file(
"model.mps",
backend="auto",
preset="exact",
include_primal=True,
)
print(result.status, result.objective, result.best_bound)
if result.incumbent_primal is not None:
for name, value in zip(result.column_names, result.incumbent_primal):
print(name, value)Choose backend="cli" to force the executable or backend="inprocess" to require the native module. File parsers can reorder columns; pair column_names with incumbent_primal.
Add the native backend.
solve_model takes a Python dictionary and requires the PyO3 extension. Build it in the same active Python environment as the wrapper:
python -m pip install maturin
python -m maturin develop --manifest-path ./python/native/Cargo.toml --releaseRun this inside an active virtual environment or conda environment. Rebuild the extension after Rust or native-binding changes; edits to the Python wrapper do not need a native rebuild.
from alleria import solve_model
# Define columns and constraints with the schema below.
result = solve_model(
model,
backend="inprocess",
preset="exact",
include_primal=True,
)
print(result.status, result.objective)The command-line interface.
The CLI accepts LP/MPS files and emits a JSON result. On macOS or Linux:
./target/release/alleria_api --input model.mps --preset exact --include-primalOn Windows, add .exe to the executable name. Run ./target/release/alleria_api --help for the complete list of options.
| Option | Purpose |
|---|---|
--input | Path to your model file. |
--preset exact | Use the exact search preset. |
--include-primal | Include variable names and primal values. |
--max-nodes | Limit the MILP search nodes. |
--max-wall-seconds | Set a cooperative linear-MILP time limit. |
A wall limit can be exceeded while an active LP solve finishes. The exact preset is a search configuration; it does not make floating-point arithmetic exact or certify every result.
Three pieces of a model.
The top level requires columns and constraints. Optional name labels the model; objective_sense accepts "minimize" (the default) or "maximize".
Columns: the decisions
| Field | Example | Meaning |
|---|---|---|
name | "x" | Variable name. |
lower_bound | 0.0 | Lower variable bound. |
upper_bound | 10.0 | Upper variable bound. |
obj_coeff | 3.0 | Coefficient in the objective. |
col_type | "continuous" | continuous, integer, or binary. |
Use ordered bounds. For binary variables, specify bounds from 0 to 1.
Constraints: the limits
{
"name": "capacity",
"sense": "<=",
"rhs": 4.0,
"coeffs": [[0, 1.0], [1, 1.0]],
}coeffs contains [column_index, coefficient] pairs. Column indices start at zero and follow the order of columns. Row senses are "<=", "=", and ">=". Every row needs a name, sense, rhs, and coeffs.
A result is more than a number.
| Field | What to look for |
|---|---|
status | The reported outcome; inspect it before using a solution. |
objective | Value of the incumbent, when one is available. |
best_bound | Remaining search bound, when available. |
column_names | Names in the returned primal's order. |
incumbent_primal | Variable values with include_primal=True; can be absent. |
nodes_explored, cuts_added | Search work, which varies by model and solver path. |
profile | LP, branching, heuristic, and other execution diagnostics. |
A time or node limit can leave a feasible incumbent without an optimality proof. Check that values exist, inspect the status and bound, and validate the solution against the original constraints. Avoid treating every returned objective as a proven optimum.
Know the current scope.
Version 0.8.21 is a development version. The primary focus is linear programming and mixed-integer linear programming. Presolve, branch-and-cut, heuristics, persistent native LP sessions, and original-model candidate checks are part of the current implementation.
- Linear LP/MPS file parsing and Python dictionary models are supported.
- Quadratic models use native JSON; convex outer approximation and bounded nonconvex paths are experimental and have additional scope requirements.
- Whole-solver hard deadlines and memory enforcement remain open work.
- Broader numerical certification and performance qualification are ongoing. Known numerical edge cases remain under investigation.
- Results on selected problem families do not establish general performance superiority.
The optional visualizer is a separate local tool for recorded solver traces, replay, and comparisons. This site’s knapsack explorer is a browser-based educational demonstration.
Try the documented models