Start of journey to actually give real names to factor graph variables using more PHP style

This commit is contained in:
Jeff Moser
2010-09-26 21:43:17 -04:00
parent f0f0ab7761
commit 5cb1919c21
6 changed files with 53 additions and 13 deletions

View File

@ -27,7 +27,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
{
foreach ($this->getInputVariablesGroups() as $currentTeam)
{
$teamPerformance = &$this->createOutputVariable($currentTeam);
$teamPerformance = $this->createOutputVariable($currentTeam);
$newSumFactor = $this->createPlayerToTeamSumFactor($currentTeam, $teamPerformance);
$this->addLayerFactor($newSumFactor);
@ -83,9 +83,14 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
private function createOutputVariable(&$team)
{
///$teamMemberNames = String.Join(", ", team.Select(teamMember => teamMember.Key.ToString()).ToArray());
$teamMemberNames = "TODO";
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable("Team[{0}]'s performance", $teamMemberNames);
$memberNames = \array_map(function ($currentPlayer)
{
return (string)($currentPlayer->getKey());
},
$team);
$teamMemberNames = \join(", ", $memberNames);
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable("Team[" . $teamMemberNames . "]'s performance");
}
}

View File

@ -69,7 +69,7 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
{
$parentFactorGraph = $this->getParentFactorGraph();
$variableFactory = $parentFactorGraph->getVariableFactory();
return $variableFactory->createKeyedVariable($key, "{0}'s skill", $key);
return $variableFactory->createKeyedVariable($key, $key . "'s skill");
}
}

View File

@ -44,7 +44,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
private function createOutputVariable(&$key)
{
return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key, "{0}'s performance", $key);
return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key, $key . "'s performance");
}
public function createPriorSchedule()