Skip to main content

Comments

2 comments

  • Jaromił Najman
    Gurobi Staff Gurobi Staff

    The constraint in it's current state is not a SOC by definition due to the linear parts. This can be easily fixed by defining additional variables for each point square

    for i, (point, d) in enumerate(zip(offset_points, D)):
            xp = model.addVar(lb = - GRB.INFINITY, name="xp_point_%d"%(i) )
            yp = model.addVar(lb = - GRB.INFINITY, name="yp_point_%d"%(i) )
            model.addConstr(xp == x - point[0])
            model.addConstr(yp == y - point[1])
            model.addConstr(xp ** 2 + yp ** 2 <= d ** 2, f"dist_const_{i}")
            model.addConstr(0 <= d)

    This should fix your problem.

    0
  • Stefan Nedeljkovic
    First Comment
    First Question

    Thank you very much Jaromil!

    0

Please sign in to leave a comment.