vote-schulze 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +12 -0
- data/.github/dependabot.yml +14 -0
- data/.github/workflows/ci.yml +52 -0
- data/.github/workflows/dependabot-auto-merge.yml +21 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.rubocop.yml +32 -0
- data/CODE_OF_CONDUCT.md +129 -0
- data/Gemfile +7 -6
- data/Gemfile.lock +70 -19
- data/LICENSE.txt +18 -17
- data/README.md +24 -34
- data/Rakefile +4 -41
- data/bin/console +15 -0
- data/bin/rspec +27 -0
- data/bin/rubocop +27 -0
- data/bin/setup +8 -0
- data/examples/vote4names.list +6 -0
- data/exe/vote-schulze +57 -0
- data/lib/vote/matrix.rb +5 -7
- data/lib/vote/schulze/basic.rb +92 -0
- data/lib/vote/schulze/input.rb +74 -0
- data/lib/vote/schulze/version.rb +7 -0
- data/lib/vote/schulze.rb +15 -0
- data/lib/vote.rb +2 -4
- data/lib/vote_schulze.rb +3 -0
- data/vote-schulze.gemspec +35 -61
- metadata +136 -57
- data/.document +0 -5
- data/.rvmrc +0 -2
- data/VERSION +0 -1
- data/lib/vote/condorcet/schulze/basic.rb +0 -117
- data/lib/vote/condorcet/schulze/input.rb +0 -89
- data/lib/vote/condorcet/schulze/win_and_lost.rb +0 -14
- data/lib/vote/condorcet/schulze.rb +0 -11
- data/lib/vote/condorcet.rb +0 -7
- data/lib/vote-schulze.rb +0 -15
- data/spec/spec_helper.rb +0 -12
- data/spec/vote-schulze_spec.rb +0 -9
data/bin/rubocop
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
#
|
5
|
+
# This file was generated by Bundler.
|
6
|
+
#
|
7
|
+
# The application 'rubocop' is installed as part of a gem, and
|
8
|
+
# this file is here to facilitate running it.
|
9
|
+
#
|
10
|
+
|
11
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
12
|
+
|
13
|
+
bundle_binstub = File.expand_path('bundle', __dir__)
|
14
|
+
|
15
|
+
if File.file?(bundle_binstub)
|
16
|
+
if File.read(bundle_binstub, 300).include?('This file was generated by Bundler')
|
17
|
+
load(bundle_binstub)
|
18
|
+
else
|
19
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
20
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
require 'rubygems'
|
25
|
+
require 'bundler/setup'
|
26
|
+
|
27
|
+
load Gem.bin_path('rubocop', 'rubocop')
|
data/bin/setup
ADDED
data/exe/vote-schulze
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'optparse'
|
5
|
+
require 'vote/schulze'
|
6
|
+
|
7
|
+
class Cli
|
8
|
+
def self.call
|
9
|
+
new.call
|
10
|
+
end
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
@options = parse_options
|
14
|
+
@input_file = @options[:input_file]
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse_options # rubocop:disable Metrics/MethodLength
|
18
|
+
{}.tap do |options|
|
19
|
+
OptionParser.new do |opts|
|
20
|
+
opts.banner = 'Usage: vote-schulze [options]'
|
21
|
+
|
22
|
+
opts.on('-f FILE', '--file FILE', 'Input file with voting data') do |file|
|
23
|
+
options[:input_file] = file
|
24
|
+
end
|
25
|
+
|
26
|
+
# opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
27
|
+
# options[:verbose] = v
|
28
|
+
# end
|
29
|
+
|
30
|
+
opts.on('-h', '--help', 'Prints this help') do
|
31
|
+
puts opts
|
32
|
+
exit
|
33
|
+
end
|
34
|
+
end.parse!
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def call
|
39
|
+
voting_data = File.open(@input_file)
|
40
|
+
voting = Vote::Schulze.basic(voting_data)
|
41
|
+
puts <<~RESULTDATA
|
42
|
+
Voting data:
|
43
|
+
|
44
|
+
Total amount of candidates: #{format('%5<count>i', count: voting.candidate_count)}
|
45
|
+
Total amount of voters: #{format('%5<count>i', count: voting.voting_count)}
|
46
|
+
|
47
|
+
Voting result as ABC ranking:
|
48
|
+
|
49
|
+
#{voting.ranking_abc}
|
50
|
+
|
51
|
+
Note: Number represents position, 1=winner(s);
|
52
|
+
always listed as there can be more on same position.
|
53
|
+
RESULTDATA
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
Cli.call
|
data/lib/vote/matrix.rb
CHANGED
@@ -1,15 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
# usage: m = ::Matrix.scalar(size,value).extend(Vote::Matrix)
|
3
|
+
require 'matrix'
|
5
4
|
|
5
|
+
# extend matrix with method []=(i, j, v)
|
6
|
+
# usage: m = ::Matrix.scalar(size, value).extend(Vote::Matrix)
|
6
7
|
module Vote
|
7
8
|
module Matrix
|
8
|
-
|
9
|
-
def []=(i,j,v)
|
9
|
+
def []=(i, j, v) # rubocop:disable Naming/MethodParameterName
|
10
10
|
@rows[i][j] = v
|
11
11
|
end
|
12
|
-
|
13
12
|
end
|
14
13
|
end
|
15
|
-
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vote
|
4
|
+
module Schulze
|
5
|
+
class Basic
|
6
|
+
# All-in-One class method to get a calculated SchulzeBasic object
|
7
|
+
def self.call(voting_data, candidate_count = nil)
|
8
|
+
new(voting_data, candidate_count).call
|
9
|
+
end
|
10
|
+
|
11
|
+
attr_reader :voting_matrix, :play_matrix, :result_matrix,
|
12
|
+
:ranking, :ranking_abc, :candidate_count, :voting_count,
|
13
|
+
:candidate_names, :votes
|
14
|
+
|
15
|
+
def initialize(voting_data, candidate_count = nil)
|
16
|
+
unless voting_data.is_a?(Vote::Schulze::Input)
|
17
|
+
voting_data = Vote::Schulze::Input.new(voting_data, candidate_count)
|
18
|
+
end
|
19
|
+
@voting_matrix = voting_data.voting_matrix
|
20
|
+
@candidate_count = voting_data.candidate_count
|
21
|
+
@voting_count = voting_data.voting_count
|
22
|
+
@candidate_names = voting_data.candidate_names
|
23
|
+
@votes = voting_data.votes
|
24
|
+
@play_matrix = ::Matrix.scalar(@candidate_count, 0).extend(Vote::Matrix)
|
25
|
+
@result_matrix = ::Matrix.scalar(@candidate_count, 0).extend(Vote::Matrix)
|
26
|
+
end
|
27
|
+
|
28
|
+
def call
|
29
|
+
tap do
|
30
|
+
find_matches_with_wins
|
31
|
+
find_strongest_paths
|
32
|
+
calculate_result
|
33
|
+
calculate_ranking
|
34
|
+
calculate_ranking_abc
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def find_matches_with_wins
|
41
|
+
@candidate_count.times do |i|
|
42
|
+
@candidate_count.times do |j|
|
43
|
+
next if i == j
|
44
|
+
|
45
|
+
@play_matrix[i, j] = @voting_matrix[i, j] if @voting_matrix[i, j] > @voting_matrix[j, i]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def find_strongest_paths # rubocop:disable Metrics/MethodLength
|
51
|
+
@candidate_count.times do |i|
|
52
|
+
@candidate_count.times do |j|
|
53
|
+
next if i == j
|
54
|
+
|
55
|
+
@candidate_count.times do |k|
|
56
|
+
next if i == k
|
57
|
+
next if j == k
|
58
|
+
|
59
|
+
@play_matrix[j, k] = [
|
60
|
+
@play_matrix[j, k],
|
61
|
+
[@play_matrix[j, i], @play_matrix[i, k]].min
|
62
|
+
].max
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def calculate_result
|
69
|
+
@result_matrix.each_with_index do |e, x, y|
|
70
|
+
next if x == y
|
71
|
+
|
72
|
+
@result_matrix[x, y] = e + 1 if @play_matrix[x, y] > @play_matrix[y, x]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def calculate_ranking
|
77
|
+
@ranking = @result_matrix.row_vectors.map(&:sum)
|
78
|
+
end
|
79
|
+
|
80
|
+
def calculate_ranking_abc
|
81
|
+
@ranking_abc =
|
82
|
+
@ranking
|
83
|
+
.map.with_index { |e, i| [e, @candidate_names[i]] }
|
84
|
+
.sort
|
85
|
+
.reverse
|
86
|
+
.map do |(idx, name)|
|
87
|
+
"#{name.length == 1 ? name.upcase : name}:#{@ranking.max - idx + 1}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Vote
|
4
|
+
module Schulze
|
5
|
+
class Input
|
6
|
+
attr_reader :candidate_count, :voting_count, :voting_matrix,
|
7
|
+
:candidate_names, :votes
|
8
|
+
|
9
|
+
def initialize(voting_data, candidate_count = nil)
|
10
|
+
@voting_data = voting_data
|
11
|
+
@candidate_count = candidate_count
|
12
|
+
|
13
|
+
if @candidate_count.nil?
|
14
|
+
insert_voting_file(@voting_data) if voting_data.is_a?(File)
|
15
|
+
else
|
16
|
+
@voting_matrix = ::Matrix.scalar(@candidate_count, 0).extend(Vote::Matrix)
|
17
|
+
insert_voting_array(@voting_data) if voting_data.is_a?(Array)
|
18
|
+
insert_voting_string(@voting_data) if voting_data.is_a?(String)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def insert_voting_array(voting_array)
|
23
|
+
@votes = voting_array
|
24
|
+
voting_array.each do |vote|
|
25
|
+
@voting_matrix.each_with_index do |_e, x, y|
|
26
|
+
next if x == y
|
27
|
+
|
28
|
+
@voting_matrix[x, y] += 1 if vote[x] > vote[y]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
@voting_count = voting_array.size
|
32
|
+
end
|
33
|
+
|
34
|
+
def insert_voting_string(voting_string) # rubocop:todo all
|
35
|
+
voting_array = []
|
36
|
+
voting_string.split(/\n|\n\r|\r/).each do |voter|
|
37
|
+
voter = voter.split('=')
|
38
|
+
vcount = voter.size == 1 ? 1 : voter[0].to_i
|
39
|
+
|
40
|
+
tmp = voter.last.split(';')
|
41
|
+
tmp2 = []
|
42
|
+
|
43
|
+
tmp.map! { |e| [e, @candidate_count - tmp.index(e)] }
|
44
|
+
# find equal-weighted candidates
|
45
|
+
tmp.map do |e|
|
46
|
+
if e[0].size > 1
|
47
|
+
e[0].split(',').each do |f|
|
48
|
+
tmp2 << [f, e[1]]
|
49
|
+
end
|
50
|
+
else
|
51
|
+
tmp2 << e
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
@candidate_names ||= tmp2.map { |e| e[0] }.sort
|
56
|
+
vote = tmp2.sort.map { |e| e[1] } # order, strip & add
|
57
|
+
vcount.times do
|
58
|
+
voting_array << vote
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
insert_voting_array(voting_array)
|
63
|
+
end
|
64
|
+
|
65
|
+
def insert_voting_file(voting_file)
|
66
|
+
voting_file.rewind
|
67
|
+
@candidate_count = voting_file.first.strip.to_i # reads first line for count
|
68
|
+
@voting_matrix = ::Matrix.scalar(@candidate_count, 0).extend(Vote::Matrix)
|
69
|
+
insert_voting_string(voting_file.read) # reads rest of file (w/o line 1)
|
70
|
+
voting_file.close
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/lib/vote/schulze.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'vote/matrix'
|
4
|
+
require 'vote/schulze/input'
|
5
|
+
require 'vote/schulze/basic'
|
6
|
+
|
7
|
+
module Vote
|
8
|
+
# Consult README.md for usage
|
9
|
+
module Schulze
|
10
|
+
# Shortcut to Vote::Schulze::Basic.call(...)
|
11
|
+
def self.basic(*arguments)
|
12
|
+
Basic.call(*arguments)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/vote.rb
CHANGED
data/lib/vote_schulze.rb
ADDED
data/vote-schulze.gemspec
CHANGED
@@ -1,67 +1,41 @@
|
|
1
|
-
#
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
# frozen_string_literal: true
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'vote/schulze/version'
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".rspec",
|
22
|
-
".rvmrc",
|
23
|
-
"Gemfile",
|
24
|
-
"Gemfile.lock",
|
25
|
-
"LICENSE.txt",
|
26
|
-
"README.md",
|
27
|
-
"Rakefile",
|
28
|
-
"VERSION",
|
29
|
-
"examples/vote4.list",
|
30
|
-
"examples/vote6.list",
|
31
|
-
"lib/vote-schulze.rb",
|
32
|
-
"lib/vote.rb",
|
33
|
-
"lib/vote/condorcet.rb",
|
34
|
-
"lib/vote/condorcet/schulze.rb",
|
35
|
-
"lib/vote/condorcet/schulze/basic.rb",
|
36
|
-
"lib/vote/condorcet/schulze/input.rb",
|
37
|
-
"lib/vote/condorcet/schulze/win_and_lost.rb",
|
38
|
-
"lib/vote/matrix.rb",
|
39
|
-
"spec/spec_helper.rb",
|
40
|
-
"spec/vote-schulze_spec.rb",
|
41
|
-
"vote-schulze.gemspec"
|
42
|
-
]
|
43
|
-
s.homepage = %q{http://github.com/asaaki/vote-schulze}
|
44
|
-
s.licenses = ["MIT"]
|
45
|
-
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = %q{1.6.2}
|
47
|
-
s.summary = %q{Schulze method implementation in Ruby (Condorcet voting method)}
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'vote-schulze'
|
9
|
+
spec.version = Vote::Schulze::VERSION
|
10
|
+
spec.authors = ['Christoph Grabo']
|
11
|
+
spec.email = ['asaaki@mannaz.cc']
|
48
12
|
|
49
|
-
|
50
|
-
|
13
|
+
spec.summary = 'Schulze method implementation (a type of the Condorcet method)'
|
14
|
+
spec.description = 'This gem is a Ruby implementation of the Schulze voting method (using Floyd–Warshall ' \
|
15
|
+
'algorithm), a type of the Condorcet voting methods.'
|
16
|
+
spec.homepage = 'https://github.com/asaaki/vote-schulze'
|
17
|
+
spec.license = 'MIT'
|
51
18
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
58
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
59
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
60
|
-
end
|
61
|
-
else
|
62
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
63
|
-
s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
|
64
|
-
s.add_dependency(%q<rspec>, ["~> 2.3.0"])
|
19
|
+
# Specify which files should be added to the gem when it is released.
|
20
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
65
23
|
end
|
66
|
-
|
24
|
+
spec.bindir = 'exe'
|
25
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
+
spec.require_paths = ['lib']
|
27
|
+
|
28
|
+
spec.required_ruby_version = '>= 3.0'
|
29
|
+
|
30
|
+
spec.add_runtime_dependency 'matrix', '>= 0.4.2'
|
67
31
|
|
32
|
+
spec.add_development_dependency 'bundler', '~> 2.4'
|
33
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.12'
|
35
|
+
spec.add_development_dependency 'rubocop', '~> 1.50'
|
36
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.10'
|
37
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.6'
|
38
|
+
spec.add_development_dependency 'rubocop-rspec', '~> 2.22'
|
39
|
+
|
40
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
41
|
+
end
|
metadata
CHANGED
@@ -1,108 +1,187 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vote-schulze
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Christoph Grabo
|
9
|
-
autorequire:
|
10
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
11
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: matrix
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.2
|
15
27
|
- !ruby/object:Gem::Dependency
|
16
28
|
name: bundler
|
17
|
-
requirement:
|
18
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
19
30
|
requirements:
|
20
|
-
- - ~>
|
31
|
+
- - "~>"
|
21
32
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
33
|
+
version: '2.4'
|
23
34
|
type: :development
|
24
35
|
prerelease: false
|
25
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.4'
|
26
41
|
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
28
|
-
requirement:
|
29
|
-
none: false
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
|
-
- - ~>
|
45
|
+
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
47
|
+
version: '13.0'
|
34
48
|
type: :development
|
35
49
|
prerelease: false
|
36
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '13.0'
|
37
55
|
- !ruby/object:Gem::Dependency
|
38
56
|
name: rspec
|
39
|
-
requirement:
|
40
|
-
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.12'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
41
72
|
requirements:
|
42
|
-
- - ~>
|
73
|
+
- - "~>"
|
43
74
|
- !ruby/object:Gem::Version
|
44
|
-
version:
|
75
|
+
version: '1.50'
|
45
76
|
type: :development
|
46
77
|
prerelease: false
|
47
|
-
version_requirements:
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.50'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-performance
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.10'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.10'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-rake
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.6'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.22'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.22'
|
125
|
+
description: This gem is a Ruby implementation of the Schulze voting method (using
|
126
|
+
Floyd–Warshall algorithm), a type of the Condorcet voting methods.
|
127
|
+
email:
|
128
|
+
- asaaki@mannaz.cc
|
129
|
+
executables:
|
130
|
+
- vote-schulze
|
52
131
|
extensions: []
|
53
|
-
extra_rdoc_files:
|
54
|
-
- LICENSE.txt
|
55
|
-
- README.md
|
132
|
+
extra_rdoc_files: []
|
56
133
|
files:
|
57
|
-
- .
|
58
|
-
- .
|
59
|
-
- .
|
134
|
+
- ".editorconfig"
|
135
|
+
- ".github/dependabot.yml"
|
136
|
+
- ".github/workflows/ci.yml"
|
137
|
+
- ".github/workflows/dependabot-auto-merge.yml"
|
138
|
+
- ".gitignore"
|
139
|
+
- ".rspec"
|
140
|
+
- ".rubocop.yml"
|
141
|
+
- CODE_OF_CONDUCT.md
|
60
142
|
- Gemfile
|
61
143
|
- Gemfile.lock
|
62
144
|
- LICENSE.txt
|
63
145
|
- README.md
|
64
146
|
- Rakefile
|
65
|
-
-
|
147
|
+
- bin/console
|
148
|
+
- bin/rspec
|
149
|
+
- bin/rubocop
|
150
|
+
- bin/setup
|
66
151
|
- examples/vote4.list
|
152
|
+
- examples/vote4names.list
|
67
153
|
- examples/vote6.list
|
68
|
-
-
|
154
|
+
- exe/vote-schulze
|
69
155
|
- lib/vote.rb
|
70
|
-
- lib/vote/condorcet.rb
|
71
|
-
- lib/vote/condorcet/schulze.rb
|
72
|
-
- lib/vote/condorcet/schulze/basic.rb
|
73
|
-
- lib/vote/condorcet/schulze/input.rb
|
74
|
-
- lib/vote/condorcet/schulze/win_and_lost.rb
|
75
156
|
- lib/vote/matrix.rb
|
76
|
-
-
|
77
|
-
-
|
157
|
+
- lib/vote/schulze.rb
|
158
|
+
- lib/vote/schulze/basic.rb
|
159
|
+
- lib/vote/schulze/input.rb
|
160
|
+
- lib/vote/schulze/version.rb
|
161
|
+
- lib/vote_schulze.rb
|
78
162
|
- vote-schulze.gemspec
|
79
|
-
|
80
|
-
homepage: http://github.com/asaaki/vote-schulze
|
163
|
+
homepage: https://github.com/asaaki/vote-schulze
|
81
164
|
licenses:
|
82
165
|
- MIT
|
83
|
-
|
166
|
+
metadata:
|
167
|
+
rubygems_mfa_required: 'true'
|
168
|
+
post_install_message:
|
84
169
|
rdoc_options: []
|
85
170
|
require_paths:
|
86
171
|
- lib
|
87
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
173
|
requirements:
|
90
|
-
- -
|
174
|
+
- - ">="
|
91
175
|
- !ruby/object:Gem::Version
|
92
|
-
version: '0'
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
hash: -2878999466654239120
|
176
|
+
version: '3.0'
|
96
177
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
178
|
requirements:
|
99
|
-
- -
|
179
|
+
- - ">="
|
100
180
|
- !ruby/object:Gem::Version
|
101
181
|
version: '0'
|
102
182
|
requirements: []
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
summary: Schulze method implementation in Ruby (Condorcet voting method)
|
183
|
+
rubygems_version: 3.4.12
|
184
|
+
signing_key:
|
185
|
+
specification_version: 4
|
186
|
+
summary: Schulze method implementation (a type of the Condorcet method)
|
108
187
|
test_files: []
|