Files
trueskill/src/FactorGraphs/FactorGraphLayer.php

91 lines
1.9 KiB
PHP
Raw Normal View History

2022-07-05 15:55:47 +02:00
<?php
namespace DNW\Skills\FactorGraphs;
2023-08-03 13:08:04 +00:00
use DNW\Skills\FactorGraphs\ScheduleSequence;
2022-07-05 15:55:47 +02:00
abstract class FactorGraphLayer
{
2023-08-02 12:39:42 +00:00
/**
* @var Factor[] $localFactors
*/
private array $localFactors = [];
2022-07-05 15:55:47 +02:00
2023-08-03 13:08:04 +00:00
/**
* @var array<int,array<int,object>>
*/
private array $outputVariablesGroups = [];
2023-08-03 13:08:04 +00:00
/**
* @var array<int,array<int,object>>
*/
private $inputVariablesGroups = [];
2022-07-05 15:55:47 +02:00
protected function __construct(private readonly FactorGraph $parentFactorGraph)
{
}
2023-08-03 13:08:04 +00:00
/**
* @return array<int,array<int,object>>
*/
protected function getInputVariablesGroups(): array
{
return $this->inputVariablesGroups;
}
// HACK
2023-08-02 10:10:57 +00:00
public function getParentFactorGraph(): FactorGraph
{
return $this->parentFactorGraph;
}
/**
* This reference is still needed
2023-08-03 13:08:04 +00:00
* @return array<int,array<int,object>>
*/
2023-08-01 12:26:38 +00:00
public function &getOutputVariablesGroups(): array
{
return $this->outputVariablesGroups;
}
2023-08-02 12:39:42 +00:00
/**
* @return Factor[]
*/
2023-08-01 12:26:38 +00:00
public function getLocalFactors(): array
{
return $this->localFactors;
}
2023-08-03 13:08:04 +00:00
/**
* @param array<int,array<int,object>> $value
*/
2023-08-01 12:26:38 +00:00
public function setInputVariablesGroups(array $value): void
{
$this->inputVariablesGroups = $value;
}
2023-08-03 13:08:04 +00:00
/**
* @param Schedule[] $itemsToSequence
*/
2023-08-01 12:26:38 +00:00
protected function scheduleSequence(array $itemsToSequence, string $name): ScheduleSequence
{
return new ScheduleSequence($name, $itemsToSequence);
}
2023-08-01 12:26:38 +00:00
protected function addLayerFactor(Factor $factor): void
{
$this->localFactors[] = $factor;
}
2023-08-02 14:14:10 +00:00
abstract public function buildLayer(): void;
2023-08-02 14:14:10 +00:00
public function createPriorSchedule(): ?ScheduleSequence
{
return null;
}
2023-08-02 14:14:10 +00:00
public function createPosteriorSchedule(): ?ScheduleSequence
{
return null;
}
2022-07-05 15:55:47 +02:00
}