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

MLinExpr and LinExpr incompatibilities, how to avoid that?

回答済み

コメント

2件のコメント

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

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