I am working on a large-scale Mixed Integer Linear Programming (MILP) problem using Gurobi. The decision variable vector x
is binary and has a dimension of approximately n = 40,000,000
. The objective function is defined as:
obj = c * x
where c
is a coefficient vector of the same size as x
.
I also need to add a very large number of constraints in batch form. Specifically, the constraints are of the form:
A * x <= b
where:
A is a matrix with dimensions n x n_col, where n_col is approximately 3,000,000.
B is a vector of size n.
Given the scale of the problem, I need to avoid adding constraints iteratively and instead handle them in a batched manner. I am looking for the most efficient way to add these constraints to the Gurobi model.
My questions are:
Is it possible to add constraints like A * x <= B
in a single batch using Gurobi's API?
What is the most efficient way to handle this size of constraints in Gurobi?
Are there any performance tips or methods (e.g., using sparse matrices) to manage this large-scale problem effectively?
Take a look, it will be helpful:
Gurobi Python Interface: Matrix-friendly Modeling Techniques
Simple example: matrix1.py