[PPL-devel] Help regarding floating point constraints

Habeeb P habeebp at iisc.ac.in
Sun Mar 6 09:44:13 CET 2022


Hi,

Thanks for the reply.

Please see, I have attached the code.





Thanks
HABEEB
________________________________
From: Roberto Bagnara <bagnara at cs.unipr.it>
Sent: Sunday, March 6, 2022 12:45 PM
To: Habeeb P <habeebp at iisc.ac.in>
Cc: The Parma Polyhedra Library developers' list <ppl-devel at cs.unipr.it>
Subject: Re: [PPL-devel] Help regarding floating point constraints

External Email


Hello Habeeb.

Can you please attach a self-contained C++ program we
can use to try reproducing your problem?

Which version of the PPL are you using?
We recommend  the current Git version, devel branch.
You can find the repository at:

   git://git.bugseng.com/ppl/ppl.git

Thanks,

    Roberto



On 23/01/22 18:54, Habeeb P wrote:
> Hi,
>
> I am a Ph.D. student at the Indian Institute of Science, Bangalore, India.
>
>
> I have been working on a project that requires a polyhedron.
>
> The polyhedron has constraints with floating-point variables, as shown below in the following code snippet.
> Wher /*p,u,v */and w are f*loating-poin*t values *between 0 and 1, u+v+w =1.*
>
>
> Variablexp0(0);
> Variableyp0(1);
> Variablezp0(2);
>
> Variableu(0);
> Variablev(1);
> Variablew(2);
> Variablep(0);
>
>
> int x0 = vertices[insideVertex*3+0];
> int y0 = vertices[insideVertex*3+1];
> int z0 = vertices[insideVertex*3+2];
>
> int x1 = vertices[outsideVertex*3+0];
> int y1 = vertices[outsideVertex*3+1];
> int z1 = vertices[outsideVertex*3+2];
>
>
> pd->add_constraint( u+v+w == 1);
> pd->add_constraint(  u>=0) ;
> pd->add_constraint( v>=0);
> pd->add_constraint( w>=0);
> pd->add_constraint( p>=0);
> // pd->add_constraint( q>=0);
> //  pd->add_constraint( p+q ==1);
> pd->add_constraint(  ( (( p*(x0 - xp0)+ (1-p)*(x1 - xp0)) == (u*-35821+v*0+(w)*35821)) );
> pd->add_constraint( ((p*(y0 - yp0)+  (1-p)*(y1 - yp0)) == (u*35821+v*0+(w)*35821)) );
> pd->add_constraint( ((p*(z0 - zp0)+  (1-p)*(z1 - zp0)) == (u*-100000+v*0+(w)*-100000)));
>
> pd->add_constraint( -( (24*p*(x0-xp0))+(24*(1-p)*(x1-xp0))) >= ((PixelX - 24)*(p*(z0-zp0)+ (1-p)*(z1-zp0)) ) );
> pd->add_constraint( -( (24*p*(x0-xp0))+(24*(1-p)*(x1-xp0))) < ((PixelX+1 - 24)*(p*(z0-zp0)+ (1-p)*(z1-zp0)) ) );
>
> pd->add_constraint( ( 24*p*(y0-yp0) + 24* (1-p)*(y1-yp0) ) >= ( (PixelY-24) * (p*(z0-zp0)+ (1-p)*(z1-zp0)) ) );
> pd->add_constraint( ( 24*p*(y0-yp0) + 24* (1-p)*(y1-yp0) ) < ( (PixelY-24+1) * (p*(z0-zp0)+ (1-p)*(z1-zp0)) ) );
>
>
>
>
>
> While compiling the program, I am getting the following error;
>
>
> error: no match for ‘operator*’ (operand types are ‘Parma_Polyhedra_Library::Variable’ and ‘Parma_Polyhedra_Library::Linear_Expression’)
>    116 |                  pd->add_constraint(  ( (( p*(x0 - xp0)+ (1-p)*(x1 - xp0)) == (u*-35821+v*0+(w)*35821)) );
>        |                                            ~^~~~~~~~~~~
>        |                                            |     |
>        |                                            |     Parma_Polyhedra_Library::Linear_Expression
>        |                                            Parma_Polyhedra_Library::Variable
>
>
> Is there any way to get rid of this error?
>
>
> Is it possible to write my constraints using PPL (using either floating-point expression or intervals)?
>
>
>
> Thanks
> HABEEB
>
> _______________________________________________
> PPL-devel mailing list
> PPL-devel at cs.unipr.it
> https://www.cs.unipr.it/mailman/listinfo/ppl-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cs.unipr.it/pipermail/ppl-devel/attachments/20220306/94cc4b06/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pplTest1.cpp
Type: text/x-c++src
Size: 1484 bytes
Desc: pplTest1.cpp
URL: <http://www.cs.unipr.it/pipermail/ppl-devel/attachments/20220306/94cc4b06/attachment.cpp>


More information about the PPL-devel mailing list