[PPL-devel] Help regarding floating point constraints

Roberto Bagnara bagnara at cs.unipr.it
Sun Mar 6 08:15:50 CET 2022


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


More information about the PPL-devel mailing list