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

Calculate the determinant of a matrix that includes quadratic expressions.

回答済み

コメント

2件のコメント

  • Riley Clement
    Gurobi Staff 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
    First Comment
    First Question

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

    0

サインインしてコメントを残してください。