Skip to main content

Calculate the determinant of a matrix that includes quadratic expressions.

Answered

Comments

3 comments

  • Official comment
    Simranjit Kaur
    • Gurobi Staff

    This post is more than two 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.

  • Riley Clement
    • Gurobi Staff

    Hi Bohao,

    The code you linked is intended to be used with a matrix of variables (MVar) but you are passing it a matrix of quadratic expressions (MQuadExpr).  The easiest solution here is to define a MVar for the gram matrix, e.g.

    Xe = m.addMVar((ne,me),lb=0, ub=1, vtype=GRB.CONTINUOUS)
    Xe_gram = m.addMVar((ne,ne),lb=0, ub=me, vtype=GRB.CONTINUOUS)
    m.addConstr(Xe @ Xe.T == Xe_gram)
    aux5 = det(Xe_gram)

    - Riley

     

    0
  • Bohao Li
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you very much for your help, Riley. Have a wonderful day!

    0

Post is closed for comments.