Skip to main content

Automatic constraint analysis and debugging for Pyomo linear solvers

Project description

PyomoSolverAnalyzer

A constraint analysis and debugging toolkit for Pyomo, an open-source optimization modeling language in Python. This library provides tools for analyzing solver outputs, diagnosing infeasibility, and identifying binding constraints in linear optimization models.

Features

Three core capabilities designed to help you understand and improve optimization models:

  • Find Bottlenecks: Identify tight constraints limiting your solution (via ConstraintAnalyzer)
  • Diagnose Infeasibility: When models fail to solve, diagnose constraint violations and their severity (via UnfeasibilityDetector)
  • Extract Insights: Unified interface extracting dual values, slack analysis, and sensitivity metrics (via SolverDiagnostics)

Installation

Install from PyPI:

pip install pyomo-solver-analyzer

Or install from source with development dependencies:

git clone https://github.com/jaimeam/Pyomo-Solver-Analyzer.git
cd PyomoSolverAnalyzer
pip install -e ".[dev]"

Quick Start

The simplest approach is to use SolverDiagnostics for complete analysis:

from pyomo_solver_analyzer import SolverDiagnostics
import pyomo.environ as pyo

model = pyo.ConcreteModel()
# ... define and solve your model ...
solver = pyo.SolverFactory('glpk')
results = solver.solve(model)

# One-line diagnostics report
diagnostics = SolverDiagnostics(model, results)
diagnostics.print_report()

For specialized analyses or detailed examples, see the Examples Guide.

Documentation

Development

For detailed development setup instructions, see DEVELOPMENT.md.

Project Structure

PyomoSolverAnalyzer/
├── src/
│   └── pyomo_solver_analyzer/       # Main package
│       ├── __init__.py
│       ├── analyzer.py
│       ├── diagnostics.py
│       ├── introspection.py
│       └── unfeasibility.py
├── tests/                           # Test suite
├── docs/                            # Documentation
├── README.md
├── LICENSE
├── pyproject.toml                   # Project configuration
└── DEVELOPMENT.md

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Before committing, ensure:

  1. Code passes ruff linting: ruff check src/
  2. Code passes mypy type checking: mypy src/
  3. Tests pass: pytest tests/
  4. Pre-commit hooks pass: pre-commit run --all-files

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For issues, questions, or feature requests, please open an issue on GitHub.

Citation

If you use this library in your research, please cite:

@software{pyomo_solver_analyzer,
  title={Pyomo Solver Analyzer},
  author={Adroher, Jaime},
  year={2025},
  url={https://github.com/jaimeam/Pyomo-Solver-Analyzer}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyomo_solver_analyzer-0.1.1.tar.gz (108.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyomo_solver_analyzer-0.1.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file pyomo_solver_analyzer-0.1.1.tar.gz.

File metadata

  • Download URL: pyomo_solver_analyzer-0.1.1.tar.gz
  • Upload date:
  • Size: 108.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for pyomo_solver_analyzer-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d80123da491a1729445ec7218352b0aff5da824513fbd72fd8713c3ce197902b
MD5 51365e2e6d0cbca65663fb123a9d9382
BLAKE2b-256 0888adcf8917ea6915c25ff50fb84c42c530a7ada522cc1207ce8970f01504de

See more details on using hashes here.

File details

Details for the file pyomo_solver_analyzer-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyomo_solver_analyzer-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 61fb4b5a1f7f209760b15ea3dae0e0e3f99391f3ff8eb401b93a248d0fda802a
MD5 dd3786b0c1cdaf604686a7a1167b4f69
BLAKE2b-256 358f08a4628204b802f0af09d635b354c9971c2228cd09b51e17a274564e0653

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page