Skip to main content

Tivra, a fast and agile solver based on PDHG, capable of running on multiple hardware accelerators

Project description

तिव्र (Tivra)

तिव्र (Tivra, derived from the Sanskrit word तीव्र, meaning "fast" or "swift") is a Python library designed for solving optimization problems at incredible speeds, using the Primal-Dual Hybrid Gradient (PDHG) algorithm. This solver integrates seamlessly with open-source optimization modeling frameworks like Pyomo, enabling users to leverage the power of rapid and efficient optimization in their Python workflows.

About PDHG

The Primal-Dual Hybrid Gradient (PDHG) algorithm is a state-of-the-art optimization technique that efficiently solves saddle-point problems that often arise in convex optimization. Known for its simplicity and scalability, PDHG eliminates the need for expensive operations like matrix factorization, making it particularly suitable for solving large-scale problems quickly and with minimal resource overhead.

Why choose PDHG?

  • Fast Convergence: PDHG provides high-speed convergence while maintaining numerical stability. It is one of the fastest optimization algorithms available for convex problems.
  • Efficiency at Large Scales: The algorithm's computational simplicity and low memory requirements make it capable of handling large-scale models effectively.

Leveraging Hardware Accelerators

One of the defining features of Tivra is its ability to utilize multiple hardware accelerators to significantly reduce solve times. Whether you are working on CPUs, GPUs, or multi-core systems, the solver takes full advantage of available computational resources, seamlessly distributing workloads to improve performance.

This feature allows Tivra to excel not only in optimizing single-thread tasks but also in parallelized computations, unlocking immense power for solving high-dimensional optimization problems quickly, across a variety of hardware environments.


Features

  • Fast and Scalable: Based on the PDHG algorithm, priority is given to performance at scale.
  • Seamless Integration with Pyomo: Supports Python-based languages for defining optimization models fluidly.
  • Hardware Acceleration: Includes support for CPUs, GPUs, and beyond.
  • Open Source: Fully open and modifiable for a variety of use cases, adhering to community-driven development.

Installation

Install the latest version of Tivra from PyPI:

pip install tivra

Usage

Integration with Pyomo

Here’s how you can solve a Pyomo model with Tivra:

  1. Define your optimization model in Pyomo.
  2. Use Tivra as the solver for the model.

Example:

from pyomo.environ import *
from tivra import TivraSolver

# Define simple Pyomo model
model = ConcreteModel()
model.x = Var(domain=NonNegativeReals)
model.y = Var(domain=NonNegativeReals)
model.obj = Objective(expr=model.x + model.y, sense=minimize)
model.constraint = Constraint(expr=model.x + 2 * model.y >= 1)

# Use Tivra to solve the model
solver = TivraSolver()
results = solver.solve(model)

print(results)

Standalone Use

You can also use Tivra independently of Pyomo by defining optimization problems directly in its native interface. Please refer to the documentation for advanced use cases.

Hardware Acceleration

To run Tivra on hardware accelerators like GPUs or multi-core CPUs, configuration is automatic. However, you can fine-tune resource use (e.g., number of CPU threads, specific GPU device, etc.) through settings.


Documentation

Comprehensive documentation for Tivra can be found at Tivra Docs. It includes:

  • Installation Guide
  • Tutorials
  • API Reference
  • Examples and Recipes

Contribution

We warmly welcome contributions to Tivra. To contribute:

  1. Fork the repository on GitHub.
  2. Create a feature branch for your changes.
  3. Create and submit a pull request explaining your addition.

For reporting bugs or requesting features, please open an issue on the GitHub tracker.


License

Tivra is licensed under the MIT License. You are free to use, modify, and distribute it as per the terms of the license.


Acknowledgements

We would like to thank all contributors and the Pyomo community for their collaboration and support in creating a fast and efficient solution for optimization problems.


Start solving faster today with Tivra—the swift and efficient solver for Python-based optimization. 🎉

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

tivra-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

tivra-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file tivra-0.1.0.tar.gz.

File metadata

  • Download URL: tivra-0.1.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for tivra-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0bd7b4b9fa6e3b356e97376da8b245f2371eac2c7caa49bd8bf9b18390b775c2
MD5 9debb14bb4272393181bd35b7b1364dd
BLAKE2b-256 693960827303f6cafa6de8d070d6e8e2fbcf82875150471aac5748d81ae1fa3c

See more details on using hashes here.

File details

Details for the file tivra-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tivra-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.18

File hashes

Hashes for tivra-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ba33784a2cd073b5e5ee7144352e99b10cdb3518fe5d6a51dfa5fbf90aa45b9
MD5 96a1b76fc03e0ca6e50bcb57ee7a79fc
BLAKE2b-256 6c0b973d54577ea1c7454958766a2aca4da251f4abfd588e7d6bc008d13d1724

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