2022-07-05 15:55:47 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace DNW\Skills\FactorGraphs;
|
|
|
|
|
2010-09-18 11:11:44 -04:00
|
|
|
abstract class FactorGraphLayer
|
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
private array $localFactors = [];
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2023-08-01 14:02:12 +00:00
|
|
|
private array $outputVariablesGroups = [];
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2023-08-01 14:02:12 +00:00
|
|
|
private $inputVariablesGroups = [];
|
2022-07-05 15:55:47 +02:00
|
|
|
|
2023-08-01 14:02:12 +00: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
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->inputVariablesGroups;
|
2010-09-18 11:11:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// HACK
|
|
|
|
|
2023-08-02 10:10:57 +00:00
|
|
|
public function getParentFactorGraph(): FactorGraph
|
2010-09-18 11:11:44 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00: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
|
|
|
|
*/
|
2023-08-01 12:26:38 +00:00
|
|
|
public function &getOutputVariablesGroups(): array
|
2010-09-18 11:11:44 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->outputVariablesGroups;
|
2010-09-18 11:11:44 -04:00
|
|
|
}
|
|
|
|
|
2023-08-01 12:26:38 +00:00
|
|
|
public function getLocalFactors(): array
|
2010-09-18 11:11:44 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
return $this->localFactors;
|
2010-09-18 11:11:44 -04:00
|
|
|
}
|
|
|
|
|
2023-08-01 12:26:38 +00:00
|
|
|
public function setInputVariablesGroups(array $value): void
|
2010-09-18 11:11:44 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
$this->inputVariablesGroups = $value;
|
2010-09-18 11:11:44 -04:00
|
|
|
}
|
|
|
|
|
2023-08-01 12:26:38 +00:00
|
|
|
protected function scheduleSequence(array $itemsToSequence, string $name): ScheduleSequence
|
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
|
|
|
}
|
|
|
|
|
2023-08-01 12:26:38 +00:00
|
|
|
protected function addLayerFactor(Factor $factor): void
|
2010-09-18 11:11:44 -04:00
|
|
|
{
|
2023-08-01 14:02:12 +00:00
|
|
|
$this->localFactors[] = $factor;
|
2010-09-18 11:11:44 -04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|