Giter Club home page Giter Club logo

phpskills's People

Contributors

moserware avatar zn4rk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpskills's Issues

Unit Test Fails on more than 2 Team

sh-4.2$ php phpunit.phar src/Moserware/UnitTests/TrueSkill/FactorGraphTeamTrueSkillCalculatorTest.php
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/ming.ini on line 1 in Unknown on line 0
PHPUnit 4.7.6 by Sebastian Bergmann and contributors.

PHP Fatal error: Class 'Moserware\Skills\TrueSkill\Layers\InvalidOperationException' not found in /var/www/test/PHPSkills/src/Moserware/Skills/TrueSkill/Layers/IteratedTeamDifferencesInnerLayer.php on line 55

Would love to use this, unfortunately Unit Tests fails with exception

Performance drops off a cliff after ~50 teams?

I'm trying to implement this for a sporting event, which could have anything up to 1000 competitors.

I find with 20/30/40/50 competitors it works perfectly, and speedily - typically less than 0.2 second.

But as soon as I go to 60 competitors, it takes over 30 seconds and times out.

Do you have any idea why this would be? Any pointers appreciated, many thanks!

Runtime Notice for variable by &$reference

Thanks again for these beautiful maths!

I got into trouble with a strict PHP configuration, saying "Runtime Notice: Only variables should be assigned by reference in /home/con/www/lab/Moserware/Skills/HashMap.php line 36 "

