[PPL-devel] Asking for confirmation: ppl_Polyhedron_add_constraints()

Roberto Bagnara bagnara at cs.unipr.it
Wed Feb 11 19:35:09 CET 2004


Hosung Song wrote:
> When I add constraint system to polyhedron by 
> ppl_Polyhedron_add_constraings(poly, consys), it looks like consys is 
> cleared to universe. Is this a right behavior? I naively thought the 
> consys would be preserved. Is this related to the recycle issue between 
> ordinary polyhedron instantiation and recycled instantiation? Thanks in 
> advance.

Dear Hosung,

yes, ppl_Polyhedron_add_constraints(poly, consys) does modify consys
in an unpredictable way.  If you look at the user's manual, or in
ppl_c.h in the include subdirectory of your installation prefix,
or at the file ppl_c.h.in in the distribution, you will see something like

/*! \brief
   Adds the system of constraints \p cs to the system of constraints of
   \p ph.

   \warning
   This function modifies the constraint system referenced by \p cs:
   upon return, no assumption can be made on its value.
*/
int
ppl_Polyhedron_add_constraints(ppl_Polyhedron_t ph, ppl_ConSys_t cs);

Moreover, you should notice that the `cs' argument is of type `ppl_ConSys_t'
and not `ppl_const_ConSys_t', so that it can be modified.  The reason of
this design choice is that often a constraint system is only built to
be added to a polyhedron, after which serves no other purposes.  By
using its data structures, unnecessary memory allocations and deallocations
are avoided.  We should perhaps name the function differently and perhaps
provide also the other behavior.  How about

   ppl_Polyhedron_add_recycled_constraints

for the current behavior and keeping

   ppl_Polyhedron_add_constraints

for the version that does not modify the constraint system?
Do you think this would help the users of the C interface?
All the best,

     Roberto

-- 
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy
http://www.cs.unipr.it/~bagnara/
mailto:bagnara at cs.unipr.it





More information about the PPL-devel mailing list