メインコンテンツへスキップ

コメント

3件のコメント

  • 正式なコメント
    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 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
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you very much Jaromil!

    0

投稿コメントは受け付けていません。