Skip to main content

About the Matrix subtraction in gurobi

Answered

Comments

3 comments

  • Official comment
    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 why not try our AI Gurobot?.
  • Jaromił Najman
    • Gurobi Staff

    Hi,

    It is currently not possible to perform vector operations with \(\texttt{Var}\) objects. However, you can always write vector operation as sums. In your case, this would be

    for j in range(4):
    model.addConstr(k[j] <= np.linalg.norm(qr[j] - s[1]) ** 2 + 2 * (grb.quicksum( (qr[j][i] - s[1][i])*(q[j,i] - qr[j][i]) for i in range(3))) )

    Best regards,
    Jaromił

    0
  • Yanbo Fan
    • Gurobi-versary
    • Investigator
    • Thought Leader

    Hi Jaromił, 

    Thank you for your detailed answer. Thanks to your help, I have successfully solved this problem now. 

    Best regards,

    Yanbo

    0

Post is closed for comments.