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

Hosung Song hosungs at umich.edu
Wed Feb 11 19:46:22 CET 2004


Dear Roberto,

Thanks again for your clarification. I made a workaround by declaring a 
temporary variable for consys, and copy a consys to it and add the temp 
consys to the polyhedron. It works fine, and it looks like I missed 
another important point in the documentation. Yeah, I'm sure that the 
additional recycled_constraints interface would certainly be of much 
help. Before that, I would like that warning to be emphasized in a 
specific way like my case. Thanks.

Best wishes,

Hosung

Roberto Bagnara wrote:
> 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
> 





More information about the PPL-devel mailing list