Setting a value for a variable JuMP -- set value does not work

I have a huge LP problem and I tried to set values to some variables by using
setvalue(variable, value)
but surprisingly I have noticed in the final result that my variables got different values than this one I have set. Is it normal? Thanks in advance.
Bellow, the statement I have used:

for key in keys(potential_purchase)
    if potential_purchase[key...] == 0
        setvalue(var_purchase[key...],0)
    end
end

potential_purchase is a parameter
p.s: I have solved my problem creating extra constraints but I would like to avoid this solution because I ended up with many constraints not really important :frowning:

setvalue is for setting the initial value (warm start), equivalent to using the start keyword of @variable. You’re probably looking for JuMP.fix(x, val).

1 Like