hjugement-1.0.0.20170804: Majority Judgment.

Safe HaskellNone
LanguageHaskell2010

Hjugement.Majority

Contents

Synopsis

Type Choices

type Choices prop = Set prop Source #

choices :: (Bounded prop, Enum prop, Ord prop) => Choices prop Source #

Return a set of Choices by enumerating the alternatives of its type. Useful on sum types.

Type Scale

data Scale grade Source #

Constructors

Scale 

Fields

  • scaleGrades :: Set grade

    How many grades should be used? A greater number of grades permits a finer distinction but demands a higher degree of expertise and discernment. The optimal number is the highest number of grades that constitutes a common language, that is, that allows judges to make absolute judgments. Too little grades may lead too often to ties.

    Note, however, that if the inputs or grades depend on the set of choices, i.e. if judges change their grades when choices are added or dropped, then the Arrow paradox cannot be avoided. To avoid this the scale must be fixed and absolute so that more or fewer choices does not change the inputs or messages of other choices.

  • scaleDefault :: grade

    For instance, when a judge gives no grade or has “no opinion”, scaleDefault could mean that the judge chooses “To Reject” the choice: the rationale being that a judge having “no opinion” concerning a choice has not even taken the time to evaluate it and thus has implicitly rejected it.

Instances

Eq grade => Eq (Scale grade) Source # 

Methods

(==) :: Scale grade -> Scale grade -> Bool #

(/=) :: Scale grade -> Scale grade -> Bool #

Show grade => Show (Scale grade) Source # 

Methods

showsPrec :: Int -> Scale grade -> ShowS #

show :: Scale grade -> String #

showList :: [Scale grade] -> ShowS #

scale :: (Bounded grade, Enum grade, Ord grade) => Scale grade Source #

Return a Scale by enumerating the alternatives of its type. Useful on sum types.

scaleOfList :: Eq a => [a] -> a -> Scale Int Source #

Return a Scale from a list of grades and a default grade. Useful with grades whose type has no Ord instance or a different one than the one wanted.

gradeOfScale :: [a] -> Int -> a Source #

Type Jury

type Jury judge = Set judge Source #

jury :: (Bounded judge, Enum judge, Ord judge) => Jury judge Source #

Return a Jury by enumerating the alternatives of its type. Useful on sum types.

Type Opinion

type Opinion prop grade = Map prop grade Source #

Profile of opinions of one single judge about some propositions.

opinion :: (Enum prop, Bounded prop, Ord prop) => judge -> [grade] -> (judge, Opinion prop grade) Source #

Construct the Opinion of a judge about some propositions implicit from their type.

Type Opinions

newtype Opinions prop grade judge Source #

Profile of opinions of some judges about some propositions.

Constructors

Opinions (Map judge (Opinion prop grade)) 

Instances

(Ord judge, Show judge) => IsList (Opinions prop grade judge) Source # 

Associated Types

type Item (Opinions prop grade judge) :: * #

Methods

fromList :: [Item (Opinions prop grade judge)] -> Opinions prop grade judge #

fromListN :: Int -> [Item (Opinions prop grade judge)] -> Opinions prop grade judge #

toList :: Opinions prop grade judge -> [Item (Opinions prop grade judge)] #

(Eq grade, Eq prop, Eq judge) => Eq (Opinions prop grade judge) Source # 

Methods

(==) :: Opinions prop grade judge -> Opinions prop grade judge -> Bool #

(/=) :: Opinions prop grade judge -> Opinions prop grade judge -> Bool #

(Show grade, Show prop, Show judge) => Show (Opinions prop grade judge) Source # 

Methods

showsPrec :: Int -> Opinions prop grade judge -> ShowS #

show :: Opinions prop grade judge -> String #

showList :: [Opinions prop grade judge] -> ShowS #

type Item (Opinions prop grade judge) Source # 
type Item (Opinions prop grade judge) = (judge, Opinion prop grade)

Type Merit

newtype Merit grade Source #

Profile of merits about a choice.

Constructors

Merit (Map grade Count) 

Instances

(Ord grade, Show grade) => IsList (Merit grade) Source # 

Associated Types

type Item (Merit grade) :: * #

Methods

fromList :: [Item (Merit grade)] -> Merit grade #

fromListN :: Int -> [Item (Merit grade)] -> Merit grade #

toList :: Merit grade -> [Item (Merit grade)] #

Eq grade => Eq (Merit grade) Source # 

Methods

(==) :: Merit grade -> Merit grade -> Bool #

(/=) :: Merit grade -> Merit grade -> Bool #

Ord grade => Ord (Merit grade) Source # 

Methods

compare :: Merit grade -> Merit grade -> Ordering #

(<) :: Merit grade -> Merit grade -> Bool #

(<=) :: Merit grade -> Merit grade -> Bool #

(>) :: Merit grade -> Merit grade -> Bool #

(>=) :: Merit grade -> Merit grade -> Bool #

max :: Merit grade -> Merit grade -> Merit grade #

min :: Merit grade -> Merit grade -> Merit grade #

