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

MLinExpr and LinExpr incompatibilities, how to avoid that?

回答済み

コメント

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.
  • Simon Bowly
    • Gurobi Staff

    Hi Daniele,

    We currently have a few issues with interactions between Var/LinExpr and MVar/MLinExpr. There were some fixes added to the most recent release (version 9.5.1) which should address your case. Could you please upgrade to version 9.5.1 and additionally rewrite your constraints as below?

    model.addConstrs(
        a @ X - b @ Y[:, s] - zeta - Z[s] <= 0
        for s in range(100)
    )

    Note - I'm assuming here that X is a 1D MVar (similar to Z) and a and b are 1D numpy arrays with compatible shapes for multiplying with X and Y[:, s].

    Best regards,
    Simon

    1
  • Daniele Gioia
    • Gurobi-versary
    • First Comment
    • First Question

    Thank you Simon, now it works!

    0

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