Skip to main content

Coin-or CBC native interface for Python

Project description

Linux Build Status

Windows Build status

cbcpy

Native Python interface for Coin-or Branch and Cut Solver (Cbc).

Description

This project provide the build mechanism to automatically generate the wrapper code between Cbc C++ code and Python using SWIG.

This project was develop as part of the CBC Coin-or Sprint Aug 2019.

Binaries for the following platform are pre-compiled and available on pypi.

  • linux x86_64 / python 2.7
  • linux x86_64 / python 3.5
  • linux x86_64 / python 3.6
  • linux x86_64 / python 3.7
  • win x86 / python 2.7
  • win x86 / python 3.5
  • win x86 / python 3.6
  • win x86 / python 3.7
  • win x86_64 / python 3.5
  • win x86_64 / python 3.6
  • win x86_64 / python 3.7

Linux x86 is not supported.

Installation

Pre-compiled python packages are deployed to cbcpy Pypi repositories. To install cbcpy you should make use of pip command line:

pip install cbcpy

The packages include pre-compiled version of Cbc.

For Windows: You must install Visual C++ Redistributable for VS2015

Usage

Here a minimalistic python script making use of cbcpy. You may download p0033.mps from here.

import cbcpy as cbc
solver1 = cbc.OsiClpSolverInterface()
solver1.readMps("p0033.mps")
model = cbc.CbcModel(solver1)
model.branchAndBound()
numberColumns = model.solver().getNumCols()
p_solution = model.solver().getColSolution()
solution = cbc.doubleArray_frompointer(p_solution)

for i in range(numberColumns):
  value = solution[i]
  print("%s has value %s" % (i, value))

Documentation

Original documentation from Cbc project is available in python using the help() function.

# python
Python 2.7.16 (default, Jul 13 2019, 16:01:51) 
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cbcpy
>>> help(cbcpy)
Help on module cbcpy:

Troubleshooting

The specified module could not be found.

>>> import cbcpy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python37-32\lib\site-packages\cbcpy.py", line 15, in <module>
    import _cbcpy
ImportError: DLL load failed: The specified module could not be found.

This error might occur on Windows platform when the file msvcp140.dll cannot be found. You must install Visual C++ Redistributable for VS2015. For 32-bit download "vc_redist.x86.exe" file and for 64-bit download "vc_redist.x64.exe" file.

Support

To get community help for cbcpy, you may send email to the Cbc mailing list.

You may also get paid support by contacting Patrik Dufresne Service Logiciel.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

cbcpy-2.10.3a2-cp37-cp37m-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.7m Windows x86-64

cbcpy-2.10.3a2-cp37-cp37m-win32.whl (1.7 MB view details)

Uploaded CPython 3.7m Windows x86

cbcpy-2.10.3a2-cp37-cp37m-manylinux2010_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

cbcpy-2.10.3a2-cp36-cp36m-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.6m Windows x86-64

cbcpy-2.10.3a2-cp36-cp36m-win32.whl (1.7 MB view details)

Uploaded CPython 3.6m Windows x86

cbcpy-2.10.3a2-cp36-cp36m-manylinux2010_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

cbcpy-2.10.3a2-cp35-cp35m-win_amd64.whl (2.1 MB view details)

Uploaded CPython 3.5m Windows x86-64

cbcpy-2.10.3a2-cp35-cp35m-win32.whl (1.7 MB view details)

Uploaded CPython 3.5m Windows x86

cbcpy-2.10.3a2-cp35-cp35m-manylinux2010_x86_64.whl (4.5 MB view details)

Uploaded CPython 3.5m manylinux: glibc 2.12+ x86-64

cbcpy-2.10.3a2-cp27-cp27mu-manylinux2010_x86_64.whl (4.5 MB view details)

Uploaded CPython 2.7mu manylinux: glibc 2.12+ x86-64

cbcpy-2.10.3a2-cp27-cp27m-manylinux2010_x86_64.whl (4.5 MB view details)

Uploaded CPython 2.7m manylinux: glibc 2.12+ x86-64

File details