When I disable the strict mode (or at least disable notices in php's error_reporting()) it works and I get a calculation. Unfortunately, I need the strict mode and all notices for the development to easier find bugs and the framework I'm using (Symfony2) even throws full Exceptions on notices (thanks to xdebug) so I can't even ignore a notice, even though I'd like to.

So I was trying to get rid of all ampersands as I don't fully understand the php 5.3 runtime notice for references - thought anything is a reference by now.. - seems it is not.. so unfortunately I broke the whole environment and some unit tests are totally going nuts..

Maybe you find some time to take a look over this, this is the commit where I radiacally (blindly, but not search & replace ;) removed the ampersands
bartrail@c61ca4e

and this is one of the tests that failed and I was trying to manually find out which else is failing in this TwoTeam Test case (came out this was it) - so I revered the unit test values in my fork back to the original ones, but maybe this can help you to locate which ampersand &reference is really needed...
bartrail@389665e

Cheers,
Conrad

Fatal error when running the PHPSkills UnitTests with phpunit

Hi there,

Thanks for providing a PHP-based port of the TrueSkill algorithm! I've tried running the UnitTests for this project but unfortunately, I get the following error:

PHP Fatal error: Class 'Moserware\Skills\TrueSkill\Layers\InvalidOperationExcep
tion' not found in C:\wamp\www\test_project\trunk\TrueSkill\Skills\TrueSkill\L
ayers\IteratedTeamDifferencesInnerLayer.php on line 55
PHP Stack trace:
PHP 1. {main}() C:\wamp\bin\php\php5.4.12\phpunit:0
PHP 2. PHPUnit_TextUI_Command::main() C:\wamp\bin\php\php5.4.12\phpunit:49
PHP 3. PHPUnit_TextUI_Command->run() C:\wamp\bin\php\php5.4.12\pear\PHPUnit\Te
xtUI\Command.php:129
PHP 4. PHPUnit_Runner_BaseTestRunner->getTest() C:\wamp\bin\php\php5.4.12\pear
\PHPUnit\TextUI\Command.php:150
PHP 5. PHPUnit_Framework_TestSuite->addTestFiles() C:\wamp\bin\php\php5.4.12\p
ear\PHPUnit\Runner\BaseTestRunner.php:96
PHP 6. PHPUnit_Framework_TestSuite->addTestFile() C:\wamp\bin\php\php5.4.12\pe
ar\PHPUnit\Framework\TestSuite.php:430
PHP 7. PHPUnit_Util_Fileloader::checkAndLoad() C:\wamp\bin\php\php5.4.12\pear
PHPUnit\Framework\TestSuite.php:369
PHP 8. PHPUnit_Util_Fileloader::load() C:\wamp\bin\php\php5.4.12\pear\PHPUnit
Util\Fileloader.php:86
PHP 9. include_once() C:\wamp\bin\php\php5.4.12\pear\PHPUnit\Util\Fileloader.p
hp:102
PHP 10. PHPUnit_TextUI_TestRunner::run() C:\wamp\www\test_project\trunk\TrueS
kill\UnitTests\TrueSkill\FactorGraphTeamTrueSkillCalculatorTest.php:26
PHP 11. PHPUnit_TextUI_TestRunner->doRun() C:\wamp\bin\php\php5.4.12\pear\PHPUn
it\TextUI\TestRunner.php:106
PHP 12. PHPUnit_Framework_TestSuite->run() C:\wamp\bin\php\php5.4.12\pear\PHPUn
it\TextUI\TestRunner.php:305
PHP 13. PHPUnit_Framework_TestSuite->runTest() C:\wamp\bin\php\php5.4.12\pear\P
HPUnit\Framework\TestSuite.php:733
PHP 14. PHPUnit_Framework_TestCase->run() C:\wamp\bin\php\php5.4.12\pear\PHPUni
t\Framework\TestSuite.php:757
PHP 15. PHPUnit_Framework_TestResult->run() C:\wamp\bin\php\php5.4.12\pear\PHPU
nit\Framework\TestCase.php:576
PHP 16. PHPUnit_Framework_TestCase->runBare() C:\wamp\bin\php\php5.4.12\pear\PH
PUnit\Framework\TestResult.php:666
PHP 17. PHPUnit_Framework_TestCase->runTest() C:\wamp\bin\php\php5.4.12\pear\PH
PUnit\Framework\TestCase.php:628
PHP 18. ReflectionMethod->invokeArgs() C:\wamp\bin\php\php5.4.12\pear\PHPUnit\F
ramework\TestCase.php:738
PHP 19. FactorGraphTrueSkillCalculatorTest->testFactorGraphTrueSkillCalculator(
) C:\wamp\bin\php\php5.4.12\pear\PHPUnit\Framework\TestCase.php:738
PHP 20. TrueSkillCalculatorTests::testAllTwoPlayerScenarios() C:\wamp\www\test_project\trunk\TrueSkill\UnitTests\TrueSkill\FactorGraphTeamTrueSkillCalculator
Test.php:16
PHP 21. TrueSkillCalculatorTests::twoPlayerTestNotDrawn() C:\wamp\www\test_project\trunk\TrueSkill\UnitTests\TrueSkill\TrueSkillCalculatorTests.php:25
PHP 22. Moserware\Skills\TrueSkill\FactorGraphTrueSkillCalculator->calculateNew
Ratings() C:\wamp\www\test_project\trunk\TrueSkill\UnitTests\TrueSkill\TrueSki
llCalculatorTests.php:91
PHP 23. Moserware\Skills\TrueSkill\TrueSkillFactorGraph->runSchedule() C:\wamp
www\test_project\trunk\TrueSkill\Skills\TrueSkill\FactorGraphTrueSkillCalculat
or.php:54
PHP 24. Moserware\Skills\TrueSkill\TrueSkillFactorGraph->createFullSchedule() C
:\wamp\www\test_project\trunk\TrueSkill\Skills\TrueSkill\TrueSkillFactorGraph.
php:87
PHP 25. Moserware\Skills\TrueSkill\Layers\IteratedTeamDifferencesInnerLayer->cr
eatePriorSchedule() C:\wamp\www\test_project\trunk\TrueSkill\Skills\TrueSkill
TrueSkillFactorGraph.php:117

Do you know if there is something I am missing? Have you seen this problem before?

Note that I'm using PHP version 5.4.12, PEAR version 1.9.4, and PHPUnit version 3.5.15. I've also tried a newer version of PHPUnit (version 3.7.xx) with no success.

Any help would be much appreciated,
-sponge8

Unnecessary use of references

Wow, this is awesome! I was really happy to find an implementation of the TrueSkill algorithm in PHP. I realize that this was your first project with PHP, and I find the code to be of very good quality/structure in general, however it seems you have misunderstood how references together with objects work in PHP (which is easy to do because the manual doesnt say much about it).

It is true that PHP by default passes function arguments by value, however passing objects work pretty much like in Java - meaning it will by default pass a reference (to the object) by value.

Be aware that arrays counts as primitives so they are by default not passed as a reference.

Passing objects by reference (like you're doing mostly) will give you the ability to change the object that the passed variable points to.

I would really like to help, but I'm not sure I've got the time at the moment.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.