| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * SymbolicFactorGraph.h | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *  Created on: Oct 29, 2009 | 
					
						
							|  |  |  |  *      Author: Frank Dellaert | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifndef SYMBOLICFACTORGRAPH_H_
 | 
					
						
							|  |  |  | #define SYMBOLICFACTORGRAPH_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <string>
 | 
					
						
							|  |  |  | #include <list>
 | 
					
						
							|  |  |  | #include "FactorGraph.h"
 | 
					
						
							| 
									
										
										
										
											2009-10-30 11:48:32 +08:00
										 |  |  | #include "SymbolicFactor.h"
 | 
					
						
							| 
									
										
										
										
											2009-11-09 15:04:26 +08:00
										 |  |  | #include "SymbolicBayesNet.h"
 | 
					
						
							| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace gtsam { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-08 05:03:30 +08:00
										 |  |  | 	class SymbolicConditional; | 
					
						
							| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-30 11:48:32 +08:00
										 |  |  | 	/** Symbolic Factor Graph */ | 
					
						
							|  |  |  | 	class SymbolicFactorGraph: public FactorGraph<SymbolicFactor> { | 
					
						
							| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | 	public: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		/**
 | 
					
						
							| 
									
										
										
										
											2009-10-30 11:48:32 +08:00
										 |  |  | 		 * Construct empty factor graph | 
					
						
							| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2009-10-30 11:48:32 +08:00
										 |  |  | 		SymbolicFactorGraph() { | 
					
						
							| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | 		} | 
					
						
							| 
									
										
										
										
											2009-10-29 22:34:34 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		/**
 | 
					
						
							| 
									
										
										
										
											2009-10-30 11:48:32 +08:00
										 |  |  | 		 * Construct from a factor graph of any type | 
					
						
							| 
									
										
										
										
											2009-10-29 22:34:34 +08:00
										 |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | 		template<class Factor> | 
					
						
							|  |  |  | 		SymbolicFactorGraph(const FactorGraph<Factor>& fg) { | 
					
						
							|  |  |  | 			for (size_t i = 0; i < fg.size(); i++) { | 
					
						
							|  |  |  | 				boost::shared_ptr<Factor> f = fg[i]; | 
					
						
							|  |  |  | 				std::list<std::string> keys = f->keys(); | 
					
						
							|  |  |  | 				SymbolicFactor::shared_ptr factor(new SymbolicFactor(keys)); | 
					
						
							|  |  |  | 				push_back(factor); | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-08 05:03:30 +08:00
										 |  |  |   	/**
 | 
					
						
							|  |  |  |      * Eliminate a single node yielding a conditional Gaussian | 
					
						
							|  |  |  |      * Eliminates the factors from the factor graph through findAndRemoveFactors | 
					
						
							|  |  |  |      * and adds a new factor on the separator to the factor graph | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2009-11-12 12:56:30 +08:00
										 |  |  |     boost::shared_ptr<SymbolicConditional> eliminateOne(const std::string& key); | 
					
						
							| 
									
										
										
										
											2009-11-08 05:03:30 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-30 11:48:32 +08:00
										 |  |  | 		/**
 | 
					
						
							|  |  |  | 		 * eliminate factor graph in place(!) in the given order, yielding | 
					
						
							|  |  |  | 		 * a chordal Bayes net | 
					
						
							|  |  |  | 		 */ | 
					
						
							| 
									
										
										
										
											2009-11-09 15:04:26 +08:00
										 |  |  | 		SymbolicBayesNet eliminate(const Ordering& ordering); | 
					
						
							| 
									
										
										
										
											2009-10-30 11:48:32 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-29 13:39:13 +08:00
										 |  |  | 	}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif /* SYMBOLICFACTORGRAPH_H_ */
 |