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_defs_hh
00024 #define PPL_Constraint_defs_hh 1
00025
00026 #include "Constraint.types.hh"
00027 #include "Scalar_Products.types.hh"
00028 #include "Linear_Row.defs.hh"
00029 #include "Variable.defs.hh"
00030 #include "Linear_Expression.defs.hh"
00031 #include "Constraint_System.defs.hh"
00032 #include "Polyhedron.types.hh"
00033 #include <iosfwd>
00034
00035 namespace Parma_Polyhedra_Library {
00036
00037
00038
00040
00041 bool
00042 operator==(const Constraint& x, const Constraint& y);
00043
00045
00046 bool
00047 operator!=(const Constraint& x, const Constraint& y);
00048
00050
00051 Constraint
00052 operator==(const Linear_Expression& e1, const Linear_Expression& e2);
00054
00055 Constraint
00056 operator==(const Linear_Expression& e, Coefficient_traits::const_reference n);
00058
00059 Constraint
00060 operator==(Coefficient_traits::const_reference n, const Linear_Expression& e);
00061
00063
00064 Constraint
00065 operator<=(const Linear_Expression& e1, const Linear_Expression& e2);
00067
00068 Constraint
00069 operator<=(const Linear_Expression& e, Coefficient_traits::const_reference n);
00071
00072 Constraint
00073 operator<=(Coefficient_traits::const_reference n, const Linear_Expression& e);
00074
00076
00077 Constraint
00078 operator>=(const Linear_Expression& e1, const Linear_Expression& e2);
00080
00081 Constraint
00082 operator>=(const Linear_Expression& e, Coefficient_traits::const_reference n);
00084
00085 Constraint
00086 operator>=(Coefficient_traits::const_reference n, const Linear_Expression& e);
00087
00089
00090 Constraint
00091 operator<(const Linear_Expression& e1, const Linear_Expression& e2);
00093
00094 Constraint
00095 operator<(const Linear_Expression& e, Coefficient_traits::const_reference n);
00097
00098 Constraint
00099 operator<(Coefficient_traits::const_reference n, const Linear_Expression& e);
00100
00102
00103 Constraint
00104 operator>(const Linear_Expression& e1, const Linear_Expression& e2);
00106
00107 Constraint
00108 operator>(const Linear_Expression& e, Coefficient_traits::const_reference n);
00110
00111 Constraint
00112 operator>(Coefficient_traits::const_reference n, const Linear_Expression& e);
00113
00114 }
00115
00116
00117 namespace std {
00118
00120
00121 void swap(Parma_Polyhedra_Library::Constraint& x,
00122 Parma_Polyhedra_Library::Constraint& y);
00123
00124 }
00125
00127
00224 class Parma_Polyhedra_Library::Constraint : private Linear_Row {
00225 public:
00227 Constraint(const Constraint& c);
00228
00230 ~Constraint();
00231
00233 Constraint& operator=(const Constraint& c);
00234
00236 static dimension_type max_space_dimension();
00237
00239 dimension_type space_dimension() const;
00240
00242 enum Type {
00244 EQUALITY,
00246 NONSTRICT_INEQUALITY,
00248 STRICT_INEQUALITY
00249 };
00250
00252 Type type() const;
00253
00258 bool is_equality() const;
00259
00264 bool is_inequality() const;
00265
00270 bool is_nonstrict_inequality() const;
00271
00276 bool is_strict_inequality() const;
00277
00279
00283 Coefficient_traits::const_reference coefficient(Variable v) const;
00284
00286 Coefficient_traits::const_reference inhomogeneous_term() const;
00287
00289 static const Constraint& zero_dim_false();
00290
00295 static const Constraint& zero_dim_positivity();
00296
00301 memory_size_type total_memory_in_bytes() const;
00302
00304 memory_size_type external_memory_in_bytes() const;
00305
00317 bool is_tautological() const;
00318
00331 bool is_inconsistent() const;
00332
00341 bool is_equivalent_to(const Constraint& y) const;
00342
00343 PPL_OUTPUT_DECLARATIONS;
00344
00345 #ifdef PPL_DOXYGEN_INCLUDE_IMPLEMENTATION_DETAILS
00346
00351 #endif
00352 bool ascii_load(std::istream& s);
00353
00355 bool OK() const;
00356
00358 void swap(Constraint& y);
00359
00360 private:
00361 friend class Parma_Polyhedra_Library::Congruence;
00362 friend class Parma_Polyhedra_Library::Scalar_Products;
00363 friend class Parma_Polyhedra_Library::Topology_Adjusted_Scalar_Product_Sign;
00364 friend class Parma_Polyhedra_Library::Constraint_System;
00365 friend class Parma_Polyhedra_Library::Constraint_System::const_iterator;
00366
00367 friend class Parma_Polyhedra_Library::Polyhedron;
00368
00369 friend
00370 Parma_Polyhedra_Library
00371 ::Linear_Expression::Linear_Expression(const Constraint& c);
00372
00374 Constraint();
00375
00380 Constraint(Linear_Expression& e, Type type, Topology topology);
00381
00386 void
00387 throw_dimension_incompatible(const char* method,
00388 const char* name_var,
00389 Variable v) const;
00390
00391 friend Constraint
00392 Parma_Polyhedra_Library::operator==(const Linear_Expression& e1,
00393 const Linear_Expression& e2);
00394 friend Constraint
00395 Parma_Polyhedra_Library::operator==(const Linear_Expression& e,
00396 Coefficient_traits::const_reference n);
00397 friend Constraint
00398 Parma_Polyhedra_Library::operator==(Coefficient_traits::const_reference n,
00399 const Linear_Expression& e);
00400
00401 friend Constraint
00402 Parma_Polyhedra_Library::operator>=(const Linear_Expression& e1,
00403 const Linear_Expression& e2);
00404 friend Constraint
00405 Parma_Polyhedra_Library::operator>=(const Linear_Expression& e,
00406 Coefficient_traits::const_reference n);
00407 friend Constraint
00408 Parma_Polyhedra_Library::operator>=(Coefficient_traits::const_reference n,
00409 const Linear_Expression& e);
00410
00411 friend Constraint
00412 Parma_Polyhedra_Library::operator<=(const Linear_Expression& e1,
00413 const Linear_Expression& e2);
00414 friend Constraint
00415 Parma_Polyhedra_Library::operator<=(const Linear_Expression& e,
00416 Coefficient_traits::const_reference n);
00417 friend Constraint
00418 Parma_Polyhedra_Library::operator<=(Coefficient_traits::const_reference n,
00419 const Linear_Expression& e);
00420
00421 friend Constraint
00422 Parma_Polyhedra_Library::operator>(const Linear_Expression& e1,
00423 const Linear_Expression& e2);
00424 friend Constraint
00425 Parma_Polyhedra_Library::operator>(const Linear_Expression& e,
00426 Coefficient_traits::const_reference n);
00427 friend Constraint
00428 Parma_Polyhedra_Library::operator>(Coefficient_traits::const_reference n,
00429 const Linear_Expression& e);
00430
00431 friend Constraint
00432 Parma_Polyhedra_Library::operator<(const Linear_Expression& e1,
00433 const Linear_Expression& e2);
00434 friend Constraint
00435 Parma_Polyhedra_Library::operator<(const Linear_Expression& e,
00436 Coefficient_traits::const_reference n);
00437 friend Constraint
00438 Parma_Polyhedra_Library::operator<(Coefficient_traits::const_reference n,
00439 const Linear_Expression& e);
00440
00442 Constraint(const Constraint& c, dimension_type sz);
00443
00448 static Constraint construct_epsilon_geq_zero();
00449
00451 static const Constraint& epsilon_geq_zero();
00452
00457 static const Constraint& epsilon_leq_one();
00458
00460 void set_is_equality();
00461
00463
00468 void set_is_inequality();
00469 };
00470
00471 namespace Parma_Polyhedra_Library {
00472
00473 namespace IO_Operators {
00474
00476
00477 std::ostream& operator<<(std::ostream& s, const Constraint& c);
00478
00480
00481 std::ostream& operator<<(std::ostream& s, const Constraint::Type& t);
00482
00483 }
00484
00485 }
00486
00487 #include "Constraint.inlines.hh"
00488
00489 #endif // !defined(PPL_Constraint_defs_hh)