Skip to main content

mip-cvxpy

PyPI | Test

This package allows you to solve CVXPY problems using the python-mip package as a backend solver. It works for mixed integer linear problems.

This allows you to use CBC from CVXPY without needing to manually install CBC. By default, CVXOPT calls CyLP to use CBC and requires CBC to be manually installed. python-mip, on the other hand, comes with CBC bundled through pypi.

This package is based heavily off the CyLP/CBC interface and is slower: on smaller problems mip_cvxpy interface takes perhaps 1.3x as long as CyLP, and on larger problems perhaps 5x as long (see the benchmark in the test suite). CyLP has a significant advantage in natively supporting sparse matrices and vectorisation.

Installation

Install from pypi

pip install mip_cvxpy

Usage

Use as a custom solver

import numpy as np
import cvxpy as cp
from mip_cvxpy import PYTHON_MIP

n = int(1e3)
vars = cp.Variable(n, integer=True)
objective = cp.Maximize(cp.sum(vars))
constraints = [
    vars[0] == 1,
    vars <= np.linspace(10, n + 10, num=n),
]
problem = cp.Problem(objective, constraints)

optimal_value = problem.solve(solver=PYTHON_MIP())
print(problem.status)

Additional solver options

You can pass additional solver options like

optimal_value = problem.solve(solver=solver, max_seconds=10, other_option=7)

This is equivalent to

import mip
m = mip.Model()
m.max_seconds=10
m.other_option=7
...

Metadata

Release files for mip-cvxpy 0.0.2

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

Source distribution (sdist)

Source distribution for mip-cvxpy 0.0.2
File Size Uploaded Provenance Actions
mip-cvxpy-0.0.2.tar.gz 4.3 kB Without provenance Details for mip-cvxpy-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mip-cvxpy 0.0.2
File Interpreter ABI Platform Actions
mip_cvxpy-0.0.2-py3-none-any.whl Python 3 none any Details for mip_cvxpy-0.0.2-py3-none-any.whl

Total release size: 12.9 kB

Release files / mip-cvxpy-0.0.2.tar.gz

Download URL mip-cvxpy-0.0.2.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a259a7d94494be5461a7554a797ebd47ccf9e7aaacb03696ebf41599981b908b
BLAKE2b-256 checksum
How to use checksums
2c2e19ee1cb6a634b09f681d2c83fbdb2b7a2d4c0bf7a92a5fd24cbe17b20c22
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

Release files / mip_cvxpy-0.0.2-py3-none-any.whl

Download URL mip_cvxpy-0.0.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bee6f3fc6147d2bdc0d1a58a2bf371248434536d6de3583e6b258f6c66dd514f
BLAKE2b-256 checksum
How to use checksums
8f9dec0d980692d72f3e1fef54c3cc9362182a6c2606b39b3ceee11025fb1980
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.7.10

Security for mip-cvxpy 0.0.2

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.0.2 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