Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Schulze handler Schulze SchulzeCtrl // InstantRunoff handler InstantRunoff InstantRunoffCtrl // Plurality handler Plurality PluralityCtrl )
Functions ¶
This section is empty.
Types ¶
type CPair ¶
type CPair struct {
// contains filtered or unexported fields
}
CPair represents two candidates' indices for pairwise comparison
type InstantRunoffCtrl ¶
type InstantRunoffCtrl struct{}
InstantRunoffCtrl is a struct exposed for reference -- use govote.InstantRunoff instance
func (InstantRunoffCtrl) New ¶
func (_ InstantRunoffCtrl) New(candidates []string) (InstantRunoffPoll, error)
New creates a new Instant Runoff poll
type InstantRunoffPoll ¶
type InstantRunoffPoll struct {
// contains filtered or unexported fields
}
InstantRunoffPoll is a poll using the IRV method with specific rules for tie-breaking
func (*InstantRunoffPoll) AddBallot ¶
func (p *InstantRunoffPoll) AddBallot(ballot []string) bool
AddBallot submits a ballot to the poll, returns true on success, false on failure
type PluralityCtrl ¶
type PluralityCtrl struct{}
PluralityCtrl is a struct exposed for reference -- use govote.Plurality instance
func (PluralityCtrl) New ¶
func (_ PluralityCtrl) New(candidates []string) (PluralityPoll, error)
New creates a new Plurality poll
type PluralityPoll ¶
type PluralityPoll struct {
// contains filtered or unexported fields
}
PluralityPoll is a poll using a simple plurality method (candidate with most votes wins)
func (*PluralityPoll) AddBallot ¶
func (p *PluralityPoll) AddBallot(ballot string) bool
AddBallot submits a ballot to the poll, returns true on success, false on failure
type SchulzeCtrl ¶
type SchulzeCtrl struct{}
SchulzeCtrl is a struct exposed for reference -- use govote.Schulze instance
func (SchulzeCtrl) New ¶
func (_ SchulzeCtrl) New(candidates []string) (SchulzePoll, error)
New creates a new Schulze method poll
type SchulzePoll ¶
type SchulzePoll struct {
PP map[CPair]int // pairwise preferences
SP map[CPair]int // strongest path
// contains filtered or unexported fields
}
SchulzePoll is a Condorcet poll using the Schulze method
func (*SchulzePoll) AddBallot ¶
func (p *SchulzePoll) AddBallot(ballot []string) bool
AddBallot submits a ballot to the poll, returns true on success, false on failure

