Solver-intrinsic explanations and reoptimization for linear programming
Project description
CLARA — Classical LP Analysis for Reoptimization and Attribution
A solver-intrinsic explanation framework for linear programming. CLARA extracts explanations directly from the simplex basis inverse $B^{-1}$ — without machine learning surrogates, without inverse formulations — and unifies factual and counterfactual perspectives on LP explainability within a single geometric framework.
What CLARA does
CLARA contributes two central capabilities, complemented by two supporting modules:
- Factual–counterfactual duality — a formal bound showing that the basis robustness $d_0$, computable in $O(mn)$ time from $B^{-1}$ alone, lower-bounds the cost of any basis-changing counterfactual explanation. Connects classical sensitivity analysis with counterfactual explanations for optimization.
- Reoptimization pipeline — automatic change detection, Oguz-bound impact analysis, warm-start method selection (primal simplex, dual simplex, or parametric LP), and structured diff reports.
- Simultaneous sensitivity regions (supporting) — Chebyshev center of the basis-preserving polyhedron, the geometric foundation of the duality bound.
- Objective-change attribution (supporting) — first-order and Shapley decomposition that annotates diff reports during reoptimization.
CLARA also offers two solver backends:
- Internal Revised Simplex — full transparency, retains $B^{-1}$ at every pivot for downstream analysis (practical for $n \le 100$).
- HiGHS — production-grade reference solver; CLARA reconstructs $B^{-1}$ from the reported basis for larger problems.
Installation
pip install clara-opt
For development:
git clone https://github.com/yoonsik-jung-opt/clara-opt.git
cd clara-opt
pip install -e ".[dev]"
Quick Start
# Explain a production planning problem
clara explain examples/production.lp
# Brief summary
clara explain problem.lp --level brief
# JSON output
clara explain problem.lp --format json
# Use HiGHS engine for larger problems
clara explain problem.lp --engine highs
# Solve only (no explanation)
clara solve problem.lp
# Problem info
clara info problem.lp
Python API
from clara.io import read_lp
from clara.engine.simplex import RevisedSimplex
from clara.explain import Explainer
problem = read_lp("problem.lp")
state = RevisedSimplex(problem).solve()
report = Explainer().explain(state, problem=problem)
print(report.to_text())
Academic Use
CLARA contributes to the explainability of mathematical optimization solvers, a research area surveyed by De Bock et al. (2024) in the XAIOR framework.
A manuscript describing the framework is in preparation. Citation information will be added here when a preprint or peer-reviewed version is available.
License
MIT © 2026 Yoonsik
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file clara_opt-0.2.2.tar.gz.
File metadata
- Download URL: clara_opt-0.2.2.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba72da2b9f7fbccdf3cd46150caa09571faae7ad91fd9e4a027874e7c8a7c225
|
|
| MD5 |
1bcfdb2a5eb8332ae20d93e8ac07ca0c
|
|
| BLAKE2b-256 |
1407ff7cc8c577e61167d3c20aab511656de8ce05075b5b28471ae92d881099d
|
File details
Details for the file clara_opt-0.2.2-py3-none-any.whl.
File metadata
- Download URL: clara_opt-0.2.2-py3-none-any.whl
- Upload date:
- Size: 109.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
21caf318ad8b1ba3d46ffd51e487345bd6f628415278f040d4d35edf0b2d7e54
|
|
| MD5 |
01e1227a947881a8fdfda6b0afed27e9
|
|
| BLAKE2b-256 |
2a13e78ac94a3d75501eb77b1c8c626cd1aaff7586644707c91e5bf38aa7dc46
|