Some reference updates and adding the needed array(...) scope to existing data for single team values

This commit is contained in:
Jeff Moser
2010-09-25 22:40:56 -04:00
parent 8e9e2d0d86
commit 04c911742d
8 changed files with 51 additions and 47 deletions

View File

@ -29,7 +29,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
public function buildLayer()
{
$inputVariablesGroups = $this->getInputVariablesGroups();
$inputVariablesGroups = &$this->getInputVariablesGroups();
$this->_TeamPerformancesToTeamPerformanceDifferencesLayer->setInputVariablesGroups($inputVariablesGroups);
$this->_TeamPerformancesToTeamPerformanceDifferencesLayer->buildLayer();
@ -58,7 +58,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
$totalTeamDifferences = count($this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors());
$totalTeams = $totalTeamDifferences + 1;
$localFactors = $this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$localFactors = &$this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$innerSchedule = new ScheduleSequence(
"inner schedule",
array(
@ -72,16 +72,15 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
)
);
return innerSchedule;
return $innerSchedule;
}
private function createTwoTeamInnerPriorLoopSchedule()
{
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors = $this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$teamDifferencesComparisonLayerLocalFactors = $this->_TeamDifferencesComparisonLayer->getLocalFactors();
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors = &$this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$teamDifferencesComparisonLayerLocalFactors = &$this->_TeamDifferencesComparisonLayer->getLocalFactors();
return $this->scheduleSequence(
array(
$itemsToSequence = array(
new ScheduleStep(
"send team perf to perf differences",
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors[0],
@ -90,7 +89,10 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
"send to greater than or within factor",
$teamDifferencesComparisonLayerLocalFactors[0],
0)
),
);
return $this->scheduleSequence(
$itemsToSequence,
"loop of just two teams inner sequence");
}
@ -102,8 +104,8 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
for ($i = 0; $i < $totalTeamDifferences - 1; $i++)
{
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors = $this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$teamDifferencesComparisonLayerLocalFactors = $this->_TeamDifferencesComparisonLayer->getLocalFactors();
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors = &$this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$teamDifferencesComparisonLayerLocalFactors = &$this->_TeamDifferencesComparisonLayer->getLocalFactors();
$currentForwardSchedulePiece =
$this->scheduleSequence(
@ -119,7 +121,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors[$i], 2)
), sprintf("current forward schedule piece %d", $i));
$forwardScheduleList[] = $currentForwardSchedulePiece;
$forwardScheduleList[] = &$currentForwardSchedulePiece;
}
$forwardSchedule = new ScheduleSequence("forward schedule", $forwardScheduleList);
@ -128,8 +130,8 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
for ($i = 0; $i < $totalTeamDifferences - 1; $i++)
{
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors = $this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$teamDifferencesComparisonLayerLocalFactors = $this->_TeamDifferencesComparisonLayer->getLocalFactors();
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors = &$this->_TeamPerformancesToTeamPerformanceDifferencesLayer->getLocalFactors();
$teamDifferencesComparisonLayerLocalFactors = &$this->_TeamDifferencesComparisonLayer->getLocalFactors();
$currentBackwardSchedulePiece = new ScheduleSequence(
"current backward schedule piece",
@ -144,7 +146,7 @@ class IteratedTeamDifferencesInnerLayer extends TrueSkillFactorGraphLayer
sprintf("teamPerformanceToPerformanceDifferenceFactors[totalTeamDifferences - 1 - %d] @ 1", $i),
$teamPerformancesToTeamPerformanceDifferencesLayerLocalFactors[$totalTeamDifferences - 1 - $i], 1)
));
$backwardScheduleList[] = $currentBackwardSchedulePiece;
$backwardScheduleList[] = &$currentBackwardSchedulePiece;
}
$backwardSchedule = new ScheduleSequence("backward schedule", $backwardScheduleList);

View File

@ -27,7 +27,7 @@ class TeamDifferencesComparisonLayer extends TrueSkillFactorGraphLayer
public function buildLayer()
{
$inputVarGroups = $this->getInputVariablesGroups();
$inputVarGroups = &$this->getInputVariablesGroups();
$inputVarGroupsCount = count($inputVarGroups);
for ($i = 0; $i < $inputVarGroupsCount; $i++)

View File

@ -28,13 +28,13 @@ class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillFactorG
$strongerTeam = $inputVariablesGroups[$i][0];
$weakerTeam = $inputVariablesGroups[$i + 1][0];
$currentDifference = $this->createOutputVariable();
$newDifferencesFactor = $this->createTeamPerformanceToDifferenceFactor($strongerTeam, $weakerTeam, $currentDifference);
$currentDifference = &$this->createOutputVariable();
$newDifferencesFactor = &$this->createTeamPerformanceToDifferenceFactor($strongerTeam, $weakerTeam, $currentDifference);
$this->addLayerFactor($newDifferencesFactor);
// REVIEW: Does it make sense to have groups of one?
$outputVariablesGroup = $this->getOutputVariablesGroups();
$outputVariablesGroup[] = $currentDifference;
$outputVariablesGroup = &$this->getOutputVariablesGroups();
$outputVariablesGroup[] = array($currentDifference);
}
}