Code Monkey home page Code Monkey logo

Comments (5)

julien-boudry avatar julien-boudry commented on July 17, 2024

@LiamM32

from condorcet.

LiamM32 avatar LiamM32 commented on July 17, 2024

Sure. This is to allow only a specified portion of all votes to be processed for pairwise results, right?

Earlier I was thinking that some of the Election functions related to processing information from votes can be moved into a trait in a new file, and be included in both the Election class and a new class.

But you would know better than me how it's best to achieve the desired functionality. It would be nice to have a good way to determine pairwise results for a specified set of voters identified by a tag. Even for the conventional Schulze method or Ranked Pairs, it might be desired to get some statistics for certain demographics of voters, even if this isn't used to determine the end result.

from condorcet.

LiamM32 avatar LiamM32 commented on July 17, 2024

The Schulze STV method that I am working on has a function to determine how many votes prefer a candidate to all other candidates in a set. Perhaps this belongs in pairwise. Though I didn't put it there because I don't really understand how the pairwise object works.

from condorcet.

julien-boudry avatar julien-boudry commented on July 17, 2024

No, it's about iterating over votes.

        foreach ($this->getElection()->getVotesValidUnderConstraintGenerator() as $oneVote) {
            $weight = $oneVote->getWeight($election);
            $oneRanking = $oneVote->getContextualRankingWithoutSort($election);

           if (  count($oneRanking) >= 1 &&
                 count($oneRanking[1]) === 1 &&
                $yourExpectedWinnerKey === $this->getElection()->getCandidateKey($oneRanking[1])
           ) {
              // $yourExpectedWinner is the first
           }
        }

from condorcet.

LiamM32 avatar LiamM32 commented on July 17, 2024

To be honest, I don't really understand why Pairwise needs to be it's own object class. It's massively complicated for what it does. Why not just have a function in the vote object itself to determine which of two candidates is preferred, & methods can iterate over all votes in a foreach loop? If you just want cache for pairwise results, isn't there a simpler implementation that isn't any slower than the current one?

from condorcet.

Related Issues (20)

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.