[PPL-devel] Restoring dimensions

Roberto Bagnara bagnara at cs.unipr.it
Tue Jul 5 08:16:12 CEST 2005


Mario Mendez wrote:
> I'm working with your PPL library by using the Prolog interface, 
> although my question is generic. Say we have a 3D polyhedron P defined 
> by (for example): [A > 0, A + B < 3, C=4]
> 
> Now we project  *ppl_Polyhedron_remove_space_dimensions* over {A,C} 
> getting P': [ 3>A>0, C=4 ].

Dear Mario,

if you project over {A, C} it means that you remove the B dimension,
hence the C dimension becomes the B dimension.  You should thus end
up with [ A>0, B=4 ].

If, instead, you project over {B, C} it means that you remove the
A dimension, hence the B dimension becomes A and C becomes B.
You should thus and up with [ A<3, B=4 ].

I do not see how you could obtain [ 3>A>0, C=4 ].

> Later on we want to intersect the projected eq.system P'(that might be 
> altered during the program) with P. The problem is that our 'C' is 
> VAR(2) in P but VAR(1) in P' so a call to 
> *ppl_Polyhedron_add_constraints_and_minimize*
> adding to P the Constraint System of P' produces an undesired output->
>     ...
>       A = '$VAR'(0),B = '$VAR'(1), C = '$VAR'(2),
>     ppl_new_Polyhedron_from_constraints(nnc,[A>0,A+B<3,C=2],Poly1),
>     ppl_new_Polyhedron_from_Polyhedron(nnc,Poly1,nnc,Poly2),
>     ppl_Polyhedron_remove_space_dimensions(Poly2,[B]),
>     ppl_Polyhedron_get_minimized_constraints(Poly2,Poly2_Cons),
>     ppl_Polyhedron_add_constraints_and_minimize(Poly1,Poly2_Cons),!,
>     ...
> no
> 
> , although the original system is solvable
> 
> How can we add dimensions to P' so the intersection with P saves the 
> original information about B? Note that B is not the first dimension (so 
> we cannot use *concatenate_assign* nor the last one (so we cannot use 
> *add_space_dimension*. An "ad-hoc" solution might store the deleted 
> indexes and then make a version of the Constraint System of P' with all 
> the VAR(X) renumbered according to that information, so a call to 
> *add_constraints* makes sense, but I wonder if there's an alternative 
> just using the API.
> 
> Thanks!
> 
> PS: Assume that the projection is mandatory

Even though I do not understand the example you give, if you want to
add dimensions "in the middle" then the `map_space_dimensions' operation
is may be what you want.  Or maybe you did not want to remove dimensions,
but simply to "forget" the information about some dimensions.  Then
the `add_generators' operation may be what you want.  Please, come back
to us with a clearer explanation of what you have, what you do and what
you want, so that we can see what is your best option.
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