Is it possible to use pool map parallelization to speed up construction of MVars and constraints
AnsweredHello. I'm trying to formulate a big MILP with more than 100k rows and 100k columns. I've already implemented matrix form for variables (using addMVar) and constants but it's taking relatively long time to construct variables and constraints.
Is there a way to use multithreading like pool map to speed up the variable and constraint construction process? For example creating slices of MVars with multithreading and then concatenating them together?
Thanks in advance!
-
Hi Hancheng,
The Gurobi API is intentionally designed to be used from a single thread per environment. That is by design to make model construction and data access as fast as possible without storing model data in data structures of the API. Parallelized model building is therefore not supported by our API.
In your case, the type of matrix object that you pass to the addMVar() and addConstr() functions could make a difference. We recommend using sparse matrix object types. You can see a scipy sparse matrix object being used in this example.
Best regards,
Lennart0
Please sign in to leave a comment.
Comments
1 comment