Hi @theplatters ![]()
I don’t know what @model and @exogenous are, so I don’t know how much help I will be, but:
You probably need
function build_jump_model(em::EconomicModel)
model = Model(HiGHS.Optimizer)
for (k, v) in em.maximisation_variables
model[k] = @variable(model)
end
return model
end
or
function build_jump_model(em::EconomicModel)
model = Model(HiGHS.Optimizer)
@variable(model, x[keys(em.maximisation_variables)])
return model
end
You should almost never use eval.
I’ll point you to these parts of the JuMP documentation:
Happy to answer further questions after you’ve read.
I’ll caution you that if you’re writing the @model macro, then getting this to work can be very tricky. I’d encourage you to think of alternative approaches before you try to be too clever with the macros.