List Info

Thread: Multithreading problem




Multithreading problem
country flaguser name
United States
2008-06-07 11:51:55

I am using lp_solve (version 5.5.0.12) to solve a BIP problem with
141 binary variables (Xj) and only one constraint. The problem
structure is very simple:

maximize SUMj (Bj * Xj)
subject to:
sum CjXj <= RHS
Xj belongs to {0, 1}

I have to solve this problem 3096 times using a different RHS value
each time, what takes around 50 minutes in my computer.

When I looked at the CPU and RAM usage during the computations I saw
that the RAM usage was not an issue (I have 4 GB and only a small
fraction of it was being used), but the CPU usage was around 50%.
This CPU usage was understandable because I was using a computer with
a 2 core CPU and lp_solve was using only one core at 100%.

Thereafter I tried to reduce the time to solve the 3096 problems
using lp_solve in two separated threads, each one solving half of the
3096 problems (1548 problems in each thread), but lp_solve was not
able to find all solutions for these problems.

Later on I repeated this experiment using again two threads but
keeping one thread suspended until the other was running (I resumed
the 2nd thread after the 1st thread finished) and this time all the
solutions were found!

Does this mean that lp_solve is not thread safe? There is anything I
can do to surpass this?

Note that anyone could take advantage of multi-core CPUs, which are
more and more frequent nowadays, given that lp_solve can be used in
several threads simultaneously.

Thanks in advance for any suggestions or information on this,
João

PS: I am using Borland C++ Builder 6 to compile and link lp_solve
with my code. I run these problems in a Dell Latitude D630C laptop
with an Intel Core 2 Duo CPU T7800 2.6 Ghz with Windows Vista
Business (64 bit) SP1.

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )