
Dear PPL Team,
I'd like to use PPL for linear arithmetic with rational coefficients. For instance, I'd like to be able to use constraints like 0.3*x + 2.66*y
= 1. When I tried to create a NNC_Polyhedra with that formula, PPL
converted it to 2*y >=1.
Based on the tutorials, I should be able to use mpq_class to support rational coefficients. I see that there is an instantiation of BD_Shape with mp_class specialization. However, I couldn't find something equivalent for Polyhedra and its subclasses. I also tried to change the configuration file and set PPL_COEFFICIENT_TYPE to mpq_class and rebuilt PPL but that didn't seem to work either.
I'd appreciate if you could provide me info on this.
Regards
Tuba

On 24/04/2016 15:14, Tuba Yavuz wrote:
Dear PPL Team,
I'd like to use PPL for linear arithmetic with rational coefficients. For instance, I'd like to be able to use constraints like 0.3*x + 2.66*y >= 1. When I tried to create a NNC_Polyhedra with that formula, PPL converted it to 2*y >=1.
Based on the tutorials, I should be able to use mpq_class to support rational coefficients. I see that there is an instantiation of BD_Shape with mp_class specialization. However, I couldn't find something equivalent for Polyhedra and its subclasses. I also tried to change the configuration file and set PPL_COEFFICIENT_TYPE to mpq_class and rebuilt PPL but that didn't seem to work either.
I'd appreciate if you could provide me info on this.
Regards
Tuba
Hello Tuba.
Which interface of the PPL are you using? C++, I suppose. Where did you find in the manual that you could code a constraint with C++ code of the form 0.3*x + 2.66*y >= 1 ?
You really need to consult the manual in order to use the PPL.
For the specific thing, if by 0.3 and 2.66 you mean the rational numbers with precisely those values, then you can express that constraint in the C++ interface, e.g., with 30*x + 266*y >= 100 . Kind regards,
Roberto

Hello Roberto,
Yes, I was using C++. Section 1.5.10 in the manual made me hope that we might be able to input rational coefficients. Now, I understand that we need to do some pre-processing to achieve that.
And I found the manual very useful; with the necessary technical details.
Thanks for the quick response.
Tuba
On 2016-04-24 11:18, Roberto Bagnara wrote:
On 24/04/2016 15:14, Tuba Yavuz wrote:
Dear PPL Team,
I'd like to use PPL for linear arithmetic with rational coefficients. For instance, I'd like to be able to use constraints like 0.3*x + 2.66*y >= 1. When I tried to create a NNC_Polyhedra with that formula, PPL converted it to 2*y >=1.
Based on the tutorials, I should be able to use mpq_class to support rational coefficients. I see that there is an instantiation of BD_Shape with mp_class specialization. However, I couldn't find something equivalent for Polyhedra and its subclasses. I also tried to change the configuration file and set PPL_COEFFICIENT_TYPE to mpq_class and rebuilt PPL but that didn't seem to work either.
I'd appreciate if you could provide me info on this.
Regards
Tuba
Hello Tuba.
Which interface of the PPL are you using? C++, I suppose. Where did you find in the manual that you could code a constraint with C++ code of the form 0.3*x + 2.66*y >= 1 ?
You really need to consult the manual in order to use the PPL.
For the specific thing, if by 0.3 and 2.66 you mean the rational numbers with precisely those values, then you can express that constraint in the C++ interface, e.g., with 30*x + 266*y >= 100 . Kind regards,
Roberto
participants (2)
-
Roberto Bagnara
-
Tuba Yavuz