julien-boudry / Condorcet

Command line application and PHP library, providing an election engine with a high-level interface. Native support 20+ voting methods, easy to extend. Support simple elections with ease or billions of votes in low resource environment. Intensively tested and highly polyvalent.
https://www.condorcet.io
MIT License
119 stars 11 forks source link

Gets stuck at "Results per Methods" when running the program using InstantRunoff #32

Closed lordlouckster closed 3 years ago

lordlouckster commented 3 years ago
Q A
Type Bug
Condorcet version 3.0.0
PHP version 8.0.0
Installation Method Composer
condorcet election -c c.txt -w w.txt InstantRunoff

Sum Up
------

21 Candidates(s) Registered  ||  32 Vote(s) Registered
==========================
 ------------------------------------------------------------- -------
  Is vote weight allowed?                                       FALSE
 ------------------------------------------------------------- -------
  Votes are evaluated according to the implicit ranking rule?   TRUE
 ------------------------------------------------------------- -------
  Is vote tie in rank allowed?                                  FALSE
 ------------------------------------------------------------- -------

Results per Methods
-------------------

Then it gets stuck. CPU use raises to 30%, and memory use raises as well.

lordlouckster commented 3 years ago

After many minutes:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) in Condorcet\vendor\julien-boudry\condorcet\lib\Algo\Tools\PairwiseStats.php on line 27
julien-boudry commented 3 years ago

Hi anonymous,

How many votes did you try to ingest? Have you the same limitation with other methods or only with Instant Runfoff?

Did you get PDO Sqlite driver ON with our PHP installation? Can be set on php.ini file. Condorcet can not handle infinite sizes without this. You can also try to pass this option: (only if Sqlite is set, and not working and it still doesn't work ) --votes-per-mb=50

julien-boudry commented 3 years ago

The other solution is to increase memory limit on your php.ini file.

julien-boudry commented 3 years ago

By reading better this morning. It seems that this bug is more related to a large number of candidates than votes. Interesting, I will try to reproduce it.

julien-boudry commented 3 years ago

No sorry @anonymous7002 I can't reproduce this bug, everything is fast and accurate on my side.

Maybe if you can share your dataset, I can try to reproduce it.

lordlouckster commented 3 years ago

Oh, it was because my dataset had a candidate multiple times in a few votes by accident, like "Spain>Japan>France>Netherlands>Australia>France"!

julien-boudry commented 3 years ago

Ok! It's another type of bug, you must have an error message, not an infinite loop. Will look for it too, with a minor priority :)

julien-boudry commented 3 years ago

Just release 3.0.1. Fix an important issue related to yours. Can you confirm that? Because I can't reproduce the same error as you without your dataset.