Hello,
@blegat, here is an example.
Without the “MAXTIME”, the problem finds a solution in 18sec. If I set the “MAXTIME”, I obtain the error described above.
using Xpress
using JuMP
using Random
m = Model(()->Xpress.Optimizer(DEFAULTALG=2, PRESOLVE=0, logfile = "zz.log"))
set_optimizer_attribute(m,"MAXTIME", 10)
N = 100
n_on = 10
Node = zeros(N)
for i in N
Node[i] = i
end
X_node_o = randcycle(MersenneTwister(1234),N)
Y_node_o = randcycle(MersenneTwister(0234),N)
X_node_on = randcycle(MersenneTwister(1234),n_on)
Y_node_on = randcycle(MersenneTwister(0234),n_on)
@variable(m, 0<=P_node[1:N]<=3)
P_on = ones(n_on)*10
N_lines = factorial(big(N))/(2*factorial(big(N-2)))+N*n_on
L = zeros(trunc(Int,N_lines))
I = zeros(Int8,N+n_on,trunc(Int,N_lines))
@variable(m, y[1:trunc(Int,N_lines)])
@variable(m, cap[1:trunc(Int,N_lines)])
@variable(m, b[1:trunc(Int,N_lines)], Int)
l = 1
for i in 1:N
for j in i+1:N
I[i,l] = 1
I[j,l] = -1
L[l] = (X_node_o[i]-X_node_o[j])^2+(Y_node_o[i]-Y_node_o[j])^2
global l+=1
end
for k in 1:n_on
I[i,l] = 1
I[N+k,l] = -1
L[l] = (X_node_o[i]-X_node_on[k])^2+(Y_node_o[i]-Y_node_on[k])^2
global l+=1
end
end
for n in 1:N
@constraint(m, I[n,:]'*y==P_node[n])
end
for n in 1:n_on
@constraint(m, I[N+n,:]'*y+P_on[n]==0)
end
for l in 1:trunc(Int, N_lines)
@constraint(m, cap[l]>= y[l])
@constraint(m, cap[l]>= -y[l])
@constraint(m, cap[l]<= b[l]*10)
end
C = 0
for i in 1:trunc(Int, N_lines)
global C += b[i]*L[i] + L[i]*cap[i]
end
@objective(m, Min, C)
optimize!(m)
Thank you in advance,
KR,
TM