So, I get the error that probably the variable (and likely constraints as well) have a name longer than 255 characters. I have some custom types that I use as indices of the variables. I am sure this is leading to the issue. However, I was wondering if there is a way around this problem. Having the objects of these custom types as variables indices make the formulation more intuitive. A MWE (rather poorly written but does reproduce the error) reproducing the problem is shown below:
using JuMP, Gurobi
struct Type1
a::Int
b::Int
end
struct Type2
f::Vector{Type1}
end
struct Data
g::Vector{Type2}
end
type1_vec1 = Type1[]
for i in 1:50
push!(type1_vec1, Type1(i, i+1))
end
type1_vec2 = Type1[]
for i in 51:100
push!(type1_vec2, Type1(i, i+1))
end
data = Data([Type2(type1_vec1), Type2(type1_vec2)])
model = Model(Gurobi.Optimizer)
@variable(model, y[v in data.g], Bin)
optimize!(model)
I understand that the error is generated by Gurobi software and not Gurobi.jl
, but I am looking for suggestions on how to define indices if I actually want them to be custom type objects which can rather be lengthy. For example, a person
object with lots of attributes. Also, I understand may be I can have a unique identifier for each object but then I have some objects that are automatically generated based on the user defined objects, so I am not sure to what extent I can keep defining these unique identifiers.
Thanks!