| 
									
										
										
										
											2022-07-05 15:33:34 +02:00
										 |  |  | <?php namespace DNW\Skills\FactorGraphs; | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  | // edit this
 | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  | abstract class FactorGraphLayer | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     private $_localFactors = array(); | 
					
						
							| 
									
										
										
										
											2022-07-05 15:33:34 +02:00
										 |  |  |     private $_outputVariablesGroups = array(); | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     private $_inputVariablesGroups = array(); | 
					
						
							|  |  |  |     private $_parentFactorGraph; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |     protected function __construct(FactorGraph $parentGraph) | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |         $this->_parentFactorGraph = $parentGraph; | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |     protected function getInputVariablesGroups() | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |         return $this->_inputVariablesGroups; | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // HACK
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |     public function getParentFactorGraph() | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |         return $this->_parentFactorGraph; | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |     /** | 
					
						
							|  |  |  |      * This reference is still needed | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return array | 
					
						
							|  |  |  |      */ | 
					
						
							| 
									
										
										
										
											2010-09-25 15:46:23 -04:00
										 |  |  |     public function &getOutputVariablesGroups() | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |         return $this->_outputVariablesGroups; | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |     public function getLocalFactors() | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |         return $this->_localFactors; | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |     public function setInputVariablesGroups($value) | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->_inputVariablesGroups = $value; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-30 08:25:31 -04:00
										 |  |  |     protected function scheduleSequence(array $itemsToSequence, $name) | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2010-09-27 22:26:28 -04:00
										 |  |  |         return new ScheduleSequence($name, $itemsToSequence); | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-24 16:31:21 +02:00
										 |  |  |     protected function addLayerFactor(Factor $factor) | 
					
						
							| 
									
										
										
										
											2010-09-18 11:11:44 -04:00
										 |  |  |     { | 
					
						
							|  |  |  |         $this->_localFactors[] = $factor; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public abstract function buildLayer(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function createPriorSchedule() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return null; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     public function createPosteriorSchedule() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         return null; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2016-05-24 14:10:39 +02:00
										 |  |  | } |