Metadata-Version: 2.4
Name: optvpy
Version: 3.8.1
Summary: Python Interface for Optverse Solver
Maintainer: OptVerse Solver Team
License-Expression: LicenseRef-OptVerse-EULA
Project-URL: Homepage, https://github.com/OptVerse-Solver
Project-URL: Documentation, https://optverse-user-manual.readthedocs.io/en/latest/
Keywords: solver,sdk,optimization,mip,lp
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=2.2.4
Requires-Dist: scipy
Provides-Extra: test
Requires-Dist: pytest==8.3.5; extra == "test"
Requires-Dist: iniconfig==2.1.0; extra == "test"
Requires-Dist: packaging==24.2; extra == "test"
Requires-Dist: pluggy==1.5.0; extra == "test"
Requires-Dist: exceptiongroup==1.2.2; python_version < "3.11" and extra == "test"
Requires-Dist: tomli==2.2.1; python_version < "3.12" and extra == "test"
Dynamic: license-file

# optvpy

**optvpy** is the official Python interface to the **OptVerse Solver**, a high-performance mathematical optimization solver developed by Huawei.

OptVerse supports linear programming (LP), quadratic programming (QP), and mixed-integer linear programming (MILP).

The trial license bundled with this package allows you to solve LP/MILP problems with fewer than 20,000 variables and 20,000 constraints. To request a trial license for larger-scale problems and learn more, please visit:

- [Project Homepage](https://github.com/OptVerse-Solver)
- [User Manual](https://optverse-user-manual.readthedocs.io/en/latest/)

## Installation

`pip install optvpy`

## Quick Start Example

```python
from optvpy import *

env = OPTVEnv("milp1.log")
# Before model construction: set parameters through environment
env.Set(OPTVDblParam.TIME_LIMIT, 7200)

model = OPTVModel(env)
# After model construction: set parameters through model
model.Set(OPTVStrParam.RESULT_FILE, "milp1.sol")

# add variables to the model
x = model.AddVar(0, 1, -1, OPTV_BINARY, "x")
y = model.AddVar(0, OPTV_INF, -14, OPTV_INTEGER, "y")
z = model.AddVar(0, 3, -6, OPTV_CONTINUOUS, "z")

# add constraint to the model
c0 = model.AddConstr(2 * x + y + z, -OPTV_INF, 3, "c0")
c1 = model.AddConstr(3 * y + z, -OPTV_INF, 6, "c1")

# optimize the model
model.Optimize()
model.Write("milp1.lp")

# get solution info
print(f"Best solution: {model.Get(OPTVDblAttr.OBJ_VAL)}")
print(f"x = {x.Get(OPTVDblAttr.X)}")
print(f"y = {model.GetVar(1).Get(OPTVDblAttr.X)}")
print(f"z = {model.GetVarByName('z').Get(OPTVDblAttr.X)}")
```
