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.5.0.tar.gz (26.5 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.5.0-py3-none-any.whl (38.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xplor-0.5.0.tar.gz
  • Upload date:
  • Size: 26.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.5.0.tar.gz
Algorithm Hash digest
SHA256 32d366788e64169fe7f805f106e6449160a6c90822156c83012081a94d05f7a3
MD5 d62a5d39cb1a0ffa34c5e45b02344fd9
BLAKE2b-256 3193f28e948ce8ae21b355bbdc1dd947c9931d5c1c4bcdf641f5361512ef021b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xplor-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 38.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","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.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61190b02cdd2af805d102d6404cc6d7057c99d26e1b7f6a6bdc948606e932bbc
MD5 1a9122150a507bdd5894f18fba194f19
BLAKE2b-256 3b843de454cda9b69ec2a03da74f88ea346d604454e1f2b82b733fa190414e0a

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