
Hi again,
I wonder if there is any way (by using the API) to discover which dimensions are equal. Right now, I inspect the constraint system looking for 1*X + -1 *Y = 0, but that 'ad-hoc' solution simply does not look right. Can you help me? Thanks!

On Wed, 20 Jul 2005, Mario Mendez wrote:
Hi again,
I wonder if there is any way (by using the API) to discover which dimensions are equal. Right now, I inspect the constraint system looking for 1*X + -1 *Y = 0, but that 'ad-hoc' solution simply does not look right. Can you help me? Thanks!
Hi,
Inspecting the constraints is definitely not the right way to check if X=Y. There is no guarantee as to the exact form of a constraint system for the polyhedron returned to the user. So the constraint X = Y may be implied by the other constraints but not explicitly in the constraint system.
(Assuming Prolog, but the solution I think would be similar for the C or C++ API)
To see if the constraint X = Y is satisfied by all the points in a polyhedron, there is the predicate ppl_Polyhedron_relation_with_constraint/3
If Poly is your polyhedron and X, Y your dimensions, the query ppl_Polyhedron_relation_with_constraint(Poly, X = Y, R). will unify R with a list of relations one of which will be "included_in" if and only if the constraint X = Y is satisfied by all the points in Poly.
With regards to your stated problem of finding _which_ dimensions are equal, I do not know of any way other than by checking all the pairs of dimensions X and Y and checking if X = Y holds using a method such as that given above.
Can you say what it is about your application that led to such a query?
Best wishes, Pat

Thank you! Another question then:
How can I insert dimensions in the middle? E.G: convert [B=2,E=8] Dim= N in [B=2,G=8] Dim = N + 2 after inserting two "universe" dimensions between the original B and E. I already know how to add at the beginning/end, but no idea about how to use the library for this particular purpose.
Thanks again
PS: I'm working in a abstract domain based on your library for finding linear invariants....
P M Hill wrote:
On Wed, 20 Jul 2005, Mario Mendez wrote:
Hi again,
I wonder if there is any way (by using the API) to discover which dimensions are equal. Right now, I inspect the constraint system looking for 1*X + -1 *Y = 0, but that 'ad-hoc' solution simply does not look right. Can you help me? Thanks!
Hi,
Inspecting the constraints is definitely not the right way to check if X=Y. There is no guarantee as to the exact form of a constraint system for the polyhedron returned to the user. So the constraint X = Y may be implied by the other constraints but not explicitly in the constraint system.
(Assuming Prolog, but the solution I think would be similar for the C or C++ API)
To see if the constraint X = Y is satisfied by all the points in a polyhedron, there is the predicate ppl_Polyhedron_relation_with_constraint/3
If Poly is your polyhedron and X, Y your dimensions, the query ppl_Polyhedron_relation_with_constraint(Poly, X = Y, R). will unify R with a list of relations one of which will be "included_in" if and only if the constraint X = Y is satisfied by all the points in Poly.
With regards to your stated problem of finding _which_ dimensions are equal, I do not know of any way other than by checking all the pairs of dimensions X and Y and checking if X = Y holds using a method such as that given above.
Can you say what it is about your application that led to such a query?
Best wishes, Pat

Mario Mendez ha scritto:
Thank you! Another question then:
How can I insert dimensions in the middle? E.G: convert [B=2,E=8] Dim= N in [B=2,G=8] Dim = N + 2 after inserting two "universe" dimensions between the original B and E. I already know how to add at the beginning/end, but no idea about how to use the library for this particular purpose.
Dear Mario,
we have already answered this question two weeks ago:
http://www.cs.unipr.it/pipermail/ppl-devel/2005-July/006205.html
What you want is the map_space_dimensions functionality.
PS: I'm working in a abstract domain based on your library for finding linear invariants....
Which norms are you using?
We have implemented (around 2001) an argument size relation analysis with the China analyzer. It currently supports the following norms: term size, list length and total list length. Please let us know in case you want more information. All the best,
Roberto

