Skip to main content

A unified framework for Operation Research modeling with polars

Project description

A polars based optimization framework

xplor: A Modern DataFrame-Centric Optimization Framework

PyPI version License

xplor provides a unified framework for building Operation Research models using polars DataFrames. By leveraging polars' performance and ergonomic API, xplor makes mathematical optimization more intuitive and maintainable.

Why xplor?

Building large-scale optimization models in Python can become inefficient. Standard approaches often require iterating over rows, manipulating Python dictionaries, or using slow list comprehensions, which makes the logic slow and difficult to maintain as the model grows.

xplor solves this core issue by using a Polars-based DataFrame API to construct your model logic. This provides two significant benefits:

  1. Vectorized Performance: Model operations (like grouping, joining, filtering, and aggregation) are executed using Polars' high-performance Rust backend. You are no longer manipulating slow Python objects*; the logic is executed at native speed.
  2. Maintainability: By relying on the familiar and expressive DataFrame API, your model logic becomes significantly more readable and maintainable.

Additionally, a huge benefit of xplor is its solver agnosticism. It abstracts away the specific syntax of underlying optimization engines (like Gurobi or MathOpt), allowing you to define a single model and easily benchmark its performance across multiple solvers.

* Clarification: Variable, variable expression, and constraint objects themselves are still Python objects (e.g., gurobi.Var or mathopt.Variable), but the data manipulation and application of model logic are managed by Rust via Polars' User-Defined Functions (UDFs), enabling vectorized performance.

Installation

xplor requires Python 3.11+.

Install the base package, which provides the core Polars integration and abstract modeling interface:

xplor comes with few dependencies. To use a specific solver you need to add optional dependency group.

pip install xplor[gurobi, ortools]

or install all of them

pip install xplor[all]

Note: Gurobi requires a a valid license (academic or commercial) to run. Please follow the official Gurobi documentation for setup instructions.

Quick Start

Have a look to the documentation.

🟢 Current Status

xplor is in active development.

Currently Supported Backends

  • Gurobi backend
  • OR-Tools backend
  • Hexaly backend

Planned Features

  • 🚧 Support for additional solvers (CPLEX, ...).
  • 🚧 Support for non-linear expressions.

Contributing

Want to contribute? Read our contributing guide.

License

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

Acknowledgments

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

xplor-0.3.4.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

xplor-0.3.4-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

Details for the file xplor-0.3.4.tar.gz.

File metadata

  • Download URL: xplor-0.3.4.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xplor-0.3.4.tar.gz
Algorithm Hash digest
SHA256 f3d11b61fd644e2dd16930dbb1c77f5461ae93457bd1f14571757eabddc13fef
MD5 d9c33fabbc108f08190fdbfedfac0cef
BLAKE2b-256 a5197c830e1d724dabbf9b3e81c0b9e0d7107f69b201431015243e992260be0a

See more details on using hashes here.

File details

Details for the file xplor-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: xplor-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for xplor-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9f262082a08cc98b6db7ad43c7932d7d064040ed36f0ff22f2badf8ac89cd9e0
MD5 b05946ed5669a3009d4c4acac9c6d4d9
BLAKE2b-256 e007a5a789469fdf2d8840b87a8ed5968118aef50c0d0e50c096a8adf0b52207

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