Skip to main content

numerical issues

Answered

Comments

4 comments

  • Official comment
    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

    The below is written by CPLEX; it indicates that the model has 492 dense columns (I don't know how to get the number of dense columns from Gurobi).

    The number of dense columns is reported in the Barrier statistics

    Elapsed ordering time = 385s
    Elapsed ordering time = 390s
    Ordering time: 425.21s
    Barrier statistics:
     Dense cols : 288
     Free vars  : 10584
     AA' NZ     : 4.234e+07

    I would appreciate it if you could help me identify the source of the numerical issues. I have used scaling to bring the range of coefficients down to 1e4 (as can be seen from the coefficients statistics). What can be changed to fix the numerical issues?

    You introduce many constraints of the form

    - c x + 1000 y = 0

    which looks like you are trying to change the order of magnitude of \(x\) to fit \(y\) (or vice versa). It would be better to use a different order of magnitude for \(y\) to start with. So, if you mean to say that \(c x\) equals \(1000 y\) where \(y\) are, e.g., $. Then, it would be better to work with thousands of $ and define the above constraint as

    - c x + y = 0

    This can dramatically improve numerical and overall performance of the algorithm. The only thing you have to do after the optimization procces finished, is to re-scale the solution point and objective values to the order of magnitudes you need for your application. Of course, I am just guessing what your equalities mean but I hope that the overall idea is still applicable.

    Note that overall your model performs quite well. Crossover is able to turn the sub-optimal solution into an optimal one.

    Best regards, 
    Jaromił

    0
  • Ali Jahanbani Ardakani

    Thank you very much Jaromił Najman

    The cost is in millions of dollars, and if I were to convert it to thousands of dollars, I would have multiplication by 1000 in other places. I will try this suggestion and will report back.

    The overall run-time is long since I will be adding many more constraints/variables to the model. Is there any other aspect of the model that I can improve to make it run faster?

    I have updated the file by converting it to thousands of dollars and scaling the equations/variables. I would appreciate it if you could take a look again.

    0
  • Jaromił Najman
    • Gurobi Staff

    Hi Ali,

    The model looks fine. At this point, I would recommend to try to find parameters which improve performance. The easiest way is to use Gurobi's parameter tuning tool. I would run the tuner for at least 1-2 days on the machine you are planning to use for your models. You could also try some manual tuning with parameters listed as most important ones. Your model is an LP thus, many parameters don't apply for your model. I think, the most interesting ones would be Method, Presolve, Aggregate.

    Best regards, 
    Jaromił

    0

Post is closed for comments.