# ERROR: LoadError: UndefVarError: getValue not defined

**URL:** <https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350>\
**Category:** Optimization (Mathematical)\
**Tags:** question, jump\
**Created:** [January 31, 2021, 11:48pm UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350 "2021-01-31T23:48:40Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prottay\_Adhikari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/prottay_adhikari/32/21590_2.png) [@Prottay\_Adhikari](https://discourse.julialang.org/u/Prottay_Adhikari)\
**Post date:** [January 31, 2021, 11:48pm UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/1 "2021-01-31T23:48:40Z")

</div>

I was trying to run the power system example to execute the economic load dispatch operation.

The original code was reported [here](https://www.juliaopt.org/notebooks/Dvorkin%20-%20Power%20systems%20-%20Economic%20dispatch%20and%20Unit%20commitment.html).

However when I try to run this code (with the modifications to make the code compliant with the current version), I get the following error.

ERROR: LoadError: UndefVarError: getValue not defined  
Stacktrace:  
[1] solve\_ed(::Array{Int64,1}, ::Array{Int64,1}, ::Array{Int64,1}, ::Int64, ::Int64, ::Int64) at c:\Users\prott\Documents\Julia\_scripts\economic\_dispatch.jl:57

Any help is appreciated. I am quite new to JuMP and Julia.

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [February 1, 2021, 12:03am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/2 "2021-02-01T00:03:27Z")

</div>

First of all, welcome to our community! 🎊

`getValue` seems to be the name for a previous `JuMP` version, [`value`](https://jump.dev/JuMP.jl/dev/reference/solutions/#JuMP.value) is the current name for this function.

---

<div class="post-metadata">

**Author:** ![Prottay\_Adhikari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/prottay_adhikari/32/21590_2.png) [@Prottay\_Adhikari](https://discourse.julialang.org/u/Prottay_Adhikari)\
**Post date:** [February 1, 2021, 12:24am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/3 "2021-02-01T00:24:47Z")

</div>

I replaced the getValue functions with value.

Now the new error is –

ERROR: LoadError: `JuMP.value` is not defined for collections of JuMP types. Use Julia’s broadcast syntax instead: `JuMP.value.(x)`.

Any suggestions?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [February 1, 2021, 12:36am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/4 "2021-02-01T00:36:45Z")

</div>

Did you try what the error told you?

---

<div class="post-metadata">

**Author:** ![Prottay\_Adhikari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/prottay_adhikari/32/21590_2.png) [@Prottay\_Adhikari](https://discourse.julialang.org/u/Prottay_Adhikari)\
**Post date:** [February 1, 2021, 12:43am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/5 "2021-02-01T00:43:02Z")

</div>

I just tried it …  
Not much help .

The latest ERROR Message is

ERROR: LoadError: UndefVarError: getObjectiveValue not defined

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [February 1, 2021, 1:09am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/6 "2021-02-01T01:09:40Z")

</div>

The problem is that that code is for a very old version of JuMP. I you need to read the documentation for the new version and the new syntax at

> **[JuMP](https://jump.dev/)**
>
> JuMP is a modeling language and supporting packages for mathematical optimization in Julia.

---

<div class="post-metadata">

**Author:** ![odow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/odow/32/28685_2.png) [@odow](https://discourse.julialang.org/u/odow)\
**Post date:** [February 1, 2021, 1:28am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/7 "2021-02-01T01:28:12Z")

</div>

Here is the updated tutorial: [Jupyter Notebook Viewer](https://nbviewer.jupyter.org/github/jump-dev/JuMPTutorials.jl/blob/master/notebook/modelling/power_systems.ipynb)

---

<div class="post-metadata">

**Author:** ![Prottay\_Adhikari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/prottay_adhikari/32/21590_2.png) [@Prottay\_Adhikari](https://discourse.julialang.org/u/Prottay_Adhikari)\
**Post date:** [February 1, 2021, 1:30am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/8 "2021-02-01T01:30:40Z")

</div>

Yeah. I guess there’s no shortcut.

---

<div class="post-metadata">

**Author:** ![dpsanders](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpsanders/32/3573_2.png) [@dpsanders](https://discourse.julialang.org/u/dpsanders)\
**Post date:** [February 1, 2021, 1:32am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/9 "2021-02-01T01:32:18Z")

</div>

Shortcut to what? @odow just posted the updated version of the code. That seems pretty short to me.

---

<div class="post-metadata">

**Author:** ![Prottay\_Adhikari](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/prottay_adhikari/32/21590_2.png) [@Prottay\_Adhikari](https://discourse.julialang.org/u/Prottay_Adhikari)\
**Post date:** [February 1, 2021, 1:52am UTC](https://discourse.julialang.org/t/error-loaderror-undefvarerror-getvalue-not-defined/54350/10 "2021-02-01T01:52:52Z")

</div>

Yeah. I just looked at it.

I meant … like I will actually need to read the documentation.

Thanks a lot.
