AI-powered optimization model tuning
Project description
Gurobi Optimizer Agent
Automatically speed up any Gurobi optimization model.
An AI agent that analyzes your model, identifies bottlenecks, and finds the best solver settings and formulation improvements.
What It Does
Input: Your Gurobi model (.mps, .lp, or gurobipy)
Output: Faster solve time + recommendations
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Your Model │ → │ Agent │ → │ 30% faster │
│ │ │ analyzes │ │ + report │
└─────────────┘ └─────────────┘ └─────────────┘
Quick Start
# Install
pip install gurobipy numpy
# Clone
git clone https://github.com/danielpuri1901/tax-optimization-agent.git
cd tax-optimization-agent
# Run on your model
python demo.py
Usage
from src.agent.general import GurobiAgent
# Load your model
import gurobipy as gp
model = gp.read("your_model.mps") # or build with gurobipy
# Run the agent
agent = GurobiAgent()
result = agent.improve(model)
# See results
print(f"Best: {result.best_improvement} ({result.best_speedup:+.1f}%)")
print(f"Params: {result.best_params}")
How It Works
- Profile - Analyzes model structure (variables, constraints, sparsity, symmetry)
- Match - Selects improvements likely to help based on detected patterns
- Smoke Test - Quick tests to filter out bad candidates
- Benchmark - Full tests on promising improvements
- Report - Returns best settings and recommendations
Example Results
| Model | Baseline | Best Improvement | Speedup |
|---|---|---|---|
| Supply Chain (150K vars) | 0.194s | disaggregate_constraints | +23.7% |
| Tax Optimization (10K constrs) | 4.2s | aggregation | +99.8% |
| Facility Location (2K binary) | 0.084s | Already optimal | - |
What It Tries
Solver Parameters:
- MIPFocus (feasibility, optimality, bound)
- Cuts (off, moderate, aggressive)
- Presolve (off, conservative, aggressive)
- Method (primal, dual, barrier)
- Heuristics, Threads, Symmetry
Formulation Transforms:
- Variable bound tightening
- Symmetry breaking constraints
- Constraint disaggregation
Requirements
- Python 3.11+
- Gurobi with valid license (free academic license)
- numpy
Project Structure
├── src/agent/general/ # Core agent
│ ├── agent.py # Main GurobiAgent class
│ ├── profiler.py # Model analysis
│ ├── catalog.py # Improvement library
│ └── matcher.py # Rule-based selection
├── demo.py # Simple demo
├── demo_supply_chain.py # Supply chain example
└── run_general_agent.py # Full demo with multiple models
License
MIT - see LICENSE
Contributing
Issues and PRs welcome. If you have a model where the agent helped (or didn't), we'd love to hear about it.
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
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 optimaze-0.3.0.tar.gz.
File metadata
- Download URL: optimaze-0.3.0.tar.gz
- Upload date:
- Size: 105.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baa58ec229041c79fb422745a00f851c2b64bd2664e7a3f7de7658dcff8fd160
|
|
| MD5 |
0ee2c4d436b36f96a5f45380615217bb
|
|
| BLAKE2b-256 |
a854f12a0e5ec630fddea6cf4dce8493acb2c3f5be5764d3dcd6fa9cc62e8de0
|
File details
Details for the file optimaze-0.3.0-py3-none-any.whl.
File metadata
- Download URL: optimaze-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8f44cbb93b9c67256a8206669a35677824f10c303bdec4c920120c78d02b848b
|
|
| MD5 |
b102100423a610c51eb336c373edb695
|
|
| BLAKE2b-256 |
3a30f3ca4d85a0c5c17da214b8158130e6c1d10f418abd0d5022a9d840beba9a
|