RangeVotingAverage¶
-
class
svvamp.RangeVotingAverage(population, **kwargs)[source]¶ Range Voting with Average.
Inherits functions and optional parameters from superclasses
ElectionResultandElection.Parameters: - min_grade – See attribute
min_grade. - max_grade – See attribute
max_grade. - step_grade – See attribute
step_grade. - rescale_grades – See attribute
rescale_grades.
Example: >>> import svvamp >>> pop = svvamp.PopulationSpheroid(V=100, C=5) >>> election = svvamp.RangeVotingAverage(pop, min_grade=0, max_grade=1, step_grade=0, rescale_grades=True)
Each voter attributes a grade to each candidate. By default, authorized grades are all numbers in the interval [
min_grade,max_grade]. To use a discrete set of notes, modify attributestep_grade.The candidate with highest average grade wins. In case of a tie, the tied candidate with lowest index is declared the winner.
Default behavior of sincere voters: voter
vapplies an affine transformation to her utilitiespreferences_ut[v, :]to get her grades, such that her least-liked candidate receivesmin_gradeand her most-liked candidate receivesmax_grade. To modify this behavior, use attributerescale_grades. For more details about the behavior of sincere voters, seeballots.- If
rescale_grades=False, then Range voting always meets IIA. - If
rescale_grades=True, then then non-polynomial or non-exact algorithms from superclassElectionare used.
CM(),ICM(),IM(),TM(),UM(): Exact in polynomial time.-
ballots¶ 2d array of integers.
ballots[v, c]is the grade attributed by votervto candidatec(when voting sincerely). The following process is used.Convert utilities into grades in interval [
min_grade,max_grade].If
rescale_grades=True, then each votervapplies an affine transformation topreferences_ut[v, :]such that her least-liked candidate receivesmin_gradeand her most-liked candidate receivesmax_grade.Exception: if she is indifferent between all candidates, then she attributes (
min_grade+max_grade) / 2 to all of them.If
rescale_grades=False, then each votervclips her utilities into the interval [min_grade,max_grade]: each utility greater thanmax_grade(resp. lower thanmin_grade) becomesmax_grade(resp.min_grade).
If
step_grades> 0 (discrete set of grades), round each grade to the closest authorized grade.
-
max_grade¶ Number. Maximal grade allowed.
-
min_grade¶ Number. Minimal grade allowed.
-
rescale_grades¶ Boolean. Whether sincere voters rescale their utilities to produce grades.
If
rescale_grades=True, then each sincere votervapplies an affine transformation to send her utilities into the interval [min_grade,max_grade].If
rescale_grades=False, then each sincere votervclips her utilities into the interval [min_grade,max_grade].See
ballotsfor more details.
-
scores¶ 1d array of integers.
scores[c]is the average grade of candidatec.
-
step_grade¶ Number. Interval between two consecutive allowed grades.
If
step_grade = 0, all grades in the interval [min_grade,max_grade] are allowed (‘continuous’ set of grades).If
step_grade > 0, authorized grades are the multiples ofstep_gradelying in the interval [min_grade,max_grade]. In addition, the gradesmin_gradeandmax_gradeare always authorized, even if they are not multiples ofstep_grade.
-
w¶ Integer (winning candidate).
- Default behavior in superclass
ElectionResult: - The candidate with highest value in vector
scoresis declared the winner. In case of a tie, the tied candidate with lowest index wins.
- Default behavior in superclass
- min_grade – See attribute