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.1.tar.gz (28.2 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.1-py3-none-any.whl (39.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xplor-0.5.1.tar.gz
  • Upload date:
  • Size: 28.2 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.1.tar.gz
Algorithm Hash digest
SHA256 dfd42ed1c10371e1effebad4f32d09365f413c481933ade5aebfc957931b0cef
MD5 39a5f524fab2395432e590cb166bf41a
BLAKE2b-256 1c090ef18c4604eec8f72196ad4131fabec0ce692ca12688dc5f8ba527c1e43f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xplor-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 39.8 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2dc3eb443dd34cc49b0da338772f1de26dc75ddac72a4a765122df4135cf675d
MD5 5b9b31793156ce6619c3406bf03f5c58
BLAKE2b-256 c44b82b29e7fd36aab5d19758d06281a6062e5c8454e002876b7170a220ab2d4

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