Skip to main content

IntegralityFocus affects solution of non-convex, continuous models

Answered

Comments

4 comments

  • David Torres Sanchez
    Gurobi Staff Gurobi Staff

    Hi Adrian,

    Thanks for reporting this, we will take a look!

    Cheers, 
    David

    0
  • David Torres Sanchez
    Gurobi Staff Gurobi Staff

    Hi Adrian,

    The discrepancy is coming from very small numerical differences in the solutions.

    If you compare both solutions you will see very small differences in the solution values for the variables (excluding obj).

    2,4c2,4
    < # Objective value = -1.5249256397257258e-01
    < obj -1.5249256397257257e-05
    < x_1 2.99989063055512
    ---
    > # Objective value = 1.8712166123804330e+01
    > obj 1.8712166123804330e-03
    > x_1 3.0028068249185704e+00
    11,23c11,23
    < x_8 3.0214170969828036e-01
    < x_9 2.7881664954941110e+00
    < x_10 2.1198793677005212e+00
    < x_11 5.5569324893363046e+00
    < x_12 -6.2862564895454005e+00
    < x_13 -8.1923562656380866e-01
    < x_14 -3.0203884020758043e-01
    < x_15 -2.7880643684417872e+00
    < x_16 -2.0308116954655322e+00
    < x_17 -5.2875021184162678e+00
    < x_18 6.2863558347676873e+00
    < x_19 8.1934310258078347e-01
    < x_20 -1.9980250743381978e-01
    ---
    > x_8 3.0215205070246576e-01
    > x_9 2.7881860892141073e+00
    > x_10 2.1199221427932464e+00
    > x_11 5.5569804780205594e+00
    > x_12 -6.2862373470427961e+00
    > x_13 -0.819235626563807
    > x_14 -3.0201924648758371e-01
    > x_15 -2.7880488138414066e+00
    > x_16 -2.0308116954655286e+00
    > x_17 -5.2874210080408766e+00
    > x_18 6.2863729106085966e+00
    > x_19 0.819361576093609
    > x_20 -1.9951085868738966e-01

    We will aim to fix this for the next release.

    Cheers, 
    David

    0
  • Adrian Lipow
    Gurobi-versary
    First Comment
    First Question

    Hi David,

    thanks for looking into this, good to hear that it will hopefully be fixed.

    More out of interest than practical necessity at this point: did you query the two solutions from the same run, or did you take them from different runs (i.e. with and without IntegralityFocus)? When I try to query them from the same run (with IntegralityFocus=1), Gurobi only gives me the worse solution. I used the Python interface; regardless of whether the SolutionNumber parameter is set to 0 or 1, querying the Xn attribute of e.g. obj gives me the value in the worse solution. I guess this might be related to the fact that the worse solution is returned despite the better one also being found? Or am I missing something in how I query different solutions? (See also excerpted Python code below.)

    gurobi> m = read("model.mps")
    ...
    gurobi> m.Params.IntegralityFocus=1
    Set parameter IntegralityFocus to value 1
    gurobi> m.optimize()
    ...
    Solution count 2: -0.152492 36.7862
    Optimal solution found (tolerance 1.00e-04)
    Best objective 3.678619043605e+01, best bound 3.678619043605e+01, gap 0.0000%
    gurobi> m.getVars()[0].Xn # this is obj
    0.0036786190436051136
    gurobi> m.Params.SolutionNumber=1
    gurobi> m.getVars()[0].Xn # this is obj
    0.0036786190436051136
    gurobi> m.SolCount
    2 # 2 solutions found, but only 1 is queryable?

    Cheers,
    Adrian

    0
  • David Torres Sanchez
    Gurobi Staff Gurobi Staff

    This was from two different solutions obtained with and without IntegralityFocus.

    I guess since one of the solutions is deemed to be better the other one cannot be retrieved. I guess this is part of the bug and will also be fixed.

    Cheers, 
    David

    0

Please sign in to leave a comment.