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

**URL:** <https://discourse.julialang.org/t/setting-a-value-for-a-variable-jump-set-value-does-not-work/12861>\
**Category:** Specific Domains\
**Created:** [August 3, 2018, 3:29pm UTC](https://discourse.julialang.org/t/setting-a-value-for-a-variable-jump-set-value-does-not-work/12861 "2018-08-03T15:29:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jayce\_ram](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jayce_ram/32/3977_2.png) [@jayce\_ram](https://discourse.julialang.org/u/jayce_ram)\
**Post date:** [August 3, 2018, 3:29pm UTC](https://discourse.julialang.org/t/setting-a-value-for-a-variable-jump-set-value-does-not-work/12861/1 "2018-08-03T15:29:30Z")

</div>

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:

```julia
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 ☹

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [August 3, 2018, 3:43pm UTC](https://discourse.julialang.org/t/setting-a-value-for-a-variable-jump-set-value-does-not-work/12861/2 "2018-08-03T15:43:08Z")

</div>

`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)`.
