Skip to main content

Log file does not show the gap

Answered

Comments

8 comments

  • Iason Liagkas
    Gurobi-versary
    Detective
    Thought Leader

    Another log that I get sometimes is
    Iteration    Objective       Primal Inf.    Dual Inf.      Time
       12317    9.4324848e+06   5.097459e+02   5.788624e+08      5s
       16557    1.1036289e+07   4.582912e+02   4.533750e+08     11s

    How could I get the gap in this case? could I still use the log file or apply callbacks?

    Kind regards 
    Iason

     

    0
  • Simranjit Kaur
    Gurobi Staff Gurobi Staff

    Hi Iason,

    Your screenshot shows the part of the log where the root LP relaxation of your model is solved. The MIP gap calculations will become visible once the solver reaches the Branch and Cut phase. Please see the MIP Logging section of our reference manual for more details.

    As noted in the log, the solver encountered numerical issues while solving the root relaxation. Please try using the BarHomogeneous parameter. Please see our Guidelines for Numerical Issues to read more about the causes of numerical instability in MIP models.

    Regarding the log lines with "Waiting for other threads to finish...": At the default setting of the Method parameter, Gurobi will use the concurrent LP optimizer to solve the root relaxation of the model. In this mode, multiple algorithms are run on multiple threads simultaneously. To ensure deterministic behaviour, the optimizer will try to synchronize the work of these threads, which can sometimes lead to a waiting time. You can try avoiding this by setting the Method parameter to 0,1,2, or 3.

    Cheers,
    Simran

    0
  • Iason Liagkas
    Gurobi-versary
    Detective
    Thought Leader

    Thank you Simran, so on the above cases to get the solution gap can I apply callbacks or the gap is not available before a specific point of the solution? I do not know if I can get the solution gap as time evolves from the moment that the solver starts working. This is what I would Ideally aim for.  

    Kind regards
    Iason

    0
  • Iason Liagkas
    Gurobi-versary
    Detective
    Thought Leader

    My ultimate goal is to produce a graph like that. Is this possible through the log file or callbacks? or that is not something that we can always obtain?

    Kind regards
    Iason

    0
  • Simranjit Kaur
    Gurobi Staff Gurobi Staff

    The easiest way to plot a graph like that would be by using Gurobi's open source Python package gurobi-logtools. This package can be used to analyze multiple Gurobi log files easily. There is a Gurobi TechTalk demonstrating how to use it (YouTube) (scroll to at 22:05 minute mark to see how you can use "timelines" to plot the MIP gap over time).

    0
  • Iason Liagkas
    Gurobi-versary
    Detective
    Thought Leader

    Thank you Simran.

    0
  • Tzu-Wen Lin
    First Comment

    Hello Simranjit,

    I have a similar situation. My model has been running for more than three days, and the log file below has not shown any Gap. Do you have any suggestions? How can I obtain feasible solutions more quickly? Thank you.

    Best

    Tzu-Wen Lin

     

    Set parameter MIPGap to value 0.05

    Gurobi Optimizer version 11.0.3 build v11.0.3rc0 (linux64)




    CPU model: Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz, instruction set [SSE2|AVX|AVX2]

    Thread count: 44 physical cores, 88 logical processors, using up to 32 threads




    Optimize a model with 990 rows, 5499 columns and 2934 nonzeros

    Model has 2484 quadratic constraints

    Model has 1467 general constraints

    Variable types: 5499 continuous, 0 integer (0 binary)

    Coefficient statistics:

      Matrix range     [1e+00, 5e+01]

      QMatrix range    [1e+00, 1e+00]

      QLMatrix range   [1e+00, 1e+00]

      Objective range  [1e+00, 5e+02]

      Bounds range     [1e-02, 1e+00]

      RHS range        [1e+00, 1e+00]

    Presolve added 2793 rows and 24373 columns

    Presolve time: 0.17s

    Presolved: 22305 rows, 33274 columns, 136368 nonzeros

    Presolved model has 1258 SOS constraint(s)

    Presolved model has 4860 bilinear constraint(s)




    Solving non-convex MIQCP




    Variable types: 33274 continuous, 0 integer (0 binary)

    Deterministic concurrent LP optimizer: primal and dual simplex

    Showing primal log only...







    Root simplex log...




    Iteration    Objective       Primal Inf.    Dual Inf.      Time

       24066   -8.4808753e+03   0.000000e+00   1.855195e+06      5s

       31430   -8.2293042e+03   0.000000e+00   1.409889e+06     10s

       39074   -8.1780585e+03   0.000000e+00   8.592917e+05     15s

       42237   -8.1757029e+03   0.000000e+00   0.000000e+00     17s

    Concurrent spin time: 3.94s (can be avoided by choosing Method=3)




    Solved with dual simplex




    Root simplex log...




    Iteration    Objective       Primal Inf.    Dual Inf.      Time

       38397   -8.1757029e+03   0.000000e+00   0.000000e+00     21s




    Root relaxation: objective -8.175703e+03, 38397 iterations, 20.83 seconds (26.51 work units)




        Nodes    |    Current Node    |     Objective Bounds      |     Work

    Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time




         0     0 -8175.7029    0 3618          - -8175.7029      -     -   21s

         0     0 -8175.7750    0 3634          - -8175.7750      -     -   21s

         0     0 -8175.7752    0 3634          - -8175.7752      -     -   21s

         0     0 -8259.0805    0 3666          - -8259.0805      -     -   32s

       

         0     0 -8334.0886    0 3866          - -8334.0886      -     -   52s

         0     0 -8338.4864    0 3827          - -8338.4864      -     -   54s

         0     0 -8338.4961    0 3829          - -8338.4961      -     -   54s

         0     0 -8342.8537    0 3768          - -8342.8537      -     -   56s




         0     0 -8358.9287    0 3807          - -8358.9287      -     -   66s

         

         0     0 -8366.0413    0 3764          - -8366.0413      -     -   71s

         0     0 -8369.4634    0 3749          - -8369.4634      -     -   73s




         0     0 -8379.1872    0 3742          - -8379.1872      -     -   82s

         0     0 -8379.1953    0 3737          - -8379.1953      -     -   84s

         0     0 -8379.7866    0 3743          - -8379.7866      -     -   84s

        

         0     0 -8384.4331    0 3746          - -8384.4331      -     -  107s

         0     2 -8384.4331    0 3746          - -8384.4331      -     -  123s

         7    16 -8384.6188    3 3640          - -8384.4808      -   134  125s

       159   192 -8384.7557    7 3737          - -8384.6138      -   133  130s

      

      1144  1884 infeasible   25               - -8384.6294      -   120  155s

      1979  2415 -8386.1080   34 3678          - -8384.6294      -   151  253s

      2514  3551 -8387.3815   44 3640          - -8384.6294      -   214  282s




      8821 10479 -8405.2294  140 3833          - -8384.6294      -   280  421s

    11438 13284 -8410.0201  179 3731          - -8384.6294      -   270  457s




    174484 155093 infeasible 1925               - -8444.2174      -   277 7576s

    177976 157843 -8560.6230 1926 3860          - -8444.2242      -   279 7663s

    180908 162097 -8449.1055   47 6100          - -8444.2242      -   280 7746s




    350197 326336 -8541.9644 1219 4381          - -8444.2242      -   226 12037s

    354463 330435 -8542.3650 1269 4335          - -8444.2242      -   225 12090s

    358653 334292 -8542.9391 1346 4213          - -8444.2242      -   224 12133s

    362600 337918 -8543.0621 1699 3867          - -8444.2242      -   223 12240s

    366297 340218 infeasible 1787               - -8444.2242      -   222 12341s

    368697 343967 infeasible 1845               - -8444.2242      -   222 12506s

    372555 348451 infeasible 1839               - -8444.2242      -   222 12587s

    377162 352545 infeasible 1841               - -8444.2242      -   221 12701s

    381368 357407 infeasible 1842               - -8444.6008      -   220 12800s

    386400 361281 -8452.1546   50 6111          - -8444.6023      -   218 12840s




    564460 529652 -8548.1093 1127 4515          - -8444.6023      -   217 18528s




    581254 542334 infeasible 1205               - -8444.6023      -   216 18897s

    581539 542424 infeasible 1210               - -8444.6023      -   217 18989s

    581765 542493 -8645.1576 1211 4565          - -8444.6023      -   219 19082s

    581966 542527 infeasible 1212               - -8444.6023      -   221 19161s

    582149 542569 infeasible 1213               - -8444.6023      -   222 19248s

    640722 595686 infeasible  139               - -8445.4591      -   528 32928s

    643918 598835 infeasible  182               - -8445.4591      -   544 33518s

    647522 601839 -9784.2750  218 6470          - -8445.6937      -   559 34095s




    679065 629752 infeasible  138               - -8446.0994      -   676 40102s




    761192 703152 -8993.7225   83 5480          - -8446.4289      -   943 55580s

    765203 706349 -9044.6359  101 5645          - -8446.4289      -   955 56221s

    768656 709380 -9090.8193  123 5250          - -8446.4289      -   967 56863s

    772105 712729 -9137.0216  149 5810          - -8446.4289      -   978 57506s

    775910 715325 infeasible  153               - -8446.4289      -   989 58115s

    779002 718354 -9218.6744  173 5490          - -8446.4289      -  1000 58759s




    822173 756766 -8991.1340   75 5363          - -8446.6137      -  1124 66738s




    836066 770320 -9039.3539   64 5803          - -8446.8607      -  1159 69096s

    839992 773241 infeasible  133               - -8446.9457      -  1167 69660s

    843493 775709 -8548.7845   38 6314          - -8446.9457      -  1174 70235s

    846308 778374 -8747.7662   51 5702          - -8446.9457      -  1182 70798s




    1706559 1556984 -9196.8677   97 5956          - -8450.0525      -  1944 203693s

    1709886 1559680 -9235.9346  107 5976          - -8450.0525      -  1946 204207s




    1766297 1609796 -9327.4563  192 5306          - -8450.1212      -  1971 213190s

    1768940 1613335 -9360.2807  204 5389          - -8450.1212      -  1974 213755s

    1772699 1617734 infeasible  256               - -8450.2332      -  1975 214289s




    1805075 1644319 -9545.4296  359 4780          - -8450.2332      -  1987 218847s

    1806891 1648567 infeasible  547               - -8450.2697      -  1987 219428s




    1858745 1691641 -9083.0365  102 5490          - -8450.3632      -  2007 227017s

    1858848 1694793 -9084.3455  102 5403          - -8450.3632      -  2007 227557s

    1862262 1697980 -9189.5036  130 5196          - -8450.3632      -  2008 228078s




    1922767 1753684 -9144.3969  119 5913          - -8450.5025      -  2027 236460s

    1926905 1756994 infeasible  157               - -8450.5025      -  2028 237030s

    1930554 1760003 -9280.2288  193 5842          - -8450.5025      -  2027 237550s




    2033464 1852762 -9293.7797  131 6046          - -8450.7482      -  2067 254898s

    2036577 1856304 -9457.0170  204 5814          - -8450.8139      -  2069 255533s

    2040381 1859862 -8519.5536   43 6298          - -8450.8139      -  2071 256135s




    2075022 1891002 -9128.2829  128 5469          - -8450.8139      -  2086 262173s

    2079038 1894366 -9279.9902  136 5730          - -8450.8139      -  2087 262807s

    2082866 1897360 infeasible  142               - -8450.9176      -  2089 263385s

    2086150 1901538 -8510.6212   51 5959          - -8450.9176      -  2091 263989s

    2090630 1905509 -8812.4816   63 5852          - -8450.9176      -  2092 264522s

    2095015 1909730 -8921.5356   72 5520          - -8450.9176      -  2092 265054s




    2153112 1962501 -9263.9758  155 5054          - -8451.0237      -  2106 274448s




    2187831 1993545 -9227.3955  137 5534          - -8451.0341      -  2114 279285s

    2191174 1996774 -9289.2116  158 5685          - -8451.0341      -  2115 279780s

    2194652 2000418 infeasible  217               - -8451.0341      -  2116 280279s

    2198522 2003356 -9534.8298  559 4355          - -8451.1273      -  2116 280777s

    2201811 2007470 -8675.0219   41 5885          - -8451.1273      -  2116 281291s

    2206255 2010479 -8826.6248   57 5607          - -8451.1273      -  2115 281805s

    2209831 2012635 -9074.7331   64 5707          - -8451.1273      -  2114 282270s




    2296946 2093938 -9124.9008  102 5384          - -8451.4006      -  2138 297084s

    2301684 2097713 -9161.0713  117 5666          - -8451.4006      -  2138 297562s

    2305866 2101430 -9220.9997  135 5324          - -8451.4006      -  2138 298038s

    2309997 2104876 -9331.6925  156 5913          - -8451.4006      -  2138 298493s

    2313943 2107042 infeasible  241               - -8451.4523      -  2139 298936s

    2316535 2108968 -8720.8740   47 5783          - -8451.4523      -  2140 299435s




    2328238 2117877 -9186.3613  135 5481          - -8451.4523      -  2145 301897s







    2436383 2220548 -8777.7307   53 5708          - -8451.7329      -  2169 319054s

    2440765 2223982 -8910.6156   64 5546          - -8451.7329      -  2169 319570s
    0
  • Simranjit Kaur
    Gurobi Staff Gurobi Staff

    Hi Tzu-Wen Lin,

    From the log, we can see that the solver could not find any feasible solutions for your model. Do you expect this model to have a feasible solution?

    In general, you can use the parameters that let the solver focus on finding feasible solutions, such as MIPFocus=1, RINS and Heuristics. For more details, please see the parameter guidelines for MIP models.

    You can also try running the No-relaxation heuristic (by setting the parameter NoRelHeurTime). This heuristic is usually quite good in finding feasible solutions.

    Providing a feasible start solution to the model can also speed up the solution time. Please see How do I use MIP starts?. You can use your knowledge of the model or a custom heuristic to create a full or partial starting solution. To get a feasible solution, you can also try setting the parameter SolutionLimit=1 and solving the model after zeroing out the objective function (an easier model).

    Other than the parameters, please ensure that you give tight bounds on variables participating in non-linear terms in your model. 

    Best regards,
    Simran

    0

Please sign in to leave a comment.