Error while defining binary variable in JuMP

Hi, I’m trying to initialize a vector of binary variables as follows:

model = Model(Gurobi.Optimizer)
@variable(model, z[1:12], Bin)

But I get this error:

Exception has occurred: MethodError

MethodError: no method matching promote_shape(::Tuple{Vector{Int64}}, ::Tuple{Vector{Int64}})

How can I resolve this?

1 Like

Hi! Can you share the complete code and the complete error stacktrace?


Hi @vineetjnair9, what version of JuMP and Julia are you using? Your code is correct; it shouldn’t trigger this error, so something else must be going on.