# JuMP anonymous variables

**URL:** <https://discourse.julialang.org/t/jump-anonymous-variables/11831>\
**Category:** Optimization (Mathematical)\
**Created:** [June 20, 2018, 4:37pm UTC](https://discourse.julialang.org/t/jump-anonymous-variables/11831 "2018-06-20T16:37:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksh](https://avatars.discourse-cdn.com/v4/letter/k/8e8cbc/32.png) [@ksh](https://discourse.julialang.org/u/ksh)\
**Post date:** [June 20, 2018, 4:37pm UTC](https://discourse.julialang.org/t/jump-anonymous-variables/11831/1 "2018-06-20T16:37:53Z")

</div>

Hi, I’m trying to call anonymous variables based on the edges that exist in my tree-graph, but I’m getting the error with my first constraint stating that “t doesn’t exist.”  
I show only the relevant code below. t is a continuous variable.  
Any idea what the issue might be?

all\_edges is a 6-element Array{Any,1}:  
[1, 2]  
[2, 1]  
[2, 3]  
[3, 2]  
[3, 4]  
[4, 3]

* * *

```
MMkCPP = Model(solver=GurobiSolver(Threads=2));
U = 2;

for edge in all_edges
    x=@variable(MMkCPP,[edge[1],edge[2],1:U], category = :Bin)
    t=@variable(MMkCPP,[edge[1],edge[2],1:U], lowerbound = 0)
end

@objective(MMkCPP, Min, z)

for i in Adj_Nodes[ind_basenode]
    for k in 1:U
        @constraint(MMkCPP, z>=t[i,ind_basenode,k]) 
    end
end

```

---

<div class="post-metadata">

**Author:** ![abulak](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abulak/32/28314_2.png) [@abulak](https://discourse.julialang.org/u/abulak)\
**Post date:** [June 20, 2018, 9:35pm UTC](https://discourse.julialang.org/t/jump-anonymous-variables/11831/2 "2018-06-20T21:35:56Z")

</div>

sidenote: when you do `for edge in all_edges` you reassign `t`; it’s probably not what you intend if you need the variable later.

Why don’t you make `X` to be a vector?

```julia
Xs = [@variable(MMkCPP,[edge[1],edge[2],1:U], category = :Bin) for edge in all_edges]

```
