Johan Lofberg wrote a nice function to interface the Clp linear program solver from the CoinOR project with Matlab. He distributes a precompiled version of the Clp Matlab wrapper for windows, but doesn't include one for linux. Nor are there any directions on how to compile here. I managed to get it to compile with Clp-1.9.0. My directions follow. Issue these commands
# Download Clp-1.9.0.tgz wget http://www.coin-or.org/download/source/Clp/Clp-1.9.0.tgz# untar
tar xzvf Clp-1.9.0.tgz# configure and make
cd Clp-1.9.0
./configure
make
make install# get mexclp
wget http://control.ee.ethz.ch/~joloef/mexclp.zip
unzip mexclp.zip# compile in matlab
matlab -nojvm -nodesktop -nodisplay
ldf=['LDFLAGS="\$LDFLAGS -Wl,--rpath -Wl,' pwd '/lib"'];
mex(ldf,'-Iinclude/coin', '-Llib', '-lClp', '-lCoinUtils', 'mexclp.cpp')
After compiling (hopefully successfully!)
>> clp([],[1 2 1],[1 1 1],-1,[],[])ans =
0
-1
0
For Matlab 2008b on Ubuntu 8.10, I found it necessary to install g++-4.1, setup mex with g++-4.1 and run
./configure CXX=g++-4.1 make make install
before everything would work.
Comments (3)
Great to hear. I've updated the info on the YALMIP home-page with a link to this information
http://yalmip.org/pmwiki.php?n=Solvers.CLP
Posted by Johan Löfberg | May 19, 2009 8:38 AM
Posted on May 19, 2009 08:38
Hi, could anyone help me? I cannot install mexcpl in ubuntu 9.04 properly, although i did it according to these commands. Thanks!
The error message is as follows:
mex(ldf,'-Iinclude/coin','-Llib','-lClp','-lCoinUtils','mexclp.cpp')
/usr/bin/ld: /home/shen/programfiles/Clp-1.9.0/lib: No such file: File format not recognized
collect2: ld returned 1 exit status
mex: link of 'mexclp.mexglx' failed.
??? Error using ==> mex at 206
Unable to complete successfully.
Posted by Chungen | October 23, 2009 8:16 AM
Posted on October 23, 2009 08:16
Worked perfectly - thanks!!
Posted by Tom | December 8, 2009 4:58 AM
Posted on December 8, 2009 04:58