Data structure for sparse coefficient matrices
AnsweredI am new to Gurobi and I am trying to understand which data structure to use for coefficients. I want to model a large sparse coefficient matrix A as seen below. I am wondering if it should be done using a tuplelist, a tupledict or some other structure? In the statement below, A is the coefficient matrix and z is a decision variable.

Welcome to Gurobi!
Which API are you going to use? (From your mention of tuplelist and tupledict, I am going to assume Python.)
As of version 8.1.1, Gurobi does not support matrixbased modeling in Python. So right now the recommendation is to model your constraints using the addConstr method (or in bulk using addConstrs). You can have a look at the code examples here.
With Gurobi 9 (scheduled for later this fall), you will be able to do matrixoriented modeling, using NumPy or SciPy matrices.
Please sign in to leave a comment.
Comments
1 comment