Can you try
function dense_lp2(nvar, ncol)
data = rand(nvar, ncol)
model = direct_model(Xpress.Optimizer())
x = @variable(model, [1:nvar], lower_bound = 0.0)
y = @variable(model, [1:ncol], lower_bound = 0.0)
slack = @variable(model, lower_bound = 0.0)
@constraint(model, sum(x) == 1)
for j in 1:ncol
@constraint(model, sum(data[i, j] * x[i] for i=1:nvar) <= y[j] + slack)
end
@objective(model, Min, slack + 200 * sum(y) / ncol)
return model
end
@time dense_lp2(2000, 2000);
On my machine this builds for Gurobi in 120 seconds, which seems reasonable.
julia> function dense_lp2(nvar, ncol)
data = rand(nvar, ncol)
model = direct_model(Gurobi.Optimizer())
x = @variable(model, [1:nvar], lower_bound = 0.0)
y = @variable(model, [1:ncol], lower_bound = 0.0)
slack = @variable(model, lower_bound = 0.0)
@constraint(model, sum(x) == 1)
for j in 1:ncol
@constraint(model, sum(data[i, j] * x[i] for i=1:nvar) <= y[j] + slack)
end
@objective(model, Min, slack + 200 * sum(y) / ncol)
return model
end
dense_lp2 (generic function with 1 method)
julia> @time dense_lp2(2000, 2000);
Set parameter Username
Academic license - for non-commercial use only - expires 2022-06-19
0.638469 seconds (90.22 k allocations: 372.590 MiB, 9.64% gc time)
julia> @time dense_lp2(2000, 20000);
Set parameter Username
Academic license - for non-commercial use only - expires 2022-06-19
6.618951 seconds (846.25 k allocations: 3.634 GiB, 11.40% gc time)
julia> @time dense_lp2(20000, 20000);
Set parameter Username
Academic license - for non-commercial use only - expires 2022-06-19
124.733077 seconds (1.18 M allocations: 49.292 GiB, 4.27% gc time)