# Method (Algorithm) and Objective used in Gurobi Model

How can I find out which method or algorithm was used to solve my model? When I use GRB.IntParam.Method- to output the method, I get -1 for the automatic method.

I have a quadratic objective function with quadratic constraints and PWL constructs, so I had to set the model to "Non-Convex". So I would also like to know if I consequently have a QP, QCP, MIQP, or MIQCP.

• In Gurobi website, it says: In the current release, the default Automatic (-1) setting will typically choose non-deterministic concurrent (Method=3) for an LP, barrier (Method=2) for a QP or QCP, and dual (Method=1) for the MIP root node. May 1, 2021 at 17:12
• Yes, I have seen that too. I have now selected all methods manually and in fact method 1, the dual simplex algorithm is the one that is also selected automatically. Can I assume that my model is then a MIQP model due to the fact that I have a quadratic objective function and it is Non-Convex? If so, then why do all the methods work? May 1, 2021 at 18:39

You can use IsQP, IsQCP to see the type of your model as follow:

Let's sat your model called $$m$$:

m.update()
qp = m.IsQP
qcp = m.IsQCP
print(qp)
print(qcp)


The output will be a binary value which indicates that your model is QP if $$qp =1$$ or your model is a QCP if $$qcp = 1$$. You should also use the following code to set the model as non-convex:

m.setParam('NonConvex', 2)


Note that all these codes are good for Python API of Gurobi. Based on Gurobi website: "With setting 2, non-convex quadratic problems are solved by means of translating them into bilinear form and applying spatial branching."

• Great thanks for the answer. I used Java code but got the result that it is a QCP. I had already set the parameter "Non-Convex" to 2. But if I understand correctly, by setting this parameter, is it a MIQCP model or is it really just a QCP model? May 2, 2021 at 14:10
• In other words, since the description for the "Method" parameter states that only the barrier algorithm is available for QCP, but the dual simplex is used automatically, it must be an MIQCP model? May 3, 2021 at 7:57