0

I'm using MATLAB 2010b 64bit and its cplex integration to solve an engineering problem. However, because of the memory leak of cplex, memory usage exceeds acceptable limits with cplex (100+GBs including virtual memory) hence I am not able to solve my problem. You can see a similar post here.

Then I tried to use MATLAB linprog from the optimization toolbox but the result was disappointing. The running time of the algorithm for a small problem instance was increased from 80 cpu sec to 2600 cpu sec.

Now, I need an LP solver integration to MATLAB which is similar to CPLEX or linprog. By "similar" I mean the way it accepts data input in the form (F, A, B, Aeq, Beq, ...etc).

I must be able to use it in loops. Do you have any suggestions for that?

2

2 Answers 2

1

I would be very surprised if there was a memory leak in cplex. If you have a large problem then the memory will grow with any sensible solver. Is there perhaps a memory leak in the interface to cplex? How big is your problem? Are you running multi threaded as each thread will take a copy of the problem and hence will eat a lot more memory.

You should not be surprised to find that other solvers take a lot longer than cplex to solve your problem. Certainly the free solvers will be very much slower than cplex for any large problem.

Sign up to request clarification or add additional context in comments.

5 Comments

There are some posts in the internet about the memory leak of cplex. The problem I try to solve normally use less than 100MBs of memory. But, cplex does not release the memory it uses. As the main code calls cplex hundreds of thousands times, memory leak becomes unignorable. That is the problem.
I guess that I mean that CPLEX itself doesn't have any significant memory leak - I have used it in cases where I have called it many thousands of times with no memory leak issues in C++ or C# code. However there certainly may be a leak in the interface or licence manager stuff.
I don't know about other programming languages but cplex with matlab surely causes a memory leak. In my previous study I actually observed memory leak where cplex was called 20-30K times. However, I didn't worry about it as its memory demand didn't exceed my computers memory capacity. In my current study, cplex is called 700-800K times for an avarage problem instance and memory leak becomes unignorable.
I don't doubt you at all. My guess is that the leak does lie in the interface or the licence manager or similar. I know that the core of CPLEX is very heavily tested inside IBM, and there are very many users worldwide who would be complaining if this was a common experience. However, my code has only called CPLEX a few thousands of times at most in any run, nowhere near as much as you. But I am intrigued by what you are doing that calls it so many times - the problems must be tiny or at least solve very fast. My sub-problems had thousands of variables in each and took maybe 1 minute to solve
For the largest problem instance I have, the LP solver is called ~3.6*10^6 times. The algorithm has an Monte Carlo stage. That's the reason why the solver is called so much. I hope IBM solves that problem soon. Otherwise I'm happy with Gurobi. Total memory usage with Gurubi doesn't even exceed 500MBs during the run. Thanks.
0

After some trials to fix MATLAB/CPLex API's memory usage problem (memory leak) and after referring to some studies I decided to switch to Gurobi solver. For pure LP problems, it seems to be slightly slower compared to CPlex but this can be due to the way I use Gurobi. Someone may find Gurobi faster compared to CPlex. I suggested that on my previous posts under different questions. Here are some academic studies[Analysis of commercial and free and open source solvers for linear optimization problems][1]

[1] : http://www.statistik.tuwien.ac.at/forschung/CS/CS-2012-1complete.pdf

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.