# Getting NaN output from JuMP variable after solving

**URL:** https://discourse.julialang.org/t/getting-nan-output-from-jump-variable-after-solving/65026
**Category:** Optimization (Mathematical)
**Tags:** question, jump
**Created:** [July 21, 2021, 8:39am UTC](https://discourse.julialang.org/t/getting-nan-output-from-jump-variable-after-solving/65026 "2021-07-21T08:39:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![manoj.centura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manoj.centura/32/216443_2.png) [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)
#### Post date: [July 21, 2021, 8:39am UTC](https://discourse.julialang.org/t/getting-nan-output-from-jump-variable-after-solving/65026/1 "2021-07-21T08:39:53Z")

</div>

Hi All,  
I am running a linear program with Gurobi. The variable is set as

````julia
@variable(mod2,0<=L_time_bC[b in 1:18, c in 1:3] ) ```
I am using julia 1.62 with [c52e3926] Atom v0.12.32
  [336ed68f] CSV v0.8.5
  [9961bab8] Cbc v0.8.0
  [a93c6f00] DataFrames v1.2.0
  [c91e804a] Gadfly v1.3.3
  [2e9cd046] Gurobi v0.9.14
  [682c06a0] JSON v0.21.1
  [4076af6c] JuMP v0.21.8
  [e5e0dc1b] Juno v0.8.4
  [f0f68f2c] PlotlyJS v0.16.4
  [112f6efa] VegaLite v2.6.0
  [ade2ca70] Dates
````

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [July 21, 2021, 9:04am UTC](https://discourse.julialang.org/t/getting-nan-output-from-jump-variable-after-solving/65026/2 "2021-07-21T09:04:45Z")

</div>

Welcome! Please provide a minimal (non-)working example (preferrably copy-pastable). In your code, we don’t know what `L_time_bC` is and there is no indication what’s going wrong.

Please read this for more information on how to best help us to help you:

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

<div class="post-metadata">

### Author: ![manoj.centura](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/manoj.centura/32/216443_2.png) [@manoj.centura](https://discourse.julialang.org/u/manoj.centura)
#### Post date: [July 21, 2021, 9:08am UTC](https://discourse.julialang.org/t/getting-nan-output-from-jump-variable-after-solving/65026/3 "2021-07-21T09:08:20Z")

</div>

Thanks for the reply. I will try to provide a working example. Just to add the problem is not happening with Julia 1.2. what should be the compatible JuMP version for Julia 1.62

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [July 21, 2021, 9:10am UTC](https://discourse.julialang.org/t/getting-nan-output-from-jump-variable-after-solving/65026/4 "2021-07-21T09:10:52Z")

</div>

If you have added `JuMP` via Pkg (e.g. via `]add JuMP`), it will automatically pick the most recent version compatible with the julia version you’re using.

---

<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 21, 2021, 1:22pm UTC](https://discourse.julialang.org/t/getting-nan-output-from-jump-variable-after-solving/65026/5 "2021-07-21T13:22:20Z")

</div>

Did you check the [solution status](https://jump.dev/JuMP.jl/v0.21.8/manual/solutions/) ? NaN value for JuMP variables are often obtained when the solver did not find any solution. You can see this with the different statuses. Posting the output of `solution_summary` here could help as well.
