How to install CBC for Pyomo locally on Windows machine?

0

My goal is to connect the open-source CBC solver with Pyomo in Spyder. I am working on a Windows 10 machine and it is not an option for me to use the NEOS server due to company policy.

I have downloaded the binaries from Bintray (https://bintray.com/coin-or/download/Cbc#files) that include a cbc.exe file. However when trying to run it, several errors come up stating that I am missing files (among other libbz2-1.dll and zlib1.dll). I do not know much about linux or software development but after a lot of time on google I understand that these are used for unpacking data among other things. I found all files except zlib1.dll in a developer chat on the same subject and zlib1.dll I found on another page. However when running I now get the error: “The application was unable to start correctly (0xc000007b).

I have also tried downloading MSYS2 MinGW and followed instructions from CBC. I don’t know if I require this or if it is only for developers.

Can anyone tell me what to do? I suspect other people than myself want to use CBC in Pyomo as an alternative to GLPK.

windows
installation
spyder
pyomo
coin-or-cbc
asked on Stack Overflow Mar 27, 2020 by SimonLindahl

2 Answers

0

You will find some general information here where i outlined some approaches.

While this was targeted at Clp, it also applies to Cbc.

It's a bit strange as i observed too, that some libs are not statically linked (zlib) while it's certainly doable. But as mentioned in the thread, this should not be the case anymore (see the restriction about which files are fully statically linked) and therefore your observation is strange (and you did not say, which file you downloaded).

So i would trying one of the following (in this order):

  • Try again with your source, but stick to the master-versions (see first link) as the maintainer only guaranteed fully-static builds for those!
  • Use the builds from AMPL
    • (tested and works for me; generally recommended in terms of quality/stability of builds)
  • Use the builds from coin-or/pulp, another modelling-tool for python
    • (tested and works for me)
  • Compile from source using mingw64
  • (Use any build and provide some external dll of zlib and co -> hard to debug)

Of course i completely ignored other potential issues:

  • license-stuff (what's part of those builds)
    • not sure if a company can afford to use binaries not build themself in regards to legal stuff
  • version-compatibility with python
    • does every version of Cbc work
  • cbc version + configuration
    • modern version
    • compiled with multi-threading
    • ...
answered on Stack Overflow Apr 1, 2020 by sascha
0

If you already have the .exe file, make sure it is in your current working folder (set as the working directory in Spyder, simply opening your file is not enough) and call it using the SolveFactory function:

opt = SolverFactory("cbc.exe")

results = opt.solve(model)

It works for me.

answered on Stack Overflow Apr 9, 2020 by gvkcps • edited Apr 9, 2020 by M. S.

User contributions licensed under CC BY-SA 3.0