[PPL-devel] Linear constraint solving example with floating point co-efficients

Mahesh Nanjundappa knmahesh at vt.edu
Tue Aug 23 15:31:26 CEST 2011


Hi all,

Please don't feel annoyed by this request. I did try for looking for
examples in the folder I downloaded and in the manual. But couldnt find what
I was looking for.

I'm looking for a simple example where a linear constraint system with
floating point coefficients (variables can also take floating point values)
is solved and output is printed to either file or stdout. I don't have
strict requirement to number of decimal points it has to be accurately
computed. I'm fine with just 2 decimal points.

The system can be as simple as this,

1.2*x + 2.3y <= 8.2
2.2*x + 1.4*y <= 7.1

This one example I tried out but with integer coefficients.
#include <ppl.hh>
#include "ppl_c.h"

using namespace Parma_Polyhedra_Library;

int main()
{

Variable x(0);
Variable y(1);
Constraint_System CS;

Linear_Expression LE1 = 1*x + 2*y;
Linear_Expression LE2 = 2*x + 1*y;

CS.insert(LE1 <= 7);
CS.insert(LE2 <= 5);

C_Polyhedron P(CS);

return 0;
}

It would be great if someone can help me out with this by providing an
example or code for the system I described earlier.

Thanks in advance,
Mahesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cs.unipr.it/pipermail/ppl-devel/attachments/20110823/d62e3c95/attachment.htm>


More information about the PPL-devel mailing list