
Sriram Sankaranarayanan wrote:
There is this wierd thing I noticed last night, maybe it could be a minor misunderstanding on my part:
I was playing around with a prototype for a paper that I am writing, and this time I am doing memory measurements.
Since I have pretty printing routines already written up for C_Polyhedra, I usually put my constraints into a C_Polyhedron p and then pass it around. This way I do not have to write pretty printers everytime.
But then inside a pretty print routine, when I call
ConSys cs = p.constraints()
it should just give me the constraints *without* minimizing it.. right?
But sometimes (for large dimensions), the call actually starts using up a lot of memory and time. The result is actually a minimized version of what I passed. This is not bad for my method, but I am wondering why it does this. In one case, it takes more time for me to print my invariants than to compute them. Of course, when the printing happens, I get a minimized set of invariants, but I did not specifically ask for them. The manual as far as I can see does not say anything about minimization.
Dear Sriram,
when the constraints are up-to-date (which is the case after, e.g., computing intersections), Polyhedron::constraints() will simply return them. When they are _not_ up-to-date (which may be the case after, e.g., computing poly-hulls) the constraints must be regenerated from scratch. When this happens, Polyhedron::constraints() may be expensive, and will give you _minimized_ constraints. The library is lazy: if you do not specify that you want minimized constraints you may get them not minimized or minimized; which is the case is an implementation detail (i.e., the behavior in this respect may even change from a PPL release to another).
This is not to say that you have not identified a problem in the PPL. If you can provide us with code that we can run to reproduce the behavior you are observing we may be able to say more. It is thanks to one application that we have identified and fixed several avoidable inefficiencies in what will become PPL 0.7. Give us the code and we will make your application (and others) go faster. Cheers,
Roberto