Skip to main content

तिव्र (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. 🎉

Metadata

Release files for tivra 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tivra 0.2.0
File Size Uploaded Provenance Actions
tivra-0.2.0.tar.gz 12.9 kB Without provenance Details for tivra-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tivra 0.2.0
File Interpreter ABI Platform Actions
tivra-0.2.0-py3-none-any.whl Python 3 none any Details for tivra-0.2.0-py3-none-any.whl

Total release size: 23.1 kB

Release files / tivra-0.2.0.tar.gz

Download URL tivra-0.2.0.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b73556f00021d729c9ee5f1022ca6225ec612bb226149d0867c2b5d60ca93e7e
BLAKE2b-256 checksum
How to use checksums
c9c9d15dc42027f3ffbae00bb15587e5392f466af7b0f784976a412d0671fd6b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.18

Release files / tivra-0.2.0-py3-none-any.whl

Download URL tivra-0.2.0-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8ccfbe07b857f648e3d96294bedcb8067e102fb13556e0c401873e23e77c8e8
BLAKE2b-256 checksum
How to use checksums
0dcb0f1f73b5a4ffe60a9ffc5b540b9b0fb5263bc4543e643eb2b690c4bddffe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.18

Security for tivra 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page