Skip to main content

Hello I have a nonlinear problem. Gurobi seems to not be able to solve it. Is there a workaround for nonlinear problems? It is nonlinear and nonconvex.

Answered

Comments

3 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    Hi,

    Is there a workaround for nonlinear problems? It is nonlinear and nonconvex.

    There are only a few "workarounds" to nonlinear nonconvex problems.

    • Approximate the model via a piecewise-linear approximation. For this you can either use Gurobi's built in general functions or construct an approximation by hand.
    • Try to reformulate the model such that it becomes convex. This is very rare but may be possible, e.g., you could use inequalities instead of equalities. The constraint \(x^2 = 1\) is nonconvex but \(x^2 \leq 1\) is convex.

    Alternatively I would need to use eg ipopt.

    Please note that IPOPT is a local solver, i.e., it cannot guarantee that the solution it finds is a global optimum. Often enough a good local solution is good enough in practice and the great speed of a local solver easily outshines a global approach. Still, you need to aware that there is no guarantee about the quality of the found solution.

    But my question is for gurobi if there is any solver or parameter to place.

    Do you have a log you could share? This would make recommending parameters easier. In general, you should have a look at Most important parameters for MIPs as these are also useful for nonconvex models.

    Best regards, 
    Jaromił

    0
  • Ros1_imperial
    Gurobi-versary
    First Comment
    First Question

    Thank you .

    a) Yes I have a jupyter-notebook (ipynb) file that I can share which models the ACOPF (AC optiamal power flow) but the results using IPOPT are infeasible for no reason. Would you like me to send it to you?

    b) Below is the nonlinear constraints included. I have 4 such constraints as the one shown below. You see it is highly nonlinear. The "model.V" is a decision variable. 

    c) So gurobi does not have a nonlinear solver such as ipopt? or some parameters?

    def const_define_pr(model, t, lin,bus):
        ul = linenumsdata[lin]['fromBus']
        vl = linenumsdata[lin]['toBus']
        gl = linenumsdata[lin]['g']
        bl = linenumsdata[lin]['b']

        
        part1 = model.V[vl, t]*model.V[vl,t]*gl
        part2 = -model.V[vl,t]*model.V[ul,t]*gl*cos(  model.delta[vl,t] - model.delta[ul,t]  )
        part3 = -model.V[ul, t]*model.V[vl,t]*bl * sin( model.delta[vl,t] - model.delta[ul,t]  )
        return model.Pijr[ t, lin, bus ] ==  part1 + part2 + part3



    0
  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    a) Yes I have a jupyter-notebook (ipynb) file that I can share which models the ACOPF (AC optiamal power flow) but the results using IPOPT are infeasible for no reason. Would you like me to send it to you?

    b) Below is the nonlinear constraints included. I have 4 such constraints as the one shown below. You see it is highly nonlinear. The "model.V" is a decision variable. 

    ACOPF problem are well known for being extremely difficult to solve even for already very small instances. Often also local optimization methods struggle to converge to a feasible point. There is usually not much one can do, except for trying to improve the numerical properties of the model (which often is not trivial since it's a real application with already shaky data) or implementing several model improvements like the JABR inequalities. I don't think that providing the model would be of much help due to its complexity.

    You might be interested in trying out the latest OptiMod introduced by Gurobi for Optimal Power Flow problems. You can find the Github repository here together with the respective documentation. Note that, as of today, the OptiMod models OPF models via rectangular coordinates, i.e., we avoid cos and sin and use bilinear terms instead.

    c) So gurobi does not have a nonlinear solver such as ipopt? or some parameters?

    Gurobi does have a nonlinear solver, but as of today the capabilities are limited compared to IPOPT. Your best shot would be to try the OptiMod and see whether this helps.

    0

Please sign in to leave a comment.