•  Gurobi Staff

Hi Tarun,

Can you explain in detail what you mean by "solution and fractional values"?

- Riley

•  Gurobi Staff

Hi Tarun,

The easiest way to get the relaxed solution is to use model.relax():

with model.relax() as r:    r.optimize()    r.printAttr("X")

Cheers,
David

• Hey Riley,

By "fractional values and solution", I mean the .X that produced the Obj = 1351975.00 in the first row and the 70 "IntInf" values. I want to see which values are violating integer feasibility. Is it possible to do this?

 0     0 1351975.00    0   70          - 1351975.00      -     -    1s

I am trying to speed up the search by stopping it early even if some values are fractional. However, I don't want to relax all values.

•  Gurobi Staff

Hi Tarun,

This code could serve as the basis for what you want to do

def cb(model, where):    if where == gp.GRB.Callback.MIPNODE:        # Found a new MIP incumbent        if model.cbGet(gp.GRB.Callback.MIPNODE_STATUS) == gp.GRB.OPTIMAL:            m._lp_x = model.cbGetNodeRel(model._vars)    if where == gp.GRB.Callback.MESSAGE:        if m._lp_x:            print(m._lp_x)            m = gp.Model()# build modelm._vars = m.getVars()m._lp_x = 0m.optimize(cb)

- Riley

• So it is not possible to get the information at each row? Is it possible to see which constraints are producing the "IntInf"?

Additionally, are there any other parameters and callbacks I should consider to speedup the search based on the above results?

This is the current combination I am using:

Set parameter Heuristics to value 0
Set parameter Presolve to value 0
Set parameter Method to value 1
Set parameter SolutionLimit to value 1

• Hey David,

Is it possible to get

r.printAttr("X")

in list or array format? I have two matrix variables "x" and "y". I want to get the nonzero values for "x" and "y" in two separate lists.

•  Gurobi Staff

Hi Tarun,

Sorry, I misunderstood what you were wanting to do.  Can you take a look at the updated code in my answer above?

- Riley