How to solve different objective function at the same time (with the same set of constraints)?
AnsweredHi,
I am calling Gurobi 9.0 from C language.
I construct a Gurobi model with a certain set of constraints, and I want to maximize/minimize different objective functions with this same set of constraints.
Those different optimizations can actually be done at the same time (since these solving processes are independent of each other).
How can I do so with just one Gurobi model? I currently just do it sequentially since I have to update the objective coefficients in my Gurobi model, but I really want to reduce the overall execution time, so is there any way for me to do the solving at the same time with one instantiation of the Gurobi model?
Thank you in advance for any help or comment.
-
Hi,
Each process has to hold its own Gurobi model. What you could try is constructing the constraints on each process or construct the model in one process together with a given objective and then use the GRBcopymodel method to construct a model copy and pass it to another process.
Since constraints have to be added to the model sequentially anyway, I would recommend constructing the model in each independent process. You can write a method which adds the constraints to the model and call it in each independent process to have a clean code.
You could also consider using the Multiple Scenarios feature provided by Gurobi.
Best regards,
Jaromił0
Please sign in to leave a comment.
Comments
1 comment