mirror of
https://github.com/furyfire/trueskill.git
synced 2025-03-29 12:23:22 +00:00
It gets a result... unfortunately it's wrong. But hey, that's progress :) Lots of debugging code left in to make up for a less than ideal debugger
This commit is contained in:
PHPSkills
FactorGraphs
HashMap.phpRatingContainer.phpTeam.phpTeams.phpTrueSkill
FactorGraphTrueSkillCalculator.php
Factors
Layers
IteratedTeamDifferencesInnerLayer.phpPlayerPerformancesToTeamPerformancesLayer.phpPlayerPriorValuesToSkillsLayer.phpPlayerSkillsToPerformancesLayer.phpTeamPerformancesToTeamPerformanceDifferencesLayer.php
TrueSkillFactorGraph.phpTwoTeamTrueSkillCalculator.phpUnitTests/TrueSkill
@ -35,12 +35,14 @@ abstract class Factor
|
||||
return count($this->_messages);
|
||||
}
|
||||
|
||||
protected function &getVariables()
|
||||
// DEBUG: make protected
|
||||
public function &getVariables()
|
||||
{
|
||||
return $this->_variables;
|
||||
}
|
||||
|
||||
protected function &getMessages()
|
||||
// DEBUG: make protected
|
||||
public function &getMessages()
|
||||
{
|
||||
return $this->_messages;
|
||||
}
|
||||
@ -51,6 +53,11 @@ abstract class Factor
|
||||
Guard::argumentIsValidIndex($messageIndex, count($this->_messages), "messageIndex");
|
||||
$message = &$this->_messages[$messageIndex];
|
||||
$variable = &$this->_messageToVariableBinding->getValue($message);
|
||||
// DEBUG
|
||||
$selfName = (string)$this;
|
||||
$debugName = (string)$variable;
|
||||
$debugHash = \spl_object_hash($variable);
|
||||
$debugValue = $variable->getValue();
|
||||
return $this->updateMessageVariable($message, $variable);
|
||||
}
|
||||
|
||||
@ -86,9 +93,11 @@ abstract class Factor
|
||||
protected function &createVariableToMessageBindingWithMessage(Variable &$variable, Message &$message)
|
||||
{
|
||||
$index = count($this->_messages);
|
||||
$this->_messages[] = &$message;
|
||||
$localMessages = &$this->_messages;
|
||||
$localMessages[] = &$message;
|
||||
$this->_messageToVariableBinding->setValue($message, $variable);
|
||||
$this->_variables[] = &$variable;
|
||||
$localVariables = &$this->_variables;
|
||||
$localVariables[] = &$variable;
|
||||
return $message;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,8 @@ class Message
|
||||
|
||||
public function setValue(&$value)
|
||||
{
|
||||
// DEBUG
|
||||
$selfName = (string)$this;
|
||||
$this->_value = &$value;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,10 @@ class ScheduleStep extends Schedule
|
||||
|
||||
public function visit($depth = -1, $maxDepth = 0)
|
||||
{
|
||||
$delta = $this->_factor->updateMessageIndex($this->_index);
|
||||
$currentFactor = &$this->_factor;
|
||||
// DEBUG
|
||||
$currentFactorName = (string)$currentFactor;
|
||||
$delta = $currentFactor->updateMessageIndex($this->_index);
|
||||
return $delta;
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,18 @@ class Variable
|
||||
public function &getValue()
|
||||
{
|
||||
$value = &$this->_value;
|
||||
// DEBUG
|
||||
$selfHash = \spl_object_hash($this);
|
||||
$selfName = (string)$this;
|
||||
return $value;
|
||||
}
|
||||
|
||||
public function setValue(&$value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
// DEBUG
|
||||
$selfName = (string)$this;
|
||||
$selfHash = \spl_object_hash($this);
|
||||
$this->_value = &$value;
|
||||
}
|
||||
|
||||
public function resetToPrior()
|
||||
@ -57,15 +63,16 @@ class DefaultVariable extends Variable
|
||||
class KeyedVariable extends Variable
|
||||
{
|
||||
private $_key;
|
||||
public function __construct($key, $name, &$prior)
|
||||
public function __construct(&$key, $name, &$prior)
|
||||
{
|
||||
parent::__construct($name, $prior);
|
||||
$this->_key = $key;
|
||||
$this->_key = &$key;
|
||||
}
|
||||
|
||||
public function getKey()
|
||||
public function &getKey()
|
||||
{
|
||||
return $this->_key;
|
||||
$key = &$this->_key;
|
||||
return $key;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user