Skip to main content

Need to improve optimization time - Warning: large bounds and large coefficient range

Answered

Comments

4 comments

  • Ronald van der Velden
    Gurobi Staff Gurobi Staff

    Hi Ruben,

    Thanks for posting to the forum! Here are some thoughts about your log output and model; hope this helps!

    1. The warnings relate to the “Coefficient statistics” at the top of your log output. Indeed scaling would help improve (reduce) these ranges. See this page and further for guidelines and advice.
    2. Yes, this might help; I can see that the "Bounds range" is also quite large.
    3. These might be caused by your 2 general constraints, as these are translated behind the scenes to an equivalent MIP formulation. Can you explain what these general constraints look like?
    4. At the top, you can see that your model contains quadratic constraints and general constraints. From this, we know that your model is not linear.

    In general, my understanding is that you want to solve 365x24 models and each currently takes 0.66s, so roughly 1.6 hours. Of course this runtime and solution quality (see the warnings about constraint violations at the end of the log) would change as you improve the numerical aspects. Then the next question could be, are these models all independent? If they are, you could consider solving multiple models in parallel and/or using our multi-scenario feature. If they are not, you might consider merging the models into a single model (again) and seeing if that reduces overall runtime.

    Good luck!
    Ronald

    1
  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    One additional remark:

    3. Also I don't know why there are 300 binary variables, because I already removed all binary vanribles I added to reduce calculation time

    Did you remove the variables completely from the model? Or do you just fix them or only remove them from the constraints? If they are still defined in the model (although without any use) they are counted initially. Presolve then removes these variables. And indeed the presolved model has only continuous variables

    Presolved model has 198 bilinear constraint(s)
    Variable types: 835 continuous, 0 integer (0 binary)
    1
  • Ruben Willamowski
    First Comment
    First Question

    Thank you for your help!

    To Ronald:
    My general constrain is to maximize the revenue achieved by variable electricity prices. Additionally, there are a lot of other constraints that limit the hydrogen storage dynamics to realistic circumstances. I don't understand why there are two general constrains, when there is only one objective defined. 
         m.setObjective(v.demand['revenue_total'], GRB.MAXIMIZE)
    The models cannot be solved independently. I alredy saved a lot of time by removing the binary variables. With the implementation of your answer to 1. and 2., I think it will be enough. 

    To Marika:
    I removed the binary variables from a list, that is used to in a for-loop to define all the variables (addVars...).

    0
  • Marika Karbstein
    Gurobi Staff Gurobi Staff

    You could write the model as an LP file (see Model.write() for Python) directly before calling optimize.
    In this way, you can inspect the model that is solved by Gurobi.
    The LP file contains a section "General Constraints" (if there are any). That might help to understand where the 2 general constraints come from.

    0

Please sign in to leave a comment.