# A bug about JuMP.jl

**URL:** https://discourse.julialang.org/t/a-bug-about-jump-jl/116870
**Category:** Optimization (Mathematical)
**Tags:** question, jump
**Created:** [July 10, 2024, 12:07pm UTC](https://discourse.julialang.org/t/a-bug-about-jump-jl/116870 "2024-07-10T12:07:13Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lionisxn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lionisxn/32/37989_2.png) [@lionisxn](https://discourse.julialang.org/u/lionisxn)
#### Post date: [July 10, 2024, 12:07pm UTC](https://discourse.julialang.org/t/a-bug-about-jump-jl/116870/1 "2024-07-10T12:07:13Z")

</div>

I was wondering whether there exist bugs of calling for "value(function, expr) ". My codes are like this:

> M = Model()  
> @variable(M, x)  
> @variable(M, y)  
> @NLconstraint(M, con, x + x\*y^2 - 3 \>= 0)  
> t = all\_constraints(M; include\_variable\_in\_set\_constraints = true)  
> D = Dict(x =\> 1)  
> value(x → get(D,x,x), t[1])  
> An error is thrown that
> 
> ![20240710200201](https://global.discourse-cdn.com/julialang/original/3X/9/c/9caa062e20c8d2ffcb4412b06f9bc5ebf0ead7bc.jpeg)

---

<div class="post-metadata">

### Author: ![blegat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/blegat/32/217090_2.png) [@blegat](https://discourse.julialang.org/u/blegat)
#### Post date: [July 10, 2024, 4:29pm UTC](https://discourse.julialang.org/t/a-bug-about-jump-jl/116870/2 "2024-07-10T16:29:41Z")

</div>

`get(D,x,x)` will return `1` if `x` is `model[:x]` and will return `x` if `x` is `model[:y]`. That’s an issue since this is a variable instead of a number. `get(D, x, 0)` will work since `0` is a number. Note sure if `0` is appropriate though, it depends on what you want to do
