Skip to main content

taking too long from 0.08% Gap to 0% while solving a MIP in Python with Gurobi package

Ongoing

Comments

4 comments

  • David Torres Sanchez
    Gurobi Staff Gurobi Staff

    Hi Vida,

    You are setting a few parameters, have you tried using default parameters (remove all parameters being set)?

    Could you share the log using default parameters?

    Cheers, 
    David

    0
  • Vida Yousefi Nezhad
    Curious
    Conversationalist

    Hi David,

    I have to set some parameters for Gurobi because otherwise, the process becomes much more time-consuming. Let me show you a small part of the log with the default settings in the following. 
     

    Regards, 

    Vida

     

    Set parameter Username
    Academic license - for non-commercial use only - expires 2025-03-13
    p: 90
    Length of dummy_matrix columns: 7
    Number of delta variables: 656
    Number of theta variables: 656
    Number of alfa variables: 1558
    Number of q variables: 656
    Gurobi Optimizer version 11.0.1 build v11.0.1rc0 (win64 - Windows 10.0 (19045.2))
    
    CPU model: 11th Gen Intel(R) Core(TM) i5-1145G7 @ 2.60GHz, instruction set [SSE2|AVX|AVX2|AVX512]
    Thread count: 4 physical cores, 8 logical processors, using up to 8 threads
    
    Optimize a model with 102276 rows, 88326 columns and 599789 nonzeros
    Model fingerprint: 0x5d47ce15
    Variable types: 84800 continuous, 3526 integer (3526 binary)
    Coefficient statistics:
      Matrix range     [1e+00, 1e+03]
      Objective range  [1e+00, 3e+01]
      Bounds range     [1e+00, 1e+00]
      RHS range        [1e+00, 1e+03]
    Found heuristic solution: objective 47194.000000
    Presolve removed 91284 rows and 65899 columns
    Presolve time: 1.16s
    Presolved: 10992 rows, 22427 columns, 114706 nonzeros
    Variable types: 20577 continuous, 1850 integer (1850 binary)
    Deterministic concurrent LP optimizer: primal and dual simplex
    Showing primal log only...
    
    Concurrent spin time: 0.00s
    
    Solved with primal simplex
    Extra simplex iterations after uncrush: 944
    
    Root relaxation: objective 4.519968e+04, 8702 iterations, 0.20 seconds (0.12 work units)
    
        Nodes    |    Current Node    |     Objective Bounds      |     Work
     Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time
    
         0     0 45199.6817    0  374 47194.0000 45199.6817  4.23%     -    1s
         0     0 45697.1496    0  379 47194.0000 45697.1496  3.17%     -    2s
    H    0     0                    46923.847059 45734.4077  2.53%     -    2s
         0     0 45764.6581    0  373 46923.8471 45764.6581  2.47%     -    2s
         0     0 45805.0486    0  368 46923.8471 45805.0486  2.38%     -    2s
         0     0 45816.3834    0  363 46923.8471 45816.3834  2.36%     -    2s
         0     0 45838.5826    0  361 46923.8471 45838.5826  2.31%     -    2s
         0     0 45849.5823    0  361 46923.8471 45849.5823  2.29%     -    2s
         0     0 45863.5404    0  356 46923.8471 45863.5404  2.26%     -    3s
         0     0 45869.8147    0  359 46923.8471 45869.8147  2.25%     -    3s
         0     0 45875.2494    0  359 46923.8471 45875.2494  2.23%     -    3s
         0     0 45879.8351    0  358 46923.8471 45879.8351  2.22%     -    3s
         0     0 45886.2888    0  358 46923.8471 45886.2888  2.21%     -    3s
         0     0 45889.5475    0  359 46923.8471 45889.5475  2.20%     -    3s
         0     0 45892.8213    0  354 46923.8471 45892.8213  2.20%     -    3s
         0     0 45897.2506    0  355 46923.8471 45897.2506  2.19%     -    3s
         0     0 46112.0601    0  304 46923.8471 46112.0601  1.73%     -    3s
         0     0 46112.0601    0  303 46923.8471 46112.0601  1.73%     -    4s
    H    0     0                    46901.429429 46124.5586  1.66%     -    4s
    H    0     0                    46803.736255 46127.6237  1.44%     -    4s
         0     0 46127.6237    0  278 46803.7363 46127.6237  1.44%     -    4s
         0     0 46146.6619    0  273 46803.7363 46146.6619  1.40%     -    4s
         0     0 46156.6541    0  273 46803.7363 46156.6541  1.38%     -    4s
         0     0 46165.3732    0  263 46803.7363 46165.3732  1.36%     -    4s
         0     0 46167.7744    0  255 46803.7363 46167.7744  1.36%     -    4s
         0     0 46170.8955    0  251 46803.7363 46170.8955  1.35%     -    4s
         0     0 46176.2234    0  253 46803.7363 46176.2234  1.34%     -    5s
         0     0 46177.4162    0  253 46803.7363 46177.4162  1.34%     -    5s
         0     0 46177.8753    0  245 46803.7363 46177.8753  1.34%     -    5s
         0     0 46178.1202    0  250 46803.7363 46178.1202  1.34%     -    5s
         0     0 46178.4064    0  249 46803.7363 46178.4064  1.34%     -    5s
         0     0 46182.4313    0  249 46803.7363 46182.4313  1.33%     -    5s
         0     0 46186.2872    0  258 46803.7363 46186.2872  1.32%     -    6s
         0     0 46186.2872    0  255 46803.7363 46186.2872  1.32%     -    6s
         0     0 46188.7996    0  252 46803.7363 46188.7996  1.31%     -    6s
         0     0 46192.4576    0  267 46803.7363 46192.4576  1.31%     -    7s
         0     0 46192.4576    0  269 46803.7363 46192.4576  1.31%     -    7s
         0     0 46192.4576    0  252 46803.7363 46192.4576  1.31%     -    8s
    H    0     0                    46545.263168 46193.3601  0.76%     -    8s
         0     0 46193.3601    0  261 46545.2632 46193.3601  0.76%     -    8s
         0     0 46193.3768    0  265 46545.2632 46193.3768  0.76%     -    8s
         0     0 46193.4170    0  267 46545.2632 46193.4170  0.76%     -    8s
         0     0 46194.1393    0  256 46545.2632 46194.1393  0.75%     -    9s
    H    0     0                    46535.733064 46197.5826  0.73%     -    9s
         0     0 46197.5826    0  258 46535.7331 46197.5826  0.73%     -    9s
         0     0 46197.5826    0  253 46535.7331 46197.5826  0.73%     -    9s
    H    0     0                    46521.547817 46197.5826  0.70%     -   10s
         0     0 46197.5826    0  254 46521.5478 46197.5826  0.70%     -   10s
         0     0 46197.5826    0  249 46521.5478 46197.5826  0.70%     -   10s
    H    0     0                    46520.047817 46197.5826  0.69%     -   10s
         0     0 46197.5826    0  254 46520.0478 46197.5826  0.69%     -   10s
         0     0 46197.5826    0  263 46520.0478 46197.5826  0.69%     -   11s
    H    0     0                    46487.150901 46197.5826  0.62%     -   14s
         0     0 46197.5826    0  230 46487.1509 46197.5826  0.62%     -   15s
    H    0     0                    46331.501994 46197.5826  0.29%     -   19s
         0     2 46197.5826    0  230 46331.5020 46197.5826  0.29%     -   19s
         1     4 46197.8214    1  225 46331.5020 46197.5826  0.29%   309   20s
    H   94    78                    46328.774663 46207.8475  0.26%   145   25s
       544   483 46308.9118  145   69 46328.7747 46207.8475  0.26%  80.9   30s
    H  712   561                    46328.728984 46213.5301  0.25%  80.2   32s
    H  713   561                    46328.573267 46213.5301  0.25%  80.4   32s
    H  714   561                    46327.396459 46213.5301  0.25%  80.6   32s
      1097   951 46308.3006   89  142 46327.3965 46213.5301  0.25%  77.8   35s
    H 1175   951                    46326.938561 46213.5301  0.24%  75.9   35s
      1179   954 46309.5030   93  253 46326.9386 46213.5301  0.24%  75.6   42s
      1190   961 46319.7717  102  264 46326.9386 46213.5301  0.24%  74.9   45s
    H 1198   918                    46326.938555 46213.5301  0.24%  74.4   50s
      1206   923 46312.3541   88  308 46326.9386 46213.5301  0.24%  73.9   56s
      1213   928 46311.2125   99  303 46326.9386 46213.5301  0.24%  73.5   61s
      1219   932 46296.0039  105  308 46326.9386 46214.9957  0.24%  73.1   66s
    H 1222   886                    46326.795425 46214.9957  0.24%  73.0   69s
      1225   888 46313.3317   88  328 46326.7954 46214.9957  0.24%  72.8   70s
    H 1228   845                    46326.795415 46215.2468  0.24%  72.6   73s
      1230   846 46323.7563   85  344 46326.7954 46217.2543  0.24%  72.5   75s
      1235   849 46308.0688  141  333 46326.7954 46217.2612  0.24%  72.2   80s
    H 1236   806                    46325.882120 46217.3112  0.23%  72.1   82s
    H 1237   766                    46325.859893 46217.6951  0.23%  72.1   84s
      1238   766 46323.5564  103  317 46325.8599 46217.7550  0.23%  72.0   85s
      1240   768 46308.7753   61  317 46325.8599 46217.7550  0.23%  71.9   91s
      1255   783 46243.7357   16  331 46325.8599 46222.8188  0.22%   120   95s
      1301   813 46249.0725   21  301 46325.8599 46222.8188  0.22%   134  100s
      1327   823 46250.7027   24  321 46325.8599 46222.8188  0.22%   142  106s
      1378   840 46259.5406   29  317 46325.8599 46222.8188  0.22%   145  110s
      1469   881 46280.2411   41  310 46325.8599 46222.8188  0.22%   149  115s
      1687   989 46224.8776   18  317 46325.8599 46224.8776  0.22%   155  120s
      1911  1054 46251.4687   34  256 46325.8599 46224.8776  0.22%   156  127s
      2043  1113 46273.8793   41  259 46325.8599 46224.8776  0.22%   154  130s
      2303  1176 46322.2883   81  188 46325.8599 46227.7441  0.21%   152  136s
      2479  1280 46283.6530   45  279 46325.8599 46228.0581  0.21%   153  141s
      2650  1353 46255.9958   27  282 46325.8599 46228.7524  0.21%   151  145s
    H 2677  1305                    46325.859830 46228.7524  0.21%   152  145s
      2862  1301 46275.8962   26  270 46325.8598 46229.5308  0.21%   152  150s
      2981  1368 46244.5463   27  303 46325.8598 46229.7646  0.21%   156  155s
    H 3102  1352                    46325.859242 46230.2242  0.21%   154  158s
      3157  1380 46315.6526   36  266 46325.8592 46230.8861  0.21%   154  161s
      3369  1524 46317.6446   48  210 46325.8592 46231.1337  0.20%   157  167s
      3528  1587 46234.0052   17  302 46325.8592 46231.8919  0.20%   158  171s
      3645  1674 46273.6958   40  226 46325.8592 46232.4098  0.20%   158  175s
      3945  1866 46322.0692   40  240 46325.8592 46232.9058  0.20%   162  183s
      4118  1957 46313.5299   51  230 46325.8592 46233.4071  0.20%   163  187s
      4283  2002 46306.5071   35  266 46325.8592 46234.0411  0.20%   165  192s
      4391  2090 46273.5930   19  334 46325.8592 46234.2886  0.20%   167  196s
      4582  2181     cutoff   30      46325.8592 46235.2252  0.20%   169  201s
      4801  2248 46285.4174   33  267 46325.8592 46236.2714  0.19%   171  207s
      5008  2277 46278.1895   26  330 46325.8592 46236.8417  0.19%   175  214s
    H 5045  2277                    46325.859226 46236.8417  0.19%   177  214s
      5078  2397     cutoff   37      46325.8592 46237.1932  0.19%   178  220s
      5345  2494 46323.6260   47  207 46325.8592 46238.5597  0.19%   179  226s
      5516  2656 46271.8528   30  300 46325.8592 46238.5739  0.19%   181  233s
    H 5602  2656                    46325.859195 46238.6715  0.19%   180  233s
      5840  2865 46322.2657   36  287 46325.8592 46239.1236  0.19%   181  243s
      6129  2959 46316.9196   32  274 46325.8592 46239.2415  0.19%   181  251s
      6329  3227 46240.4771   30  306 46325.8592 46239.7496  0.19%   182  258s
      6763  3483 46287.3598   67  177 46325.8592 46240.1147  0.19%   182  267s
      7185  3790 46296.0008   54  232 46325.8592 46240.5517  0.18%   179  277s
      7682  4040 46251.4977   23  326 46325.8592 46241.0663  0.18%   177  287s
      8119  4334 46290.5621   34  235 46325.8592 46241.8684  0.18%   178  297s
    H 8143  4334                    46325.859184 46241.8684  0.18%   178  297s
      8627  4675 46264.0229   34  291 46325.8592 46242.7445  0.18%   179  308s
      9200  5015 46306.5484   88   81 46325.8592 46243.4994  0.18%   179  320s
      9842  5244 46293.9010   32  262 46325.8592 46244.2366  0.18%   179  334s
    H10238  5244                    46325.859151 46244.3147  0.18%   180  334s
     10339  5659 46283.3459   26  301 46325.8592 46244.7530  0.18%   181  349s
     11057  5773 46297.7942   30  227 46325.8592 46245.4523  0.17%   181  360s
     11320  6233 46264.6856   42  262 46325.8592 46245.7314  0.17%   182  375s
     12093  6609 46308.8327   70  188 46325.8592 46246.4379  0.17%   182  389s
     12785  6693 46272.3316   37  239 46325.8592 46247.0610  0.17%   183  403s
     12918  6964     cutoff   36      46325.8592 46247.3076  0.17%   183  417s
    H13382  6964                    46325.859056 46247.5617  0.17%   183  417s
     13516  7277 46271.5705   42  228 46325.8591 46247.6270  0.17%   183  432s
     14100  7558 46268.3886   32  287 46325.8591 46247.9513  0.17%   182  446s
     14803  8015 46262.2078   41  292 46325.8591 46248.2713  0.17%   183  461s
     15646  8381 46253.4603   34  331 46325.8591 46249.0754  0.17%   182  474s
     16424  8860 46276.8418   33  245 46325.8591 46249.2109  0.17%   181  488s
     17226  9238 46318.0733   47  239 46325.8591 46249.9297  0.16%   180  501s
     18001  9412     cutoff   56      46325.8591 46250.3889  0.16%   180  512s
     18366  9807 46261.0600   32  298 46325.8591 46250.5550  0.16%   180  525s
     19076 10322 46281.7742   53  225 46325.8591 46250.8851  0.16%   180  538s
     19977 10591 46323.9973   81  169 46325.8591 46251.1630  0.16%   178  550s
     20645 10592 46318.4402   70  230 46325.8591 46251.3985  0.16%   177  629s
    H20646 10063                    46325.859047 46251.3985  0.16%   177  630s
     20649 10065 46299.3395   56  392 46325.8590 46251.3985  0.16%   177  635s
     20654 10068 46315.4064   80  421 46325.8590 46251.3985  0.16%   177  640s
     20660 10072 46290.4071   60  405 46325.8590 46251.3985  0.16%   177  646s
     20667 10077 46297.7843   81  367 46325.8590 46251.3985  0.16%   177  650s
     20670 10079 46299.9272   47  358 46325.8590 46251.3985  0.16%   177  658s
     20671 10079 46299.4189   48  384 46325.8590 46251.3985  0.16%   177  661s
     20672 10080 46290.8662   41  364 46325.8590 46251.3985  0.16%   177  668s
     20673 10081 46273.7528   47  380 46325.8590 46251.3985  0.16%   177  671s
     20674 10081 46283.9950   54  384 46325.8590 46251.3985  0.16%   177  678s
     20675 10082 46313.1479   74  394 46325.8590 46251.3985  0.16%   177  680s
     20676 10083 46255.5471   35  391 46325.8590 46251.3985  0.16%   177  687s
     20677 10083 46291.7656   38  389 46325.8590 46251.3985  0.16%   177  690s
     20678 10084 46265.0955   39  386 46325.8590 46251.3985  0.16%   177  696s
     20680 10085 46297.8935   53  395 46325.8590 46251.3985  0.16%   177  705s
     20682 10087 46291.0186   40  410 46325.8590 46251.3985  0.16%   177  714s
     20683 10087 46306.3964   61  411 46325.8590 46251.3985  0.16%   177  716s
     20684 10088 46269.5165   30  401 46325.8590 46251.3985  0.16%   177  723s
     20685 10089 46315.7715   43  399 46325.8590 46251.3985  0.16%   177  725s
     20686 10089 46306.3840   61  407 46325.8590 46251.3985  0.16%   177  732s
     20688 10091 46290.7730   38  413 46325.8590 46251.3985  0.16%   177  740s
     20690 10092 46266.9351   25  393 46325.8590 46251.3985  0.16%   177  748s
     20691 10093 46291.9651   39  400 46325.8590 46251.3985  0.16%   177  750s
     20692 10093 46268.3520   42  395 46325.8590 46251.3985  0.16%   177  757s
     20693 10094 46290.3334   68  400 46325.8590 46251.3985  0.16%   177  760s
     20694 10095 46304.6548   63  390 46325.8590 46251.3985  0.16%   177  767s
     20695 10095 46316.7584   52  392 46325.8590 46251.3985  0.16%   177  770s
     20697 10097 46260.2806   30  392 46325.8590 46251.3985  0.16%   177  777s
     20698 10097 46268.0605   42  395 46325.8590 46251.3985  0.16%   177  785s
     20701 10099 46311.2912   63  376 46325.8590 46251.3985  0.16%   177  794s
     20702 10100 46262.3216   40  369 46325.8590 46251.3985  0.16%   177  796s
     20703 10101 46315.1615   82  401 46325.8590 46251.3985  0.16%   177  802s
     20705 10102 46297.6706   55  392 46325.8590 46251.3985  0.16%   177  810s
     20707 10103 46266.7734   42  392 46325.8590 46251.3985  0.16%   177  818s
     20708 10104 46305.7246   55  402 46325.8590 46251.3985  0.16%   177  820s
     20710 10105 46305.1393   47  400 46325.8590 46251.3985  0.16%   177  826s
     20711 10106 46309.3630   44  393 46325.8590 46251.3985  0.16%   177  830s
     20713 10107 46316.3998   97  390 46325.8590 46251.3985  0.16%   177  836s
     20715 10109 46293.4646   53  396 46325.8590 46251.3985  0.16%   177  844s
     20716 10109 46269.7863   44  379 46325.8590 46251.3985  0.16%   177  846s
     20717 10110 46265.2488   42  380 46325.8590 46251.3985  0.16%   177  850s
     20719 10111 46299.2504   40  385 46325.8590 46251.3985  0.16%   177  858s
     20720 10112 46299.4457   41  388 46325.8590 46251.3985  0.16%   177  860s
     20722 10113 46316.3172   52  382 46325.8590 46251.3985  0.16%   177  866s
     20724 10115 46286.5759   52  396 46325.8590 46251.3985  0.16%   177  872s
     20725 10115 46309.1255   56  395 46325.8590 46251.3985  0.16%   177  878s
     20726 10116 46290.4901   48  401 46325.8590 46251.3985  0.16%   176  880s
     20728 10117 46310.1987   93  391 46325.8590 46251.3985  0.16%   176  885s
     20729 10118 46251.8463   37  375 46325.8590 46251.3985  0.16%   176  892s
     20731 10119 46259.1427   36  384 46325.8590 46251.3985  0.16%   176  900s
     20733 10121 46310.0211   53  385 46325.8590 46251.3985  0.16%   176  906s
     20735 10122 46269.0281   37  397 46325.8590 46251.3985  0.16%   176  914s
     20736 10123 46300.6442   39  386 46325.8590 46251.3985  0.16%   176  917s
     20737 10123 46309.6000   32  387 46325.8590 46251.3985  0.16%   176  922s
     20739 10125 46323.6225   68  400 46325.8590 46251.3985  0.16%   176  931s
     20741 10126 46309.8024   67  395 46325.8590 46251.3985  0.16%   176  939s
     20742 10127 46300.8073   63  395 46325.8590 46251.3985  0.16%   176  941s
     20743 10127 46294.0968   66  395 46325.8590 46251.3985  0.16%   176  945s
     20745 10129 46318.4402   70  395 46325.8590 46251.3985  0.16%   176  951s
     20747 10130 46260.7633   38  393 46325.8590 46251.3985  0.16%   176  956s
     20749 10131 46299.3395   56  398 46325.8590 46251.3985  0.16%   176  962s
     20751 10133 46300.2108   66  391 46325.8590 46251.3985  0.16%   176  967s
     20753 10134 46318.9108   68  393 46325.8590 46251.3985  0.16%   176  976s
     20755 10135 46270.6749   29  398 46325.8590 46251.3985  0.16%   176  981s
     20757 10137 46283.0417   54  390 46325.8590 46251.3985  0.16%   176  989s
     20758 10137 46267.0324   37  393 46325.8590 46251.3985  0.16%   176  991s
     20759 10138 46256.6005   37  390 46325.8590 46251.3985  0.16%   176  996s
     20761 10139 46274.8990   46  395 46325.8590 46251.3985  0.16%   176 1002s
     20762 10140 46304.3389   49  393 46325.8590 46251.3985  0.16%   176 1005s
     20763 10141 46289.4541   66  393 46325.8590 46251.3985  0.16%   176 1010s
     20764 10141 46279.4776   57  393 46325.8590 46251.3985  0.16%   176 1016s
     20767 10148 46251.3985   27  385 46325.8590 46251.3985  0.16%   181 1021s
     20783 10149 46251.3985   29  378 46325.8590 46251.3985  0.16%   182 1025s
     20800 10157 46258.8546   32  353 46325.8590 46251.3985  0.16%   183 1030s
     20822 10172 46277.8923   34  389 46325.8590 46251.3985  0.16%   184 1035s
     20846 10186 46262.1468   37  328 46325.8590 46251.3985  0.16%   184 1040s
    0
  • David Torres Sanchez
    Gurobi Staff Gurobi Staff

    Thanks for the extra log.

    Indeed, as you initially included, setting MIPFocus to 2 or even 3 looks like a good idea.
    You might also want to try:

    Lastly, reformulating the problem (to get a stronger formulation) may also help.

    Cheers, 
    David

    0
  • Vida Yousefi Nezhad
    Curious
    Conversationalist

    Thanks for your reply. How do they help reduce the process time? I read on your website, and I think your suggestion focuses on presolve not on the branch and bound. Could you please give me some detailed information on your suggestion?

    Regards,

    Vida

    0

Please sign in to leave a comment.