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.4.0.tar.gz (17.8 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.4.0-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xplor-0.4.0.tar.gz
  • Upload date:
  • Size: 17.8 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.4.0.tar.gz
Algorithm Hash digest
SHA256 9391756bbdc3534f0f0933bd32ee60bda9c148c726465edbd6432beb7013dc62
MD5 b033736ede49761d46ca6b2eb277ccbb
BLAKE2b-256 9d227b045df6ccf07e1152272261501ffeb7567e6849e79965266e8eecdc35cc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xplor-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 29.1 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.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e569feb5783d38330e8a39db1e639308c167e050ca55e96fe53dd10f482c5ee
MD5 59943522843334120fac5c510fda1910
BLAKE2b-256 23ed407da37926c34cd191e41e45cb3630b4ab36840128cbcac3ce735b53681e

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