Skip to main content

MLinExpr and LinExpr incompatibilities, how to avoid that?

Answered

Comments

2 comments

  • 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

Please sign in to leave a comment.