5
$\begingroup$

I am using Gurobi 9.5.1 in Python 3.10. In the context of column generation I request the duals of the master problem and set them in the objective of the subproblem. This is done repeated times.

   duals = master.getAttr(GRB.Attr.Pi, master.getConstrs())
   subprob.setAttr("Obj", subprob.getVars(), duals)

Around 10% of the time spent is in performing these operations. The rest is basically the solving times of the master and subproblems combined.

Is there a way to reduce such overhead?

$\endgroup$
2
  • $\begingroup$ Cross posted at SO: Reduce overhead Gurobi Python getting and setting attributes $\endgroup$ May 25, 2022 at 14:34
  • $\begingroup$ Saving the constraints constrs = master.getConstrs() (the number of these normally stays the same in the context of column generation) and variables vars = master.getVars(), once at the beginning, then update vars as appropriate after generating columns. Then just use these instead of calling getConstrs and getVars every time. This should be significantly faster. $\endgroup$ May 26, 2022 at 21:31

0

Your Answer

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