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

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?

all_variables(poly)
1 Like

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.

1 Like

That’s all right! Thank you all the same! :handshake:

1 Like