Skip to main content

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.

Demo Python License

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

  1. Profile - Analyzes model structure (variables, constraints, sparsity, symmetry)
  2. Match - Selects improvements likely to help based on detected patterns
  3. Smoke Test - Quick tests to filter out bad candidates
  4. Benchmark - Full tests on promising improvements
  5. 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

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

optimaze-0.3.0.tar.gz (105.5 kB view details)

Uploaded Source

Built Distribution

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

optimaze-0.3.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

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

Hashes for optimaze-0.3.0.tar.gz
Algorithm Hash digest
SHA256 baa58ec229041c79fb422745a00f851c2b64bd2664e7a3f7de7658dcff8fd160
MD5 0ee2c4d436b36f96a5f45380615217bb
BLAKE2b-256 a854f12a0e5ec630fddea6cf4dce8493acb2c3f5be5764d3dcd6fa9cc62e8de0

See more details on using hashes here.

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

Hashes for optimaze-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8f44cbb93b9c67256a8206669a35677824f10c303bdec4c920120c78d02b848b
MD5 b102100423a610c51eb336c373edb695
BLAKE2b-256 3a30f3ca4d85a0c5c17da214b8158130e6c1d10f418abd0d5022a9d840beba9a

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