h-g-s / lp

Simple C/C++ interface to COIN-OR CBC, CPLEX, GLPK and GUROBI, with some interesting features
Eclipse Public License 1.0
8 stars 0 forks source link

Setup-issues #1

Closed sschnug closed 6 years ago

sschnug commented 6 years ago

This looks interesting!

I tried to get test/buildCBC.sh to run, but no matter what i do, i fail!

It reads as all i need to do is to prepare the necessary libs (Just add all required libraries of your selected solver.) and then call the build-script.

I'm using Ubuntu and installed coinor-libcbc-dev and the other ones (cgl, coinutils, ...). Two different OS-setups made me try Cbc 2.8.12 and Cbc 2.9.9.

Both behave like this:

sascha@ubuntu-17:~/Downloads/lp/test$ ./buildCBC.sh 
../lp.cpp: In function ‘int lp_optimize(LinearProgram*)’:
../lp.cpp:1854:86: error: no matching function for call to ‘CbcModel::setMIPStart(int&, const char**, double*&)’
                 modelA.setMIPStart( lp->msVars, (const char**)lp->msNames, lp->msVal );
                                                                                      ^
In file included from /usr/include/coin/OsiCbcSolverInterface.hpp:12:0,
                 from ../lp.cpp:100:
/usr/include/coin/CbcModel.hpp:2397:10: note: candidate: void CbcModel::setMIPStart(const std::vector<std::pair<std::__cxx11::basic_string<char>, double> >&)
     void setMIPStart( const std::vector< std::pair< std::string, double > > &MIPS ) {
          ^~~~~~~~~~~
/usr/include/coin/CbcModel.hpp:2397:10: note:   candidate expects 1 argument, 3 provided

What am i doing wrong?

I used the current commit d680 and this is some OS-output:

sascha@ubuntu-17:~/Downloads/lp/test$ dpkg -l | grep 'coinor'
ii  coinor-libcbc-dev                          2.9.9+repack1-1                             amd64        Coin-or branch-and-cut mixed integer programming solver (developer files)
ii  coinor-libcbc3                             2.9.9+repack1-1                             amd64        Coin-or branch-and-cut mixed integer programming solver (shared libraries)
ii  coinor-libcgl-dev                          0.59.10+repack1-1                           amd64        COIN-OR Cut Generation Library (developer files)
ii  coinor-libcgl1                             0.59.10+repack1-1                           amd64        COIN-OR Cut Generation Library
ii  coinor-libclp-dev                          1.16.11+repack1-1                           amd64        Coin-or linear programming solver (developer files)
ii  coinor-libclp1                             1.16.11+repack1-1                           amd64        Coin-or linear programming solver (shared libraries)
ii  coinor-libcoinutils-dev                    2.10.14+repack1-1                           amd64        Coin-or collection of utility classes (developer files)
ii  coinor-libcoinutils3v5                     2.10.14+repack1-1                           amd64        Coin-or collection of utility classes (binaries and libraries)
ii  coinor-libosi-dev                          0.107.9+repack1-1                           amd64        COIN-OR Open Solver Interface (developer files)
ii  coinor-libosi1v5                           0.107.9+repack1-1                           amd64        COIN-OR Open Solver Interface
h-g-s commented 6 years ago

Thanks for you interest ! It requires cbctrunk, the development version of CBC. Right now cbc trunk is more stable than cbcstable since only bug fixes are in trunk :) To compile and build and install cbc from trunk in ubuntu including Lapack and Blas for an improved performance in matrix operations:

sudo apt-get install gfortran subversion gcc g++ autotools-dev automake autoconf

svn co https://projects.coin-or.org/svn/Cbc/trunk cbctrunk

cbctrunk/ThirdParty/Blas/

./get.Blas

cd ../Lapack/

./get.Lapack

cd ../..

./configure --prefix=/usr --enable-cbc-parallel --enable-gnu-packages

make -j 4

Cheers

h-g-s commented 6 years ago

ops, just forgot to add a sudo make install at the end

sschnug commented 6 years ago

Yeah, that works now! Thanks. --prefix=/usr was what i was missing in earlier from-source attempts (besides the whole which code to use question)!