Skip to main content

@ operator for 2 Mvars

Answered

Comments

2 comments

  • Official comment
    Simranjit Kaur
    Gurobi Staff 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 why not try our AI Gurobot?.
  • Eli Towle
    Gurobi Staff Gurobi Staff

    This is not possible at the moment, but it has been logged as a feature request. In the meantime, you can use matrix semantics to add the constraints individually:

    m, n, p = 3, 4, 5

    x = model.addMVar((m,n), name='x')
    y = model.addMVar((n,p), name='y')

    model.addConstrs((x[i,:] @ y[:,j] <= 1 for i in range(m) for j in range(p)), name='matrixcon')
    0

Post is closed for comments.