[PPL-devel] Handling Rational Coefficients

Roberto Bagnara bagnara at cs.unipr.it
Sun Apr 24 17:18:55 CEST 2016


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

-- 
     Prof. Roberto Bagnara

Applied Formal Methods Laboratory - University of Parma, Italy
mailto:bagnara at cs.unipr.it
                              BUGSENG srl - http://bugseng.com
                              mailto:roberto.bagnara at bugseng.com



More information about the PPL-devel mailing list