/Users/fpy/titan-1-5-MBARI/Mers/Generators/BFIG/BFIGAssignment.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 __ASSIGNMENT_BFIG__
00016 #define __ASSIGNMENT_BFIG__
00017 
00018 #ifdef _MSC_VER
00019 #pragma warning( disable : 4786 )
00020 #endif
00021 
00022 #include <Mers/Models/Base/BaseModelAssignment.h>
00023 
00024 #include <cstdlib>
00025 #include <iostream>
00026 #include <vector>
00027 #include <list>
00028 
00029 #include <Mers/Utils/Lang/String.h>
00030 #include <Mers/Utils/Containers/IntegerArray.h>
00031 #include <Mers/Models/Base/BaseModelSentence.h>
00032 #include <Mers/Utils/Containers/DynamicArrayTemplate.h>
00033 
00034 namespace Mers {
00035         namespace Generators {
00036                 namespace BFIG {
00037 
00038                         class BFIGConstraint;
00039                         class BFIGVariable;
00040 
00047                         class BFIGAssignment : public Mers::Models::Base::BaseModelAssignment
00048                         {
00049                                 friend std::ostream&  operator<<(std::ostream&, BFIGAssignment const &);
00050 
00051                         public:
00052                                 //----------------------------------------------------
00053                                 //      TYPE DEFINITIONS & OVERLOADED OPERATORS
00054                                 //----------------------------------------------------
00055                                 bool operator==(BFIGAssignment const * a) const;
00056                                 bool operator==(BFIGAssignment const & a) const;
00057                                 bool operator<(BFIGAssignment const & a)  const;
00058 
00059                                 //----------------------------------------------------
00060                                 //      CONSTRUCTOR
00061                                 //----------------------------------------------------
00062 
00063                                 // Should not really be called directly, except for Variable.
00064                                 BFIGAssignment(BFIGVariable const * sourceVariable_p,
00065                                                                                          Mers::Models::Base::BaseModelValue const * assignmentValue,
00066                                                                                          double assignmentCost);
00067                                 //BFIGAssignment(BFIGVariable const * sourceVariable_p, Mers::Models::Base::BaseModelValue * assignmentValue,
00068                                 //           std::vector<double> const & assignmentCosts,
00069                                 //           IntegerArray const & dependentValues);
00070                                 //BFIGAssignment(BFIGVariable const * sourceVariable_p, Mers::Models::Base::BaseModelValue * assignmentValue,
00071                                 //           std::vector<double> const & assignmentCosts,
00072                                 //           IntegerArray const & dependentValues,
00073                                 //           DynamicArrayTemplate<Mers::Models::Base::BaseModelSentence const> const & guards);
00074                                 ~BFIGAssignment();
00075 
00076                                 //----------------------------------------------------
00077                                 //      PUBLIC METHODS
00078                                 //----------------------------------------------------
00079                                 BFIGVariable const *            getVariable() const;
00080                                 unsigned int                    getName() const;
00081                                 Mers::Utils::Lang::String                          getNameString() const;
00082                                 unsigned int                    getNameInt() const;
00083                                 unsigned int                    getValue() const;
00084                                 Mers::Utils::Lang::String                          getValueString() const;
00085                                 unsigned int                    getValueInt() const;
00086                                 //void                          setValue(BFIGVariable::Value newValue);
00087                                 double                          getCost() const;
00088                                 void                            setCost(double assignmentCost);
00089                                 double                          getTrueCost() const;
00090                                 void                            setTrueCost(double assignmentCost);
00091                                 //void                            setTrueCostByValue(BFIGVariable::Value priorVal);
00092                                 //void                            setTrueCostByValue(unsigned int priorVal);
00093 
00094                                 Mers::Utils::Lang::String                          toString() const;
00095 
00096                                 Mers::Utils::Containers::IntegerArray                    alternateValues() const;
00097                                 std::list<BFIGAssignment const *>    alternateAssignments() const;
00098                                 std::vector<BFIGAssignment const *>  alternateAssignmentsTotal() const;
00099 
00100                                 bool                            compatible(BFIGAssignment const * a) const;
00101                                 bool                            compatible(std::vector<BFIGAssignment const *> const & a) const;
00102 
00103                                 bool                            isEnabled()  const;
00104                                 void                            setEnabled(bool enabled);
00105                                 //void                            enableByGuard(unsigned int priorVal);
00106                                 //bool                            isCurrent()  const;
00107                                 //void                            setAsCurrent()  const;
00108                                 //bool                            isNext()  const;
00109                                 //void                            setAsNext()  const;
00110                                 void                            setDebug(bool debugState);
00111 
00112                                 BFIGConstraint const *              getConstraint()  const;
00113                                 BFIGConstraint const *              getNegativeConstraint()  const;
00114 
00115                                 static bool                     terse;
00116 
00117                         private:
00118                                 //----------------------------------------------------
00119                                 //      PRIVATE DATA MEMBERS
00120                                 //----------------------------------------------------
00121 
00123                                 BFIGVariable const * sourceVariable;
00124 
00126                                 double cost;
00127 
00129                                 double trueCost;
00130 
00131                                 // for use with cost vector:
00132                                 //std::vector<double> trueCostList;
00133                                 //IntegerArray trueCostValues;
00134                                 //DynamicArrayTemplate<Mers::Models::Base::BaseModelSentence const> transitionGuardsClauses;  // temporary...
00135                                 //std::vector<BFIGConstraint *> transitionGuards;  // temporary...
00136 
00139                                 bool mEnabled;
00140 
00143                                 int debug;
00144 
00146                                 BFIGConstraint const * assertThis;
00148                                 BFIGConstraint const * assertNotThis;
00149 
00150                                 //      A list of conflicts that have an assignment that is inconsistent with this one
00151                                 //std::vector<BFIGConstraint *> entailedConflicts;
00152 
00153 
00154                                 //----------------------------------------------------
00155                                 //      PRIVATE METHODS
00156                                 //----------------------------------------------------
00157 
00159                                 BFIGAssignment(BFIGAssignment const &);
00160 
00161                         };
00162                 }
00163         }
00164 }
00165 
00166 #endif //ndef __ASSIGNMENT__
00167 

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