Details for the file cbcpy-2.10.3a2-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for cbcpy-2.10.3a2-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 6790d5037cf3bdf1b6673fde598d4d5be495c61d99fe4f53c1c04139c5c95555
MD5 f39b46bb267e48266ee87adeed6bcb29
BLAKE2b-256 8e1c2e6e942b75bb32f0a947ab25667de0c61680ad74947fe87ffb32be5b8f7a

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp37-cp37m-win32.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for cbcpy-2.10.3a2-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 e481ccfefc6cd46757dcafb63fd73b5299cfae68ed8adc48e3523818bc7ea3a5
MD5 3464b6411387bfbaf946cec394edf231
BLAKE2b-256 237efb5018f18f85dc5f9fbe7331227abc815b61a4d386fba1642bc3a9c09f15

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for cbcpy-2.10.3a2-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 c8f613c22b0c46e3ecb5b748dbdcf14045563b2bbe1f621700d2410ca4984016
MD5 99fcd081dbd87a152e61123d635719ee
BLAKE2b-256 7aed9d1edfaf1edfb51b3df9790034edeb422f92f0c4c93ef6707d83209964c0

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for cbcpy-2.10.3a2-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 158db379924be24f659015d6f2d96ac45a3568a8dd8ad590a1a21ee64c7e89ed
MD5 844b4fb10d48de30e0627a8be7bface1
BLAKE2b-256 f1e64f5714c7a1c7923347ac828372387c949a6d0f2d8dd093989dd72f6af3ca

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp36-cp36m-win32.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.6.8

File hashes

Hashes for cbcpy-2.10.3a2-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 66707a44ed09dfbd5f0fce034946eeaba0f085aa2662cf3eee06298360f4f3db
MD5 b8867ada450769f5d20e5b7cc4fe4636
BLAKE2b-256 fc4d87d6b05314b57633e13760843a137924d817d854051da9dc7f5d6ceab467

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for cbcpy-2.10.3a2-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f4ad3509e9b7d336f7eb3cb83226e547fd5e4504ca526d8201d866db650ff825
MD5 2152ab0b38c4ace58d474788f4badc49
BLAKE2b-256 04781e42ce001f8b1247a3168221d30d5543b0c1cb3d04b72fc36871f2d478de

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp35-cp35m-win_amd64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp35-cp35m-win_amd64.whl
  • Upload date:
  • Size: 2.1 MB
  • Tags: CPython 3.5m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.5.4

File hashes

Hashes for cbcpy-2.10.3a2-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 ea1f2a64518f44ca2a33fec473e4f0874a5ef504f115a1b071b7d794088edfcb
MD5 20a99913b296e528a10ef1fd0533c161
BLAKE2b-256 081dc33ff376045d07da522909b8bac9d3e986689bedd6a44467492d7737f728

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp35-cp35m-win32.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp35-cp35m-win32.whl
  • Upload date:
  • Size: 1.7 MB
  • Tags: CPython 3.5m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.5.4

File hashes

Hashes for cbcpy-2.10.3a2-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 701012af5fd4107cae0f0eef61c0d79a8e94cdbabbc1e607eecd0a6d96f836ca
MD5 14297fed95ac5fcfe8af6c66a00b8f4c
BLAKE2b-256 41d799ef7f25e11b3d0443c87a33bd0948d734cd570111cf2e57fddbc2c1af57

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp35-cp35m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp35-cp35m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 3.5m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for cbcpy-2.10.3a2-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 4c52f956e6cdf2cb3d2db79f25162ca8c014d8ba718e24836fe91d366ab1b2b1
MD5 7c7e194a07a332ceadfabe9c3bcefe71
BLAKE2b-256 fc292efed5c70b0ccea7e38757f55f0611edccd7dbe66f9e8a697ade28f555ad

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp27-cp27mu-manylinux2010_x86_64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp27-cp27mu-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 2.7mu, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for cbcpy-2.10.3a2-cp27-cp27mu-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ced246496fde73b3d0cb3beada6f2c7180aa7df9c3e688235a6267f4ca491472
MD5 52f7f67e01d4252defe2194cb3f160e2
BLAKE2b-256 d0886038858a4701d53caba40f694566fbbe8fcffe1837b414031c02fe2f0aed

See more details on using hashes here.

File details

Details for the file cbcpy-2.10.3a2-cp27-cp27m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: cbcpy-2.10.3a2-cp27-cp27m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 4.5 MB
  • Tags: CPython 2.7m, manylinux: glibc 2.12+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for cbcpy-2.10.3a2-cp27-cp27m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 fd75c058a5d0fb4e7c05f315ce25ac9d59f11f098b6216ccb1c85b33fc04d970
MD5 6538fa628561a59e12463f68a11d6b7f
BLAKE2b-256 4fa07ed15fc2dd50b31f02b52c99e8ddca28a736d4ac9b3b85269d3e9c3269cb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page