
Hi.
The error message is quite clear:
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
you are trying to apply operator * (multiplication) to a Variable (p) and a Linear_Expression (x0 - xp0), but there is no suitable overloading of the * operator, as this could result in a non-linear expression. In the PPL you can only directly work with linear expressions. Kind regards,
Roberto
On 06/03/22 09:44, Habeeb P wrote:
Hi,
Thanks for the reply.
Please see, I have attached the code.
Thanks HABEEB
*From:* Roberto Bagnara bagnara@cs.unipr.it *Sent:* Sunday, March 6, 2022 12:45 PM *To:* Habeeb P habeebp@iisc.ac.in *Cc:* The Parma Polyhedra Library developers' list ppl-devel@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@cs.unipr.it https://www.cs.unipr.it/mailman/listinfo/ppl-devel https://www.cs.unipr.it/mailman/listinfo/ppl-devel
PPL-devel mailing list PPL-devel@cs.unipr.it https://www.cs.unipr.it/mailman/listinfo/ppl-devel