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

Retrieve constraints matrix from Gurobi or MOI or JuMP in Julia

回答済み

コメント

3件のコメント

  • Simon Bowly
    • Gurobi Staff Gurobi Staff

    Hi Hongyu,

    When you say print the matrix, do you mean you want to extract all coefficients of all constraints into a dense or sparse array? Or are you just aiming to traverse all constraints and variables and print each coefficient?

    Best regards,
    Simon

    0
  • Hongyu Zhang
    • Gurobi-versary
    • First Comment
    • First Question

    Hi Simon, 

    Thanks for your reply.

    I mean to extract all coefficients of all constraints into a dense or sparse array. 

    Kind regards,

     

    Hongyu.

    0
  • Simon Bowly
    • Gurobi Staff Gurobi Staff

    Hi Hongyu,

    There doesn't seem to be a method in JuMP to directly access the constraint matrix anymore, due to the different types of constraints it can handle. There is some discussion about this in the discourse forum and the section of the documentation on accessing constraints.

    You could use this to extract each coefficient and build a matrix for selected constraints. I suggest reading the discourse post above in its entirety though. I think the comments from the developers there (that in general there should be no need to extract the constraint matrix for a model you have already formulated algebraically) are quite accurate.

    Best regards,
    Simon

    0

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