[PPL-devel] Help regarding floating point constraints
Habeeb P
habeebp at iisc.ac.in
Sun Jan 23 18:54:10 CET 2022
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 floating-point values between 0 and 1, u+v+w =1.
Variable xp0(0);
Variable yp0(1);
Variable zp0(2);
Variable u(0);
Variable v(1);
Variable w(2);
Variable p(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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cs.unipr.it/pipermail/ppl-devel/attachments/20220123/f3083df4/attachment.htm>
More information about the PPL-devel
mailing list