I’ve been trying to solve an ILP in Python where the primary bottle neck appears to be model construction. Multiple sources cite that model construction is heavily language dependent (whereas the optimization is language-independent), and I’m trying to see if I can re-implement the same ILP in Julia.
Trouble is, I can’t seem to find an API documentation. Just translating the Python ILP (where it works) into Julia seems to be a huge hassle. Would someone be able to point me in the right direction? Ie:
# PYTHON
I= 30
J=113000
K=1500
T1=400
T2=25
N = 50
penalty = 1000
model = gp.Model("STT_rnd1")
r_i_j = model.addVars(I, J, vtype=GRB.BINARY, name="r_i_j")
y_i_k = model.addVars(I, K, vtype=GRB.BINARY, name="y_i_k")
z_i_j_k = model.addVars(I, K, vtype=GRB.INTEGER, name="z_i_j_k")
s_j_k = copy.deepcopy(dense_adj_mat) # a numpy matrix
for i in range(I):
for k in range(K):
model.addConstr(gp.quicksum(r_i_j[i,j]*y_i_k[i,k]*s_j_k[j,k] for j in range(J))>= T1*y_i_k[i,k])
is something I have tested already in Python, but I can’t get past instantiating some of these parameters in Julia:
# JULIA
model = Model(Gurobi.Optimizer)
Gurobi.add_vars!(model, 0.0, I, J, Gurobi.GRB_BINARY, "r_i_j")
throwing the following error:
MethodError: no method matching add_vars!(::Model, ::Float64, ::Int64, ::Int64, ::Int8, ::String)
Closest candidates are:
add_vars!(::Gurobi.Model, ::Union{Char, Int8, Array{Char,1}, Array{Int8,1}}, ::Array{T,1} where T, ::Union{Array{T,1}, T} where T<:Real, ::Union{Array{T,1}, T} where T<:Real) at C:\Users\b2jia.julia\packages\Gurobi\VhpiN\src\grb_vars.jl:111