Relaxation of MIP in order to use getdual

Ah. Your constraint has a * 2 * x. When you fix a variable it does not replace it with a constant.

This is covered in the docs, albeit in a slightly weird place:

You need to set Gurobi’s QCPDual parameter:

fixed_model = get_fixed_model(model)
set_optimizer_attribute(fixed_model, "QCPDual", 1)
optimize!(fixed_model)

julia> has_duals(fixed_model)
true

julia> shadow_price(fixed_model[:reference])
-0.4999999999696272