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, cplex]

or install all of them

pip install xplor[all]

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

Note: CPLEX requires a valid license (academic or commercial) to run. Please follow the official CPLEX 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
  • CPLEX backend (via docplex)

Planned Features

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

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.6.1.tar.gz (30.0 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.6.1-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xplor-0.6.1.tar.gz
  • Upload date:
  • Size: 30.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.6.1.tar.gz
Algorithm Hash digest
SHA256 49cb4e6b088aae9deab86972c0b2b2760b7713dbd28ade4b49d2cc3f5707c20f
MD5 c4a295ade7b3944a68b98ec176339073
BLAKE2b-256 b80c0f1b391f5d74257647a2364707829cd592ebeb5f0d35d5cef00a8cd1d51d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xplor-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","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.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ad72d3816c792c9ee73cfdbe35e89e99cdde19f3239d61102f7816618a0c28a8
MD5 d1f66af92126d6c2d45f64b9af5db6ea
BLAKE2b-256 32678b982eea4f0d0b15a7286bf2a9731511687edacbcc9975c481bc4d767835

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