00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef PPL_Constraint_System_defs_hh
00024 #define PPL_Constraint_System_defs_hh 1
00025
00026 #include "Constraint_System.types.hh"
00027 #include "Linear_Expression.types.hh"
00028 #include "Linear_System.defs.hh"
00029 #include "Generator.types.hh"
00030 #include "Polyhedron.types.hh"
00031 #include "Constraint.types.hh"
00032 #include "LP_Problem.types.hh"
00033 #include <iterator>
00034 #include <iosfwd>
00035
00036 namespace Parma_Polyhedra_Library {
00037
00038 namespace IO_Operators {
00039
00041
00046 std::ostream& operator<<(std::ostream& s, const Constraint_System& cs);
00047
00048 }
00049
00050
00052 bool operator==(const Polyhedron& x, const Polyhedron& y);
00053
00054 }
00055
00056
00057 namespace std {
00058
00060
00061 void swap(Parma_Polyhedra_Library::Constraint_System& x,
00062 Parma_Polyhedra_Library::Constraint_System& y);
00063
00064 }
00065
00067
00127 class Parma_Polyhedra_Library::Constraint_System : private Linear_System {
00128 public:
00130 Constraint_System();
00131
00133 explicit Constraint_System(const Constraint& c);
00134
00136 Constraint_System(const Constraint_System& cs);
00137
00139 ~Constraint_System();
00140
00142 Constraint_System& operator=(const Constraint_System& y);
00143
00145 static dimension_type max_space_dimension();
00146
00148 dimension_type space_dimension() const;
00149
00154 bool has_strict_inequalities() const;
00155
00160 void clear();
00161
00166 void insert(const Constraint& c);
00167
00172 static const Constraint_System& zero_dim_empty();
00173
00175
00189 class const_iterator
00190 : public std::iterator<std::forward_iterator_tag,
00191 Constraint,
00192 ptrdiff_t,
00193 const Constraint*,
00194 const Constraint&> {
00195 public:
00197 const_iterator();
00198
00200 const_iterator(const const_iterator& y);
00201
00203 ~const_iterator();
00204
00206 const_iterator& operator=(const const_iterator& y);
00207
00209 const Constraint& operator*() const;
00210
00212 const Constraint* operator->() const;
00213
00215 const_iterator& operator++();
00216
00218 const_iterator operator++(int);
00219
00224 bool operator==(const const_iterator& y) const;
00225
00230 bool operator!=(const const_iterator& y) const;
00231
00232 private:
00233 friend class Constraint_System;
00234
00236 Linear_System::const_iterator i;
00237
00239 const Linear_System* csp;
00240
00242 const_iterator(const Linear_System::const_iterator& iter,
00243 const Constraint_System& csys);
00244
00246 void skip_forward();
00247 };
00248
00254 const_iterator begin() const;
00255
00257 const_iterator end() const;
00258
00260 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00261
00265 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00266 bool OK() const;
00267
00268 PPL_OUTPUT_DECLARATIONS;
00269
00270 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00271
00276 #endif // PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00277 bool ascii_load(std::istream& s);
00278
00280 memory_size_type total_memory_in_bytes() const;
00281
00283 memory_size_type external_memory_in_bytes() const;
00284
00286 void swap(Constraint_System& y);
00287
00288 private:
00289 friend class const_iterator;
00290 friend class Parma_Polyhedra_Library::Polyhedron;
00291 friend class Parma_Polyhedra_Library::LP_Problem;
00292
00293 friend bool
00294 Parma_Polyhedra_Library::operator==(const Polyhedron& x,
00295 const Polyhedron& y);
00296
00298 explicit Constraint_System(Topology topol);
00299
00305 Constraint_System(Topology topol,
00306 dimension_type n_rows, dimension_type n_columns);
00307
00316 bool adjust_topology_and_space_dimension(Topology topol,
00317 dimension_type num_dimensions);
00318
00320 Constraint& operator[](dimension_type k);
00321
00323 const Constraint& operator[](dimension_type k) const;
00324
00326 bool satisfies_all_constraints(const Generator& g) const;
00327
00329
00363 void affine_preimage(dimension_type v,
00364 const Linear_Expression& expr,
00365 Coefficient_traits::const_reference denominator);
00366
00368 dimension_type num_equalities() const;
00369
00371 dimension_type num_inequalities() const;
00372
00379 void simplify();
00380
00386 void insert_pending(const Constraint& c);
00387
00389 void add_low_level_constraints();
00390 };
00391
00392
00393
00394 #endif // !defined(PPL_Constraint_System_defs_hh)