On Thu, 21 Jul 2005, Mario Mendez wrote:
Thank you! Another question then:
How can I insert dimensions in the middle? E.G: convert [B=2,E=8] Dim= N in [B=2,G=8] Dim = N + 2 after inserting two "universe" dimensions between the original B and E. I already know how to add at the beginning/end, but no idea about how to use the library for this particular purpose.
I am not completely clear. If you mean that you want to insert two dimensions between the "B" and "C" dimensions, and rename the "E" dimension as "G", then here is a snippet of Prolog that does this.
T = c, ppl_new_Polyhedron_from_space_dimension(T, 5, universe, P), ppl_Polyhedron_add_constraints(P, [B = 2, E = 8]), ppl_Polyhedron_add_space_dimensions_and_embed(P, 2), ppl_Polyhedron_map_space_dimensions(P, [A-A, B-B, C-E, D-F, E-G, F-C, G-D]), ppl_new_Polyhedron_from_space_dimension(T, 7, universe, Q), ppl_Polyhedron_add_constraints(Q, [B = 2, G = 8]), ppl_Polyhedron_equals_Polyhedron(P, Q).
Basically, I have added the 2 new dimensions to the end and then use the "map_space_dimensions" predicate to rearrange the order of the dimensions.
PS: I'm working in a abstract domain based on your library for finding linear invariants....
Best wishes, Pat

Thanks! It's true that you already answered the question but I was looking for an example....
P M Hill wrote:
On Thu, 21 Jul 2005, Mario Mendez wrote:
Thank you! Another question then:
How can I insert dimensions in the middle? E.G: convert [B=2,E=8] Dim= N in [B=2,G=8] Dim = N + 2 after inserting two "universe" dimensions between the original B and E. I already know how to add at the beginning/end, but no idea about how to use the library for this particular purpose.
I am not completely clear. If you mean that you want to insert two dimensions between the "B" and "C" dimensions, and rename the "E" dimension as "G", then here is a snippet of Prolog that does this.
T = c, ppl_new_Polyhedron_from_space_dimension(T, 5, universe, P), ppl_Polyhedron_add_constraints(P, [B = 2, E = 8]), ppl_Polyhedron_add_space_dimensions_and_embed(P, 2), ppl_Polyhedron_map_space_dimensions(P, [A-A, B-B, C-E, D-F, E-G, F-C, G-D]), ppl_new_Polyhedron_from_space_dimension(T, 7, universe, Q), ppl_Polyhedron_add_constraints(Q, [B = 2, G = 8]), ppl_Polyhedron_equals_Polyhedron(P, Q).
Basically, I have added the 2 new dimensions to the end and then use the "map_space_dimensions" predicate to rearrange the order of the dimensions.
PS: I'm working in a abstract domain based on your library for finding linear invariants....
Best wishes, Pat

Mario Mendez wrote:
Thanks! It's true that you already answered the question but I was looking for an example....
Dear Mario,
the file interfaces/Prolog/tests/pl_check.pl contains examples of usage for all the Prolog interface predicates. Is this the kind of example you are looking for? All the best,
Roberto

On Thu, 21 Jul 2005 22:22:01 +0000, Mario Mendez wrote
Thank you! Another question then:
How can I insert dimensions in the middle? E.G: convert [B=2,E=8] Dim= N in [B=2,G=8] Dim = N + 2 after inserting two "universe" dimensions between the original B and E. I already know how to add at the beginning/end, but no idea about how to use the library for this particular purpose.
Dear Mario,
we have already answered this question two weeks ago:
http://www.cs.unipr.it/pipermail/ppl-devel/2005-July/006205.html
What you want is the map_space_dimensions functionality.
PS: I'm working in a abstract domain based on your library for finding linear invariants....
Which norms are you using?
We have implemented (around 2001) an argument size relation analysis with the China analyzer. It currently supports the following norms: term size, list length and total list length. Please let us know in case you want more information. 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@cs.unipr.it
participants (5)
-
Mario Mendez
-
P M Hill
-
Roberto Bagnara
-
Roberto Bagnara
-
Roberto Bagnara