/Users/fpy/titan-1-5-MBARI/Mers/Generators/BFIG/BFIGConstraint.h

00001 
00002 //
00003 // Copyright (c) 2004           Model-based Embedded and Robotic Systems Group
00004 // All Rights Reserved          Massachusetts Institute of Technology
00005 //
00006 // This software is provided as is. Model-based Embedded and Robotic Systems
00007 // (MERS) group does not assume any responsibility.
00008 //
00009 // Organization:        Model-based Embedded and Robotic Systems Group
00010 //                                      Massachusetts Institute of Technology
00011 //
00013 //# CHECKED MJP 08-07-2002
00014 
00015 #ifndef __BFIGConstraint__
00016 #define __BFIGConstraint__
00017 
00018 #ifdef _MSC_VER
00019 #pragma warning(disable:4786)
00020 #endif
00021 
00022 #include <cstdlib>
00023 #include <string>
00024 #include <vector>
00025 #include <list>
00026 
00027 #include "BFIGConstraintUnit.h"
00028 
00029 namespace Mers {
00030         namespace Generators {
00031                 namespace BFIG {
00032 
00033                         class BFIGAssignment;
00034                         class BFIGImplicant;
00035 
00039                         class BFIGConstraint
00040                         {
00041                                 friend std::ostream&  operator<<(std::ostream&, BFIGConstraint const &);
00042 
00043                         public:
00044                                 BFIGConstraint(bool noEssentialConflict_ = true);
00045                                 // construct a unit constraint:
00046                                 BFIGConstraint(BFIGAssignment const * a, bool positive);
00047                                 BFIGConstraint(BFIGConstraint const & c);
00048                                 BFIGConstraint(BFIGConstraintUnit const & cu);
00049                                 // Construct a constraint based on a Conflict: (negated!!)
00050                                 BFIGConstraint(std::vector<BFIGAssignment const *> const & inconsistentAssignments);
00051 
00052                                 ~BFIGConstraint();
00053 
00054 
00055                                 void                      addUnit(BFIGConstraintUnit const & unit);
00056                                 void                      addUnit(BFIGAssignment const * a, bool parity);
00057 
00058                                 bool                      empty()  const;
00059                                 bool                      isEmpty()  const;
00060                                 unsigned int              size()  const;
00061                                 unsigned int              getSize()  const;
00062                                 unsigned int              primeImplicantSize()  const;
00063 
00064                                 std::vector<BFIGAssignment const *>  getAssignments()  const;
00065                                 std::list<BFIGConstraintUnit>      getConstraintUnits()  const;
00066 
00067                                 //bool                      isSatisfiedCurrent(bool conjunctive = false)  const;
00068                                 //bool                      maybeSatisfiedCurrent(bool conjunctive = false)  const;
00069                                 bool                      supportedBy(BFIGImplicant const * implicant) const;
00070                                 bool                      supportedBy(BFIGAssignment const * a) const;
00071 
00072                                 BFIGConstraint                withoutEnd()  const;
00073                                 std::vector<BFIGConstraint>          negated()  const;
00074                                 bool                      contains(BFIGAssignment const * a)  const;
00075                                 // returns true if reduction took place:
00076                                 bool                      reduce(BFIGConstraintUnit const & cu);
00077                                 void                      clear();
00078 
00079                                 bool                      isEssentialConflict()  const;
00080 
00081                                 void                      makePrimeImplicants();
00082                                 void                      addPrimeImplicants(BFIGConstraintUnit const & cu);
00083                                 std::list<BFIGAssignment const *>  getPrimeImplicants()  const;
00084 
00085                                 static bool                 terse;
00086 
00087                                 //----------------------------------------------------
00088                                 //      TYPE DEFINITIONS & OVERLOADED OPERATORS
00089                                 //----------------------------------------------------
00090                                 bool operator==(BFIGConstraint const & c)  const;
00091                                 bool operator<(BFIGConstraint const & c)   const;
00092 
00093                         private:
00094                                 std::list<BFIGConstraintUnit>       constraintUnits;
00095                                 bool                       essentialConflict;
00096                                 std::list<BFIGAssignment const *>   primeImplicants;
00097                                 bool                       primed;
00098 
00099                                 //void          sort();
00100 
00101                         };
00102                 }
00103         }
00104 }
00105 
00106 #endif // __BFIGConstraint__
00107 

Generated on Mon Dec 4 14:16:50 2006 for Mers by  doxygen 1.5.0