You’re looking for something like
using JuMP, Cbc, Clp
function fix!(model::Model)
solution = Dict(
v => value(v) for v in all_variables(model)
)
for v in all_variables(model)
if is_binary(v)
unset_binary(v)
fix(v, solution[v]; force = true)
end
end
return
end
model = Model(Cbc.Optimizer)
@variable(model, x, Bin)
@objective(model, Max, 2 * x)
optimize!(model)
fix!(model)
set_optimizer(model, Clp.Optimizer)
optimize!(model)
dual(FixRef(x))