Show grade => Show (Merit grade) Source # 

Methods

showsPrec :: Int -> Merit grade -> ShowS #

show :: Merit grade -> String #

showList :: [Merit grade] -> ShowS #

Ord grade => Semigroup (Merit grade) Source # 

Methods

(<>) :: Merit grade -> Merit grade -> Merit grade #

sconcat :: NonEmpty (Merit grade) -> Merit grade #

stimes :: Integral b => b -> Merit grade -> Merit grade #

type Item (Merit grade) Source # 
type Item (Merit grade) = (grade, Count)

type Count = Int Source #

merit :: (Ord grade, Ord prop) => Scale grade -> prop -> Opinions prop grade judge -> Merit grade Source #

merit grad returns the Merit of a single choice by some judges.

Type Merits

newtype Merits prop grade Source #

Profile of merits about some choices.

Constructors

Merits (Map prop (Merit grade)) 

Instances

(Ord prop, Show prop) => IsList (Merits prop grade) Source # 

Associated Types

type Item (Merits prop grade) :: * #

Methods

fromList :: [Item (Merits prop grade)] -> Merits prop grade #

fromListN :: Int -> [Item (Merits prop grade)] -> Merits prop grade #

toList :: Merits prop grade -> [Item (Merits prop grade)] #

(Eq grade, Eq prop) => Eq (Merits prop grade) Source # 

Methods

(==) :: Merits prop grade -> Merits prop grade -> Bool #

(/=) :: Merits prop grade -> Merits prop grade -> Bool #

(Show grade, Show prop) => Show (Merits prop grade) Source # 

Methods

showsPrec :: Int -> Merits prop grade -> ShowS #

show :: Merits prop grade -> String #

showList :: [Merits prop grade] -> ShowS #

(Ord grade, Ord prop) => Semigroup (Merits prop grade) Source # 

Methods

(<>) :: Merits prop grade -> Merits prop grade -> Merits prop grade #

sconcat :: NonEmpty (Merits prop grade) -> Merits prop grade #

stimes :: Integral b => b -> Merits prop grade -> Merits prop grade #

type Item (Merits prop grade) Source # 
type Item (Merits prop grade) = (prop, Merit grade)

merits :: (Ord grade, Ord prop) => Scale grade -> Choices prop -> Opinions prop grade judge -> Merits prop grade Source #

merit scal props opins returns the Merits of the Choices props as judged by the Opinions opins on the Scale scal.

Type Value

newtype Value grade Source #

A Value is a compressed list of grades, where each grade is associated with the Count by which it would be replicated in situ if decompressed.

Constructors

Value [(grade, Count)] 

Instances

Eq grade => Eq (Value grade) Source # 

Methods

(==) :: Value grade -> Value grade -> Bool #

(/=) :: Value grade -> Value grade -> Bool #

Ord grade => Ord (Value grade) Source #

compare lexicographically as if the Values were decompressed.

Methods

compare :: Value grade -> Value grade -> Ordering #

(<) :: Value grade -> Value grade -> Bool #

(<=) :: Value grade -> Value grade -> Bool #

(>) :: Value grade -> Value grade -> Bool #

(>=) :: Value grade -> Value grade -> Bool #

max :: Value grade -> Value grade -> Value grade #

min :: Value grade -> Value grade -> Value grade #

Show grade => Show (Value grade) Source # 

Methods

showsPrec :: Int -> Value grade -> ShowS #

show :: Value grade -> String #

showList :: [Value grade] -> ShowS #

majorityValue :: Ord grade => Merit grade -> Value grade Source #

The majorityValue is the list of the majorityGrades of a choice, each one replicated their associated Count times, from the most consensual to the least, ie. by removing the grade of the previous majorityGrade to compute the next.

majorityGrade :: Ord grade => Merit grade -> grade Source #

The majorityGrade is the lower middlemost (also known as median by experts) of the grades given to a choice by the judges.

It is the highest grade approved by an absolute majority of the judges: more than 50% of the judges give the choice at least a grade of majorityGrade, but every grade lower than majorityGrade is rejected by an absolute majority Thus the majorityGrade of a choice is the final grade wished by the majority.

The majorityGrade is necessarily a word that belongs to grades, and it has an absolute meaning.

When the number of judges is even, there is a middle-interval (which can, of course, be reduced to a single grade if the two middle grades are the same), then the majorityGrade is the lowest grade of the middle-interval (the “lower middlemost” when there are two in the middle), which is the only one which respects consensus: any other choice whose grades are all within this middle-interval, has a majorityGrade which is greater or equal to this lower middlemost.

Type Ranking

type Ranking prop = [prop] Source #

majorityRanking :: Ord grade => Merits prop grade -> Ranking prop Source #

The majorityRanking ranks all the choices on the basis of their grades.

Choice A ranks higher than choice B in the majorityRanking if and only if A’s majorityValue is lexicographically above B’s. There can be no tie unless two choices have precisely the same majorityValues.

majorityValueByChoice :: Ord grade => Merits prop grade -> [(prop, Value grade)] Source #