2022-07-05 15:55:47 +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
|
|
|
|
{
|
2022-07-05 16:21:06 +02:00
|
|
|
private array $_localFactors = [];
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2022-07-05 16:21:06 +02:00
|
|
|
private array $_outputVariablesGroups = [];
|
2022-07-05 15:55:47 +02:00
|
|
|
|
|
|
|
private $_inputVariablesGroups = [];
|
|
|
|
|
2022-07-05 16:21:06 +02:00
|
|
|
protected function __construct(private readonly FactorGraph $_parentFactorGraph)
|
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;
|
|
|
|
}
|
|
|
|
|
2022-07-05 15:55:47 +02:00
|
|
|
abstract public function buildLayer();
|
2010-09-18 11:11:44 -04:00
|
|
|
|
|
|
|
public function createPriorSchedule()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function createPosteriorSchedule()
|
|
|
|
{
|
|
|
|
return null;
|
|
|
|
}
|
2022-07-05 15:55:47 +02:00
|
|
|
}
|