Skip to main content

Solving a non linear Programming and not getting results

Awaiting user input

Comments

1 comment

  • Jaromił Najman
    • Gurobi Staff Gurobi Staff

    Hi Biswajit,

    The behavior you see is caused by the piecewise approximation approach of the \(\sqrt{}\) function. It is necessary to provide tight lower and upper bounds for all variables participating in nonlinear PWL terms. Without good bounds, the constructed PWL approximation is very weak and leads to numerical inaccuracies.

    Note that your \(\texttt{x1[i],y1[i]}\) can be negative and a variable's lower bound equals \(0\) per default. Setting the following bounds

    x=m.addVar(ub=100,vtype=GRB.CONTINUOUS, name='x')
    y=m.addVar(ub=100,vtype=GRB.CONTINUOUS, name='y')
    x1=m.addVars(C,lb=-100, ub=100, vtype=GRB.CONTINUOUS, name='x1')
    y1=m.addVars(C,lb=-100, ub=100, vtype=GRB.CONTINUOUS, name='y1')
    D=m.addVars(C, ub=100, vtype=GRB.CONTINUOUS, name='D')
    d=m.addVars(C, ub=100, vtype=GRB.CONTINUOUS, name='d')

    improves the numerical stability but is still far from perfect.

    Did you consider using the Manhattan distance for your coordinates instead of the Euclidean distance? This would avoid using squares and the \(\sqrt{}\) function and use the abs function instead.


    Best regards, 
    Jaromił

    0

Please sign in to leave a comment.