/Users/fpy/titan-1-5-MBARI/Mers/Generators/BFIG/BFIG.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 
00014 #ifndef __BFIG__
00015 #define __BFIG__
00016 
00017 #include <cstdlib>
00018 #include <vector>
00019 
00020 #include <Mers/Utils/Lang/String.h>
00021 #include <Mers/Utils/Logging/logger.h>
00022 
00023 #include "BFIGImplicantHeap.h"
00024 
00025 namespace Mers {
00026         namespace Generators {
00027                 namespace BFIG {
00028 
00029                         class BFIGImplicant;
00030                         class BFIGConstraint;
00031                         class BFIGVariable;
00032                         class BFIGAssignment;
00033                         class BFIGObjectiveFunction;
00034 
00040                         class BFIG
00041                         {
00042                         public:
00044                                 //      CONSTRUCTOR
00046 
00059                                 BFIG(std::vector<BFIGVariable *> const & variableSet, double cutoffCost, 
00060                                                 BFIGObjectiveFunction const * of);
00061 
00070                                 BFIG(std::vector<BFIGVariable *> const & variableSet, double cutoffCost);
00071 
00078                                 BFIG(std::vector<BFIGVariable *> const & variableSet);
00079 
00083                                 virtual ~BFIG();
00084 
00085 
00087                                 //      PUBLIC FUNCTION METHODS
00089 
00091                                 //      Gets and Sets
00093 
00098                                 virtual Mers::Utils::Lang::String const getName()  const;
00099 
00110                                 virtual BFIGVariable * getVariableByName(unsigned int variableName);
00115                                 virtual BFIGVariable * getVariableByName(Mers::Utils::Lang::String variableName);
00119                                 virtual std::vector<BFIGVariable *> getVariables()  const;
00120 
00128                                 virtual void setDebug(unsigned int debugState);
00129 
00138                                 virtual void addConflict(BFIGConstraint const * newConflict);
00139 
00148                                 virtual void 
00149                                 addConflicts(std::vector<BFIGConstraint const *> const & newConflicts);
00150 
00160                                 virtual BFIGImplicant const * 
00161                                 getBestImplicant(long maximumVisitedStateCount, long maxQueueSize);
00162 
00169                                 virtual void markBestFeasible();
00170 
00174                                 virtual unsigned int getLargestQueue() const;
00175 
00179                                 virtual unsigned int getLargestQueueSinceReset() const;
00180 
00184                                 virtual unsigned int getNodesExpanded() const;
00185                                 
00190                                 virtual unsigned int getNumberCandidatesSinceReset() const;
00191 
00198                                 virtual void printStatistics(bool verbose = false) const;
00199 
00211                                 virtual void printStatistics(log4cplus::Logger logger, bool verbose = false, 
00212                                         log4cplus::LogLevel logLevel = log4cplus::DEBUG_LOG_LEVEL) const;
00213 
00221                                 virtual void printQueue(bool verbose = false)  const;
00222 
00235                                 virtual void printQueue(log4cplus::Logger logger, bool verbose = false, 
00236                                         log4cplus::LogLevel logLevel = log4cplus::DEBUG_LOG_LEVEL) const;
00237 
00242                                 virtual void restart();
00243 
00250                                 virtual void reset();
00251 
00256                                 virtual unsigned int getNumberOfConflicts();
00257 
00258                         protected:
00259 
00261                                 // Internal Functions
00263 
00266                                 virtual BFIGImplicant * 
00267                                 createNewImplicant(std::vector<BFIGConstraint const *> &con);
00268 
00269                                 virtual void
00270                                 searchForImplicant(long maxExpansionCount, long maxQueueSize) = 0;
00271 
00272                                 virtual void
00273                                 enqueueImplicants(std::vector<BFIGImplicant *> const & newImplicants);
00274 
00275                                 virtual void enqueueImplicant(BFIGImplicant * newUnexploredImplicant);
00276 
00284                                 virtual void insertSiblings(BFIGImplicant * sibling);
00285 
00292                                 virtual void insertChildren(BFIGImplicant * parent);
00293 
00300                                 virtual void insertExtensions(BFIGImplicant * node);
00301 
00303                                 //      PRIVATE DATA MEMBERS
00305         
00307                                 Mers::Utils::Lang::String mName;
00308 
00310                                 std::vector<BFIGVariable *> mVariables;
00311 
00317                                 BFIGObjectiveFunction const * mObjectiveFunction;
00318 
00321                                 std::vector<BFIGConstraint const *> mConflicts;
00322 
00325                                 BFIGImplicantHeap mImplicantQueue;
00326 
00328                                 BFIGImplicant * mCandidate;
00329 
00332                                 unsigned int mNodesExpanded;
00333 
00336                                 unsigned int mLargestQueue;
00337 
00341                                 unsigned int mLargestQueueSinceReset;
00342 
00345                                 unsigned int mDebug;
00346 
00348                                 unsigned int mNumSolutions;
00349 
00353                                 unsigned int mNumCandidatesSinceReset;
00354 
00356                                 static log4cplus::Logger mLogger;
00357                         };
00358                 }
00359         }
00360 }
00361 
00362 #endif //ndef __BFIG__
00363 

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