[Clp] calling clp library routines from Fortran in MSVS

Lacroix, Robert ralacroix at hydro.mb.ca
Thu Dec 4 14:32:44 EST 2014


Richard,

I can’t really comment on CLP’s API, since we didn’t attempt to use it. COIN-OR OSI fit our needs perfectly.

I don’t know how you would handle this situation in Windows, but if you were running Linux, I would recommend that you use the COIN-OR OSI (“Open Solver Interface”, in your document it’s called “Optimization Solver Interface”). It’s part of the CLP source tarball, and builds automatically when you compile and install CLP. Any of several solvers can be linked to your application through the OSI.
https://projects.coin-or.org/Osi/

We added OSI to our C-based solver interface when looking for a replacement for the creaky old MINOS 5.1 (Fortran) solver. It was a few days work to modify our custom API for MINOS to talk to the OSI, and we were able to test our application unmodified with both CPLEX and CLP (and MINOS, through the old interface). OSI lacked a way to save and load a basis with GUROBI as far as we could tell. We settled on using CLP 1.14.8. It’s about $250,000 cheaper than a dedicated CPLEX license for a 12-core Xeon server, has comparable speed through the OSI, and produced identical results in our testing. Poor old (25 years old) MINOS 5.1 ran Simplex 5 to 8 times slower on the same machine.

Speed, cost, and maintainability are selling points of CLP, but demonstrating that it works reliably is essential. After compiling CLP, “make test” gives you confidence that the build worked by running over 1700 unit tests. After installing it, you must validate your interface by comparing the results from your application using CLP, against results from your application using other solvers. If they don’t look the same and you can’t explain or fix the differences, then you should not use CLP.

CLP has been pretty reliable for us. I doesn’t have a performance guarantee like CPLEX, but in practice it is good enough. In our testing CLP managed to solve problems that MINOS 5.1 gave up on. We started using CLP 18 months ago to optimize production runs on a weekly basis. Infrequently, we calibrate our model using batches of around 80,000 variations of a somewhat larger version of the LP (46K rows and 111K columns),  finishing a batch in about 8 hours of real time on 24 2.7 GHz cores. In one of these batches there was a single LP that CLP couldn’t solve (CLP ran for 89 hours before I killed the process). Since then we loosened a comparison tolerance and the problem hasn’t reappeared.

Robert Lacroix

From: clp-bounces at list.coin-or.org [mailto:clp-bounces at list.coin-or.org] On Behalf Of Richard Hammer
Sent: Wednesday, December 03, 2014 10:57 PM
To: clp at list.coin-or.org; msvisualstudio at list.coin-or.org
Subject: [Clp] calling clp library routines from Fortran in MSVS

I’m hoping to test and evaluate COIN-OR CLP by linking the available pre-compiled libraries into some mining-optimisation software.  This software already works with CPLEX, LINDO, GUROBI, and XA.

I’m using MSVS 9 and Intel Fortran, under Windows.


CPLEX, LINDO, GUROBI and XA are LP solvers that are supplied by their publishers on a commercial basis.  Supply is in the form of ready-to-link libraries, ie DLLs and LIBs.  No source code.  To build a release, I compile our mining optimization code only;  I do not compile anything supplied by any of these solvers.  Then I link it all together.



The interface to each solver is specified by the supplier in detail, including how to call it from Fortran.  We have Fortran code that is dedicated to each solver.  The interfaces are similar, but not identical.  Users specify at run time which solver to use.

I’ve not found any DLLs or LIBs specifically for CLP.  I have found CoinMP.dll and CoinMP.lib on ​https://projects.coin-or.org/CoinMP/browser/stable/1.7/CoinMP/CoinMP.zip?format=raw<​https:/projects.coin-or.org/CoinMP/browser/stable/1.7/CoinMP/CoinMP.zip?format=raw>.

Related web pages say that much of the CLP functionality is included.

I have also found “A Gentle Introduction to Optimization Solver Interface.pdf” and “Clp-refman.pdf” in 1.7.4\doc.

It would be very helpful if there was a guide to the CLP solver with explanations of how to use it—how to submit an LP problem, what form it needs to be in, the form of the returned solution, etc.  Which routines to call in what order?

Interface or .sln files would be valuable to have.

Your comments and suggestions would be appreciated.

Richard Hammer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/clp/attachments/20141204/5372c19d/attachment.html>


More information about the Clp mailing list