1 /* Test NNC_Polyhedron::ph.minimized_generators().
2    Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
3    Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
4 
5 This file is part of the Parma Polyhedra Library (PPL).
6 
7 The PPL is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 3 of the License, or (at your
10 option) any later version.
11 
12 The PPL is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
15 for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software Foundation,
19 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
20 
21 For the most up-to-date information see the Parma Polyhedra Library
22 site: http://bugseng.com/products/ppl/ . */
23 
24 #include "ppl_test.hh"
25 
26 namespace {
27 
28 bool
test01()29 test01() {
30   Variable A(0);
31   Variable B(1);
32   Variable C(2);
33   Variable D(3);
34   Variable E(4);
35 
36   NNC_Polyhedron ph(5, EMPTY);
37   ph.add_generator(point(52131*A + 11369*B - 483036*C - 776212*D - 401649*E));
38   ph.add_generator(point(-80461*A + 86836*B + 88698*C - 269590*D + 951545*E));
39   ph.add_generator(point(215169*A - 42532*B + 234755*C + 705077*D - 632177*E));
40   ph.add_generator(point(-294493*A - 44546*B + 861680*C + 344228*D + 224283*E));
41   ph.add_generator(point(-158536*A + 273936*B - 854715*C - 151614*D + 382491*E));
42   ph.add_generator(point(-207881*A - 205091*B - 385540*C + 729319*D + 483915*E));
43   ph.add_generator(point(-1084*A + 2507*B - 28428*C + 1882*D - 999590*E));
44 
45   ph.add_generator(point(450943*A - 416394*B + 883*C + 680432*D - 400345*E));
46   ph.add_generator(point(-483589*A - 16983*B - 824243*C + 106969*D - 273921*E));
47   ph.add_generator(point(554952*A - 155460*B - 572886*C - 91530*D + 575571*E));
48   ph.ascii_dump(vnout);
49   vnout << endl;
50 
51   const Generator_System& gs = ph.minimized_generators();
52   ph.ascii_dump(vnout);
53   vnout << endl;
54 
55   if (!ph.OK())
56     return false;
57 
58   bool ok = true;
59   unsigned num_points = 0;
60   for (Generator_System::const_iterator i = gs.begin(), gs_end = gs.end();
61        i != gs_end;
62        ++i) {
63     using namespace IO_Operators;
64     nout << *i << endl;
65     if (i->type() != Generator::POINT) {
66       nout << "i->type() == " << i->type() << endl;
67       ok = false;
68     }
69     ++num_points;
70   }
71 
72   nout << "points = " << num_points << endl;
73 
74   return ok;
75 }
76 
77 } // namespace
78 
79 BEGIN_MAIN
80   DO_TEST_F64(test01);
81 END_MAIN
82