Alleria Source (private)

THE GUIDE

Alleria documentation

From a model on disk to a solution in Python. Read the current workflows; running the solver requires source access.

A new name, the same working interface.

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.

01 / GET SET UP

Install from source.

Private source — authorized access required.

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.

For collaborators with repository access
git clone https://github.com/BruninLima/alleria.git
cd alleria
cargo build --release --bin alleria_api
python -m pip install -e ./python

This 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.

On Windows

Run the compiled binary as ./target/release/alleria_api.exe. The Python wrapper finds the executable automatically when installed from this checkout.

02 / SOLVE A FILE

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.

solve.py
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.

Download a complete file example →

03 / BUILD A MODEL IN MEMORY

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:

Native setup
python -m pip install maturin
python -m maturin develop --manifest-path ./python/native/Cargo.toml --release

Run 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.

Using the model API
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)

See a complete two-variable model →

04 / WORK FROM THE TERMINAL

The command-line interface.

The CLI accepts LP/MPS files and emits a JSON result. On macOS or Linux:

CLI
./target/release/alleria_api --input model.mps --preset exact --include-primal

On Windows, add .exe to the executable name. Run ./target/release/alleria_api --help for the complete list of options.

Useful options
OptionPurpose
--inputPath to your model file.
--preset exactUse the exact search preset.
--include-primalInclude variable names and primal values.
--max-nodesLimit the MILP search nodes.
--max-wall-secondsSet a cooperative linear-MILP time limit.
Limits and precision

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.

05 / MODEL REFERENCE

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

Required column fields
FieldExampleMeaning
name"x"Variable name.
lower_bound0.0Lower variable bound.
upper_bound10.0Upper variable bound.
obj_coeff3.0Coefficient 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

x + y ≤ 4
{
    "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.

06 / READ THE OUTCOME

A result is more than a number.

Core result fields
FieldWhat to look for
statusThe reported outcome; inspect it before using a solution.
objectiveValue of the incumbent, when one is available.
best_boundRemaining search bound, when available.
column_namesNames in the returned primal's order.
incumbent_primalVariable values with include_primal=True; can be absent.
nodes_explored, cuts_addedSearch work, which varies by model and solver path.
profileLP, 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.

07 / PROJECT STATUS

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