Hi,
Sorry for the delay. I forgot to subscribe to the thread.
I'm using Gurobi version 5.6.1.
Here is some sample code. There is probably a better way to do this.
This takes 50sec on my computer.
Thanks
Renato
Code starts below:
---------
import numpy as np
import gurobipy as grb
# Create the variables corresponding to a doubly stochastic matrix, i.e
# entries are nonnegative and the entries on each row and column sum to one.
# This is sample code akin to what I'm doing.
dim = 1000
grb_model = grb.Model()
M = [grb_model.addVar(lb=0.0, ub=1.0, name="m" + str(v)) for v in xrange(dim * dim)]
M = np.array(M).reshape((dim, dim)).T
grb_model.update()
ones_v = np.ones((dim, 1), dtype=np.float)
row_constr = M.dot(ones_v)
col_constr = M.T.dot(ones_v)
for c in row_constr.ravel():
grb_model.addConstr(c, grb.GRB.LESS_EQUAL, 1.0)
for c in col_constr.ravel():
grb_model.addConstr(c, grb.GRB.LESS_EQUAL, 1.0)
grb_model.update()