0

I have the following code:

from ortools.linear_solver import pywraplp
SOLVER = pywraplp.Solver.CreateSolver('SCIP')
...
SOLVER.solve()

It executes for really long time - so to optimize it I attempted: SOLVER.SetNumThreads(8) prior to line with .solve() - but it didn't work at all then.

So I have the following questions:

  1. I assumed multithreading to be a low-hanging fruit here, so how can I make it work - we're talking about regular python shell, in particular on jupyter notebook (but we can also just run this as python script.py - I just can't see reason why it wouldn't run on jupyter, but run as script).
  2. Is there maybe any other way to speed it up? Maybe something less obvious?

Caveat I'm data engineer, and I assume whatever was done in there by data scientists is perfect - so I'm looking for recommendation how to work faster with ortools and not how to replace them with faster tool ;)

1 Answer 1

3

So,

  1. multithread is not a low hanging fruit for SCIP. The best you can achieve is 2x.
  2. It should be compiled in, except for linux, where for some reason, the cmake command to build it does not seem to work.
  3. If your problem is purely integer, you can try the 'sat' solver. It benefits from multi-threading (8 workers or more).
Sign up to request clarification or add additional context in comments.

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.