# JuMP 2-d array Decision Variable computationally expensive

**URL:** <https://discourse.julialang.org/t/jump-2-d-array-decision-variable-computationally-expensive/84987>\
**Category:** Optimization (Mathematical)\
**Tags:** performance, array\
**Created:** [July 29, 2022, 4:33pm UTC](https://discourse.julialang.org/t/jump-2-d-array-decision-variable-computationally-expensive/84987 "2022-07-29T16:33:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sophiepavia](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sophiepavia/32/37488_2.png) [@sophiepavia](https://discourse.julialang.org/u/sophiepavia)\
**Post date:** [July 29, 2022, 4:33pm UTC](https://discourse.julialang.org/t/jump-2-d-array-decision-variable-computationally-expensive/84987/1 "2022-07-29T16:33:37Z")

</div>

I am creating a decision variable that is a 2-d array of size 25122 x 25122. (length of `arcs` and `od` are both 25122)

Is there a more efficient way to initialize a multi-dimensional array as a decision variable? I have checked out this link but didn’t seem to find anything help for multi-dimensional JuMP arrays: [Performance Tips · The Julia Language](https://docs.julialang.org/en/v1/manual/performance-tips/)

`@variable(model,f[arcs,od] >=0)`

I am working on a 8 core, 64 gb. 1 tb machine and attempted to run this line of code for 8+ hours with no completion. All other decision variables are created under 3 seconds.  
Ex:  
`@variable(model,x[arcs], Bin)` where `arcs` is of size 25122

---

<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:** [July 29, 2022, 6:37pm UTC](https://discourse.julialang.org/t/jump-2-d-array-decision-variable-computationally-expensive/84987/2 "2022-07-29T18:37:00Z")

</div>

25122x25122 is 630,000,000 variables. Do you expect to be able to solve a problem of that size?

It probably shouldn’t take 8 hours without doing anything, but you’re probably running out of RAM and swapping.
