trueskill/Skills/FactorGraphs/FactorGraphLayer.php

75 lines
1.7 KiB
PHP
Raw Normal View History

<?php
namespace Moserware\Skills\FactorGraphs;
2010-09-30 12:25:31 +00:00
require_once(dirname(__FILE__) . "/Factor.php");
require_once(dirname(__FILE__) . "/FactorGraph.php");
require_once(dirname(__FILE__) . "/Schedule.php");
abstract class FactorGraphLayer
{
private $_localFactors = array();
private $_outputVariablesGroups = array();
private $_inputVariablesGroups = array();
private $_parentFactorGraph;
protected function __construct(FactorGraph &$parentGraph)
{
$this->_parentFactorGraph = &$parentGraph;
}
protected function &getInputVariablesGroups()
{
2010-09-30 12:25:31 +00:00
$inputVariablesGroups = &$this->_inputVariablesGroups;
return $inputVariablesGroups;
}
// HACK
public function &getParentFactorGraph()
{
2010-09-30 12:25:31 +00:00
$parentFactorGraph = &$this->_parentFactorGraph;
return $parentFactorGraph;
}
public function &getOutputVariablesGroups()
{
2010-09-30 12:25:31 +00:00
$outputVariablesGroups = &$this->_outputVariablesGroups;
return $outputVariablesGroups;
}
public function &getLocalFactors()
{
2010-09-30 12:25:31 +00:00
$localFactors = &$this->_localFactors;
return $localFactors;
}
public function setInputVariablesGroups(&$value)
{
$this->_inputVariablesGroups = $value;
}
2010-09-30 12:25:31 +00:00
protected function scheduleSequence(array $itemsToSequence, $name)
{
return new ScheduleSequence($name, $itemsToSequence);
}
2010-09-30 12:25:31 +00:00
protected function addLayerFactor(Factor &$factor)
{
$this->_localFactors[] = $factor;
}
public abstract function buildLayer();
public function createPriorSchedule()
{
return null;
}
public function createPosteriorSchedule()
{
return null;
}
}
?>