For ordinal extensions

class embedded_voting.ManipulationCoalitionOrdinal(ratings, embeddings, rule_positional=None, rule=None)[source]

This class extends the ManipulationCoalition class to ordinal rules (irv, borda, plurality, etc.), because the ManipulationCoalition cannot be used for ordinal preferences.

Parameters:
  • ratings (Ratings or np.ndarray) – The ratings of voters to candidates
  • embeddings (Embeddings) – The embeddings of the voters
  • rule_positional (RulePositional) – The ordinal rule used.
  • rule (Rule) – The aggregation rule we want to analysis.
rule

The aggregation rule we want to analysis.

Type:Rule
winner_

The index of the winner of the election without manipulation.

Type:int
welfare_

The welfares of the candidates without manipulation.

Type:float list
extended_rule

The rule we are analysing

Type:Rule
rule_positional

The positional rule used.

Type:RulePositional

Examples

>>> np.random.seed(42)
>>> ratings_dim_candidate = [[1, .2, 0], [.5, .6, .9], [.1, .8, .3]]
>>> embeddings = EmbeddingsGeneratorPolarized(10, 3)(.8)
>>> ratings = RatingsFromEmbeddingsCorrelated(coherence=0.8, ratings_dim_candidate=ratings_dim_candidate)(embeddings)
>>> rule_positional = RuleInstantRunoff()
>>> manipulation = ManipulationCoalitionOrdinal(ratings, embeddings, rule_positional, RuleSVDNash())
>>> manipulation.winner_
2
>>> manipulation.is_manipulable_
True
>>> manipulation.worst_welfare_
0.0
trivial_manipulation(candidate, verbose=False)[source]

This function computes if a trivial manipulation is possible for the candidate passed as parameter.

Parameters:
  • candidate (int) – The index of the candidate for which we manipulate.
  • verbose (bool) – Verbose mode. By default, is set to False.
Returns:

If True, the ratings is manipulable for this candidate.

Return type:

bool

Examples

>>> np.random.seed(42)
>>> ratings_dim_candidate = [[1, .2, 0], [.5, .6, .9], [.1, .8, .3]]
>>> embeddings = EmbeddingsGeneratorPolarized(10, 3)(.8)
>>> ratings = RatingsFromEmbeddingsCorrelated(coherence=.8, ratings_dim_candidate=ratings_dim_candidate)(embeddings)
>>> manipulation = ManipulationCoalition(ratings, embeddings, RuleSVDNash())
>>> manipulation.trivial_manipulation(0, verbose=True)
1 voters interested to elect 0 instead of 1
Winner is 0
True

Particular cases

Borda

class embedded_voting.ManipulationCoalitionOrdinalBorda(ratings, embeddings, rule=None)[source]

This class do the coalition manipulation analysis for the RulePositionalBorda rule_positional.

Parameters:
  • ratings (Ratings or np.ndarray) – The ratings of voters to candidates
  • embeddings (Embeddings) – The embeddings of the voters
  • rule (Rule) – The aggregation rule we want to analysis.

Examples

>>> np.random.seed(42)
>>> ratings_dim_candidate = [[1, .2, 0], [.5, .6, .9], [.1, .8, .3]]
>>> embeddings = EmbeddingsGeneratorPolarized(10, 3)(.8)
>>> ratings = RatingsFromEmbeddingsCorrelated(coherence=0.8, ratings_dim_candidate=ratings_dim_candidate)(embeddings)
>>> manipulation = ManipulationCoalitionOrdinalBorda(ratings, embeddings, RuleSVDNash())
>>> manipulation.winner_
1
>>> manipulation.is_manipulable_
False
>>> manipulation.worst_welfare_
1.0

k-Approval

class embedded_voting.ManipulationCoalitionOrdinalKApproval(ratings, embeddings, k=2, rule=None)[source]

This class do the coalition manipulation analysis for the RulePositionalKApproval rule_positional.

Parameters:
  • ratings (Ratings or np.ndarray) – The ratings of voters to candidates
  • embeddings (Embeddings) – The embeddings of the voters
  • k (int) – The parameter of the k-approval rule.
  • rule (Rule) – The aggregation rule we want to analysis.

Examples

>>> np.random.seed(42)
>>> ratings_dim_candidate = [[1, .2, 0], [.5, .6, .9], [.1, .8, .3]]
>>> embeddings = EmbeddingsGeneratorPolarized(10, 3)(.8)
>>> ratings = RatingsFromEmbeddingsCorrelated(coherence=0.8, ratings_dim_candidate=ratings_dim_candidate)(embeddings)
>>> manipulation = ManipulationCoalitionOrdinalKApproval(ratings, embeddings, k=2, rule=RuleSVDNash())
>>> manipulation.winner_
1
>>> manipulation.is_manipulable_
False
>>> manipulation.worst_welfare_
1.0

Instant Runoff

class embedded_voting.ManipulationCoalitionOrdinalIRV(ratings, embeddings, rule=None)[source]

This class do the coalition manipulation analysis for the RuleInstantRunoff rule_positional.

Parameters:
  • ratings (Ratings or np.ndarray) – The ratings of voters to candidates
  • embeddings (Embeddings) – The embeddings of the voters
  • rule (Rule) – The aggregation rule we want to analysis.

Examples

>>> np.random.seed(42)
>>> ratings_dim_candidate = [[1, .2, 0], [.5, .6, .9], [.1, .8, .3]]
>>> embeddings = EmbeddingsGeneratorPolarized(10, 3)(.8)
>>> ratings = RatingsFromEmbeddingsCorrelated(coherence=0.8, ratings_dim_candidate=ratings_dim_candidate)(embeddings)
>>> manipulation = ManipulationCoalitionOrdinalIRV(ratings, embeddings, RuleSVDNash())
>>> manipulation.winner_
2
>>> manipulation.is_manipulable_
True
>>> manipulation.worst_welfare_
0.0