# Help me with repeated index

**URL:** https://discourse.julialang.org/t/help-me-with-repeated-index/35339
**Category:** Optimization (Mathematical)
**Created:** [February 29, 2020, 8:53pm UTC](https://discourse.julialang.org/t/help-me-with-repeated-index/35339 "2020-02-29T20:53:04Z")
**Posts on this page:** 1
**Showing post:** 2

<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 29, 2020, 9:49pm UTC](https://discourse.julialang.org/t/help-me-with-repeated-index/35339/2 "2020-02-29T21:49:27Z")

</div>

You cannot create a JuMP variable with duplicate indices. See, e.g.,

```nohighlight
model = Model()
@variable(model, x[[:a, :a, :b]])
x[:a] # Which `:a` is this referring to?

```

As [I said in the other post](https://discourse.julialang.org/t/help-me-with-indexing/35203/2), you probably intend

```nohighlight
model = Model()
@variable(model, v[1:size(branch, 1)])
v[3] # Corresponds to (4, 5, 0.2)

```

p.s. Please don’t open multiple posts with the same question: [Help me with indexing - #4 by varun\_yaramasu](https://discourse.julialang.org/t/help-me-with-indexing/35203/4). It can lead to the answers being split over multiple posts.

---

_[View the full topic](https://discourse.julialang.org/t/help-me-with-repeated-index/35339)._
