Workaround for modifying coefficients in constraints in JuMP?

Is there any reason why set_coefficient doesn’t work?

We try to discourage the use of deepcopy. Instead, you could use a function to rebuild the base model:

function base_model()
    model = Model()
    @variable(model, x)
    @variable(model, y)
    @constraint(model, x >= 0)
    return model
end

for c in 1:3  
    m = base_model()
    @constraint(m, m[:x] + c * m[:y] <= 1)
    optimize!(m)
end