メインコンテンツへスキップ

Need help/ advice on how to speed up of my optimisation (Pyomo with Gurobi)

回答済み

コメント

13件のコメント

  • 正式なコメント
    Simranjit Kaur
    • Gurobi Staff
    This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support.
  • Jaromił Najman
    • Gurobi Staff

    It looks like experimenting with the Cuts parameter might improve the performance in the root node. When you ctrl+c the run, do you see that one kind of cuts is added way more than others? You could try turning off this particular type of cuts via the corresponding parameter.

    You could also try experimenting with the NoRelHeurTime parameter to run the No Relaxation heuristic which tries to find feasible solutions before the root node relaxation has been solved.

    You should also check the documentation of most important parameters for MIPs for more possibly relevant parameters.

    You could also share an LP or MPS file of your model. Note that uploading files in the Community Forum is not possible but we discuss an alternative in Posting to the Community Forum. The Knowledge Base article How do I write an MPS model file from a third-party API? should be helpful.

    Best regards, 
    Jaromił

    0
  • Damilare Oyediran
    • Gurobi-versary
    • Conversationalist
    • First Question

    Thank you for your reply Jaromił.

    I've been trying to implement or do the "Cuts" parameter and NoRelHeurTime parameter as you suggested but I couldn't figure it out (i think i'm struggling trying to adapt my code written in Pyomo to Gurobi).

    As you mentioned, have uploaded the MPS, PRM files with my model data here https://support.gurobi.com/hc/en-us/requests/36174 (not sure i share it the right way, please let me know if cannot see the file so i can upload again). 
     

    Thank you so much Jaromił and I look forward to your reply. 

    0
  • Jaromił Najman
    • Gurobi Staff

    It looks like running your model with NoRelHeurTime=1200 or some bigger value tends to find good feasible points. I think that running the No Relaxation heuristic (NoRelHeurTime) for a very long time should be the way to go here.

    Simplex seems to struggle on the relaxation, thus setting Method=2 and NodeMethod=2 looks like a good idea. Other than that, you could try disabling Cuts. Altogether, you model is large and has lots of integer/binary variable. Thus, it is not surprising that proving a small MIPGap takes a lot of time.

    You could try to find a reformulation or strengthening your current one. There is a recent webinar on strong MIP formulations which might be helpful in this case.

    0
  • Damilare Oyediran
    • Gurobi-versary
    • Conversationalist
    • First Question

    Hi Jaromił, thank you for the help and suggestions and for the Webinar. 

    So i ran my model with NoRelHeurTime=1200 and also set Method=2 and NodeMethod=2, the model seems to start/ run faster compared to my previous approach but it ended up acting like my previous approach. As you can see in the attached screenshot (it's been running for 4 days now) and it got stuck at this over the weekend. 

    Is there anything I can do as well? Please, let me know.  

    Thank you so much for your help Jaromił. 


    P.S: This time I didn't set MIGAP. 

    0
  • Jaromił Najman
    • Gurobi Staff

    Hi Damilare,

    It looks like, finding a good feasible point is the main bottleneck of this model. You should try running the No Relaxation heuristic for way longer, even for a day if it is acceptable for your application. (NoRelHeurTime=86400). You could additionally try setting MIPFocus=1 to make Gurobi focus on feasible solutions instead of the dual bound. Setting a desired MIPGap, e.g., =0.1, is always good.

    Did you have a look at the solution point? Maybe it has some properties that make you tell that this solution is already good enough for your application.

    Best regards, 
    Jaromił

    0
  • Damilare Oyediran
    • Gurobi-versary
    • Conversationalist
    • First Question

    Thank you Jaromił, 

    I will add these options to the model now and try to re-run for a day (I will keep posted). 

    I did have a look, and at this point and due to time constraint on my end - if i can get a gap of around 10 percent i think I'm ok (with MIPGap=0.1 should stop the model at Gap of 10 percent right - and if I make ask is there any cons to it - please forgive my ignorance)? 

    Thank you so much Jaromił.

    0
  • Jaromił Najman
    • Gurobi Staff

    with MIPGap=0.1 should stop the model at Gap of 10 percent right - and if I make ask is there any cons to it - please forgive my ignorance

    This is correct, the optimization will stop as soon as Gurobi is able to prove a 10% gap. The cons to it have to be evaluated by the modeler (you). It heavily depends on your application how good the final solution has to be. Let's assume that your objective function depicts some costs in $ with an optimal solution value of 1000000. If you solve your model up to 10% mip gap, then a solution with value 1100000 can be accepted if the bound is good enough. This means that you would leave up to 100000$ on the table. If however, the optimal solution value is 100 then, you would have to pay at most 10$ more than in best case which might be acceptable for a particular application.

    Unfortunately, most often a smaller MIPGap results in more time being required to solve the model, because one requests a better solution and/or a better provable bound.

    Best regards, 
    Jaromił

    0
  • Damilare Oyediran
    • Gurobi-versary
    • Conversationalist
    • First Question

    Thank you Jaromił the explanation. 

    For now, i have to go with the MIGap=0.1. 

    I re-started the model like 1hour+ now and this screenshot shows what i have so far. 

    I will let you know what i have by tomorrow. 

    Thank you so much. 

    0
  • Damilare Oyediran
    • Gurobi-versary
    • Conversationalist
    • First Question

    Hi Jaromił,

    So far, it got stuck at time 112479s in the last 12 hours (Gap of 48.7%) as shown in the screenshot below and it hasn't move yet. 

    Is there anything we can try/ do again?


    I have a question out of curiosity: 
    Does switching from my university internet service provider to my home service provider has any effect on it performance/ run. Because, I'm using an academic license and in the evening i take my computer with me home?

    Thank you so much and I look forward to your reply. 

    0
  • Jaromił Najman
    • Gurobi Staff

    Does switching from my university internet service provider to my home service provider has any effect on it performance/ run. Because, I'm using an academic license and in the evening i take my computer with me home?

    No, this does not have any impact on the performance as long as you don't switch to a different machine.

    So far, it got stuck at time 112479s in the last 12 hours (Gap of 48.7%) as shown in the screenshot below and it hasn't move yet. 

    Is there anything we can try/ do again?

    It looks like this is a really hard model. I don't think that at this point there is much left to try. You could additionally try Cuts=0 to get quicker through the root node. Other than that, I think you should try providing an initial point if you have any or think about a stronger formulation of your model as presented in the  recent webinar on strong MIP formulations. You could also think of additional constraints which might improve the lower bound of your model. Something like an ordering of variables might help if it is applicable in your case.

    Did you try solving your model with a smaller data set? Maybe when you find a way to speed up a smaller version of your model, you might use it for the bigger one.

    Best regards, 
    Jaromił

    0
  • Charitha Buddhika Heendeniya
    • Gurobi-versary
    • Collaborator
    • Investigator

    Dear Jaromił Najman

    When you ctrl+c the run, do you see that one kind of cuts is added way more than others? You could try turning off this particular type of cuts via the corresponding parameter.

    Can you please explain why you suggested to turn-off the cut type that is added the most? I mean, intuitively I would want to keep it because that cut type seems to help the most. What am I missing? 

    0
  • Jaromił Najman
    • Gurobi Staff

    Dear Charitha,

    Can you please explain why you suggested to turn-off the cut type that is added the most? I mean, intuitively I would want to keep it because that cut type seems to help the most. What am I missing? 

    In general, you are absolutely right and one should one turn off the cut type that seems to help the most. However, there are cases where a vast amount of a specific type cut is added to the model without moving the dual bound much. This is then counter-productive and actually turning off these cuts can result in a performance improvement. Please note that this is not the standard case and has to be reconsidered case by case.

    Best regards, 
    Jaromił

    0

投稿コメントは受け付けていません。