Closed LiamM32 closed 1 year ago
Don't have the same warning (but others than yours) . I have the impression to not be on the same commit level.
This error is about the new property, available on 4.5 dev only. Are you on the 4.5 branch?
It looks like having the wrong Condorcet branch is indeed the problem. I checked some files in vendor/julien-boudry/condorcet, and they are the versions from the master branch.
In the composer.json file, it specifies "julien-boudry/condorcet": "dev-dev-4.5"
, which I thought would make it download the specified branch. I don't know if that line is written correctly. I just assumed this is the correct way to write it because that's the option that Netbeans IDE gave me.
Edit: Strangely, this was solved by changing the name in composer.json to the proper format. Composer then downloads the correct branch of Condorcet. It's strange that it works mostly correctly when the name format is wrong, only it downloads the wrong branch of Condorcet.
I made a new commit that solves the warnings. The process still ultimately ended in an error. I solved this in a second commit. The problem was that $election->getResult()
function would end in an error if there were 0 votes, which was the case for some of the tags it was looking for.
The program now appears to work properly. The results that it gives look believable, though I haven't tested their accuracy. It's slower than I expected. It may have taken 2 minutes for it to determine the result. But I'm not sure if this is just what I should expect for 4358 votes.
Update: Not everything is going correctly. I noticed that when it counts the number of voters from each country in the $contest->countVotersByCountry()
function, it only counts the first vote from each country listed in the .cvotes file.
It must work in much less than 0.5 seconds. It must be another problem, a problematic loop in your method (maybe Schulze himself hasn't predict your way, it can be a complicated math problem), or something. If it continues, open a new issue targeting this. @LiamM32
About the composer, maybe you forget a composer update after an update.
Based on the terminal outputs it gives, it appears to spend most of it's time in EurovisionSchulze::schulzeVariant()
. If I place an echo()
line in that function, I can see it takes one second per cycle.
These two PHP warnings are output during every cycle through EurovisionSchulze::schulzeVariant(), the latter 6 times each:
The line that appears to be the problem is this one:
$filteredPairwise = $contest->getResult(methodOptions: ['%tagFilter' => true, 'withTag' => true, 'tags' => $country])->pairwise;
Sorry to bother you again, @julien-boudry , but I don't understand how this function works. I don't know where to start guessing what may be going wrong.
It doesn't seem to be a problem of there being 0 votes registered in each country, as line 38 in Contest.php outputs the number of voters from each country using
$this->countVotes($country)
, and I do get the expected output there.