
fersman@lsv.ens-cachan.fr wrote:
In my program I need to assign a variable, say x, a new value, say y+k, in a polyhedron. As far as I understand, to do this i need to free x, i.e. romove constraints on x, and after that intersect with the constraint x==y+k. Using functions from the library, a can first remove dimension x, then add a new dimension and add a constraint. After that the representation of the polyhedron when it is printed changes, i.e. if A represented x before, now it would represent y. How to avoid this problem? Is there a better way of freeing a variable than removing the dimension and adding it again?
Dear Elena,
if I understand correctly you want to model the destructive assignment of a linear expression to one variable. If this is the case, what you want is the method
Polyhedron::affine_image()
For instance, if you want to update a polyhedron ph so as to reflect the assignment of y+k to x, all you have to do is
ph.affine_image(x, y+k)
You can play with the small test program under the signature so as to familiarize with that method. The program now prints
ph before: -x >= -3, y >= 0, x - y >= 0 ph after ph.affine_image(x, y-7): x - y = -7, -y >= -3, y >= 0
I may have misunderstood your question, of course. Please, don't hesitate to come back to us if that is the case. All the best,
Roberto