mirror of
https://github.com/furyfire/trueskill.git
synced 2025-04-19 20:34:28 +00:00
String based "name" for Variable class removed for performance
This commit is contained in:
@ -21,7 +21,7 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
|
||||
*/
|
||||
foreach ($inputVariablesGroups as $currentTeam) {
|
||||
$localCurrentTeam = $currentTeam;
|
||||
$teamPerformance = $this->createOutputVariable($localCurrentTeam);
|
||||
$teamPerformance = $this->createOutputVariable();
|
||||
$newSumFactor = $this->createPlayerToTeamSumFactor($localCurrentTeam, $teamPerformance);
|
||||
|
||||
$this->addLayerFactor($newSumFactor);
|
||||
@ -85,14 +85,10 @@ class PlayerPerformancesToTeamPerformancesLayer extends TrueSkillFactorGraphLaye
|
||||
}
|
||||
|
||||
/**
|
||||
* @param KeyedVariable[] $team
|
||||
* Team's performance
|
||||
*/
|
||||
private function createOutputVariable(array $team): Variable
|
||||
private function createOutputVariable(): Variable
|
||||
{
|
||||
$memberNames = array_map(static fn($currentPlayer): string => (string)($currentPlayer->getKey()->getId()), $team);
|
||||
|
||||
$teamMemberNames = \implode(', ', $memberNames);
|
||||
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable('Team[' . $teamMemberNames . "]'s performance");
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable();
|
||||
}
|
||||
}
|
||||
|
@ -77,6 +77,6 @@ class PlayerPriorValuesToSkillsLayer extends TrueSkillFactorGraphLayer
|
||||
$parentFactorGraph = $this->getParentFactorGraph();
|
||||
$variableFactory = $parentFactorGraph->getVariableFactory();
|
||||
|
||||
return $variableFactory->createKeyedVariable($key, $key->getId() . "'s skill");
|
||||
return $variableFactory->createKeyedVariable($key);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class PlayerSkillsToPerformancesLayer extends TrueSkillFactorGraphLayer
|
||||
|
||||
private function createOutputVariable(mixed $key): KeyedVariable
|
||||
{
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key, $key->getId() . "'s performance");
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createKeyedVariable($key);
|
||||
}
|
||||
|
||||
public function createPriorSchedule(): ?ScheduleSequence
|
||||
|
@ -40,8 +40,11 @@ class TeamPerformancesToTeamPerformanceDifferencesLayer extends TrueSkillFactorG
|
||||
return new GaussianWeightedSumFactor($output, $teams, $weights);
|
||||
}
|
||||
|
||||
/**
|
||||
* Team performance difference
|
||||
*/
|
||||
private function createOutputVariable(): Variable
|
||||
{
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable('Team performance difference');
|
||||
return $this->getParentFactorGraph()->getVariableFactory()->createBasicVariable();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user