# How to check the dimension names before eliminating some dimensions of a polyhedron?

**URL:** <https://discourse.julialang.org/t/how-to-check-the-dimension-names-before-eliminating-some-dimensions-of-a-polyhedron/111864>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package, polyhedra\
**Created:** [March 20, 2024, 10:05am UTC](https://discourse.julialang.org/t/how-to-check-the-dimension-names-before-eliminating-some-dimensions-of-a-polyhedron/111864 "2024-03-20T10:05:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [March 20, 2024, 10:05am UTC](https://discourse.julialang.org/t/how-to-check-the-dimension-names-before-eliminating-some-dimensions-of-a-polyhedron/111864/1 "2024-03-20T10:05:50Z")

</div>

```julia
using Polyhedra
using JuMP
using CDDLib

poly = Model()
@variable(poly, -1 <= x <= 1)
@variable(poly, -1 <= y <= 1)
P = polyhedron(poly, CDDLib.Library(:exact))
P_y = eliminate(P, [1])

```

How can I make sure the index `[1]` is corresponding to dimension `x`? Do they always follow the order that they are created in?

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [March 22, 2024, 8:05am UTC](https://discourse.julialang.org/t/how-to-check-the-dimension-names-before-eliminating-some-dimensions-of-a-polyhedron/111864/2 "2024-03-22T08:05:14Z")

</div>

```julia
all_variables(poly)

```

---

<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:** [March 22, 2024, 8:07am UTC](https://discourse.julialang.org/t/how-to-check-the-dimension-names-before-eliminating-some-dimensions-of-a-polyhedron/111864/3 "2024-03-22T08:07:16Z")

</div>

Ooops, yes, sorry, I didn’t get a chance to reply. `all_variables` is the correct way to find the order of variables in a model.

---

<div class="post-metadata">

**Author:** ![WuSiren](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wusiren/32/42529_2.png) [@WuSiren](https://discourse.julialang.org/u/WuSiren)\
**Post date:** [March 22, 2024, 8:12am UTC](https://discourse.julialang.org/t/how-to-check-the-dimension-names-before-eliminating-some-dimensions-of-a-polyhedron/111864/4 "2024-03-22T08:12:38Z")

</div>

That’s all right! Thank you all the same! 🤝
