davenport 1.0.0 → 1.0.2.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -24
- data/ext/{davenport/davenport.c → davenport_ruby/davenport_ruby.c} +1 -1
- data/ext/{davenport → davenport_ruby}/extconf.rb +1 -1
- data/lib/davenport.rb +2 -2
- metadata +25 -61
- data/.autotest +0 -25
- data/Manifest.txt +0 -9
- data/test/test_davenport.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 602601c1968346a69a93ba33634853205c2c53602d44edebf49bd1e406a64fe5
|
4
|
+
data.tar.gz: 2115f76023c51ae60625863d8fab0370d17db500d0c4cc8f8781a473a363e934
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a68bd514867d1958e63cb4cd05254d2deb743dade10b38291f7bfa7240dbcfc6ab80c689caa1ec24050b323cc145acb45eee9ca1a7adb09738b84ff6ed45e1e8
|
7
|
+
data.tar.gz: 888c2a41f62baf512a7f2c29185d27e64d89a2d7fa606fc8c9d8727a0bc900d672dcd2624c56e3c9b1e0dbe1e134204b1b26babec953466b53a1671f7edc3eb5
|
data/Rakefile
CHANGED
@@ -1,29 +1,9 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
1
|
require 'rubygems'
|
4
|
-
require 'hoe'
|
5
2
|
require 'rake/extensiontask'
|
6
3
|
|
7
|
-
|
8
|
-
# Hoe.plugin :gem_prelude_sucks
|
9
|
-
# Hoe.plugin :inline
|
10
|
-
# Hoe.plugin :minitest
|
11
|
-
# Hoe.plugin :racc
|
12
|
-
# Hoe.plugin :rcov
|
13
|
-
# Hoe.plugin :rdoc
|
14
|
-
|
15
|
-
HOE = Hoe.spec "davenport" do
|
16
|
-
developer("Douglas Lovell", "doug@wbreeze.com")
|
17
|
-
license "LGPL-3.0"
|
18
|
-
self.spec_extras = {
|
19
|
-
extensions: ['ext/davenport/extconf.rb']
|
20
|
-
}
|
21
|
-
end
|
4
|
+
spec = Gem::Specification.load('davenport.gemspec')
|
22
5
|
|
23
|
-
Rake::ExtensionTask.new
|
24
|
-
ext.
|
6
|
+
Rake::ExtensionTask.new "davenport_ruby", spec do |ext|
|
7
|
+
ext.name = 'davenport_ruby'
|
8
|
+
ext.lib_dir = 'lib/davenport_ruby'
|
25
9
|
end
|
26
|
-
|
27
|
-
Rake::Task[:test].prerequisites << :compile
|
28
|
-
|
29
|
-
# vim: syntax=ruby
|
data/lib/davenport.rb
CHANGED
metadata
CHANGED
@@ -1,90 +1,54 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: davenport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Douglas Lovell
|
7
|
+
- Douglas Lovell <https://wbreeze.com/>
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.0'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '7'
|
23
|
-
type: :development
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '4.0'
|
30
|
-
- - "<"
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '7'
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: hoe
|
14
|
+
name: rake-compiler
|
35
15
|
requirement: !ruby/object:Gem::Requirement
|
36
16
|
requirements:
|
37
17
|
- - "~>"
|
38
18
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
19
|
+
version: '1.0'
|
40
20
|
type: :development
|
41
21
|
prerelease: false
|
42
22
|
version_requirements: !ruby/object:Gem::Requirement
|
43
23
|
requirements:
|
44
24
|
- - "~>"
|
45
25
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
47
|
-
description:
|
48
|
-
|
49
|
-
|
50
|
-
A preference graph, given some number of rankings, expresses the combination
|
51
|
-
of all of those rankings. It is a directed, weighted graph in which the
|
52
|
-
nodes represent the alternatives and the edges represent preferences.
|
53
|
-
|
54
|
-
Use this to build a preference graph from individual rankings and compute
|
55
|
-
a Kemeny order, aggregated preference that minimizes the number of
|
56
|
-
pair-wise disagreements with the individual rankings.
|
57
|
-
|
58
|
-
This is a Ruby binding built around a C language implementation of
|
59
|
-
Davenport's algorithm, found on github at
|
60
|
-
{wbreeze/davenport}[https://github.com/wbreeze/davenport]
|
61
|
-
email:
|
62
|
-
- doug@wbreeze.com
|
26
|
+
version: '1.0'
|
27
|
+
description: 'Provides a Ruby interface for aggregating partial order expressions
|
28
|
+
into a partial order with minimal Kemeny-Young distance '
|
29
|
+
email:
|
63
30
|
executables: []
|
64
31
|
extensions:
|
65
|
-
- ext/
|
66
|
-
extra_rdoc_files:
|
67
|
-
- History.txt
|
68
|
-
- Manifest.txt
|
69
|
-
- README.rdoc
|
32
|
+
- ext/davenport_ruby/extconf.rb
|
33
|
+
extra_rdoc_files: []
|
70
34
|
files:
|
71
|
-
- ".autotest"
|
72
35
|
- History.txt
|
73
|
-
- Manifest.txt
|
74
36
|
- README.rdoc
|
75
37
|
- Rakefile
|
76
|
-
- ext/
|
77
|
-
- ext/
|
38
|
+
- ext/davenport_ruby/davenport_ruby.c
|
39
|
+
- ext/davenport_ruby/extconf.rb
|
78
40
|
- lib/davenport.rb
|
79
|
-
- test/test_davenport.rb
|
80
41
|
homepage: https://github.com/wbreeze/davenport-ruby
|
81
42
|
licenses:
|
82
43
|
- LGPL-3.0
|
83
|
-
metadata:
|
44
|
+
metadata:
|
45
|
+
bug_tracker_uri: https://github.com/wbreeze/davenport-ruby/issues
|
46
|
+
changelog_uri: https://github.com/wbreeze/davenport-ruby/pulls
|
47
|
+
documentation_uri: https://github.com/wbreeze/davenport-ruby
|
48
|
+
homepage_uri: https://github.com/wbreeze/davenport-ruby
|
49
|
+
source_code_uri: https://github.com/wbreeze/davenport-ruby
|
84
50
|
post_install_message:
|
85
|
-
rdoc_options:
|
86
|
-
- "--main"
|
87
|
-
- README.rdoc
|
51
|
+
rdoc_options: []
|
88
52
|
require_paths:
|
89
53
|
- lib
|
90
54
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -94,13 +58,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
58
|
version: '0'
|
95
59
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
60
|
requirements:
|
97
|
-
- - "
|
61
|
+
- - ">"
|
98
62
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
100
|
-
requirements:
|
63
|
+
version: 1.3.1
|
64
|
+
requirements:
|
65
|
+
- libdavenport
|
101
66
|
rubygems_version: 3.0.3
|
102
67
|
signing_key:
|
103
68
|
specification_version: 4
|
104
|
-
summary:
|
105
|
-
some before others
|
69
|
+
summary: Ruby binding for the Davenport library
|
106
70
|
test_files: []
|
data/.autotest
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- ruby -*-
|
2
|
-
|
3
|
-
require "autotest/restart"
|
4
|
-
|
5
|
-
# Autotest.add_hook :initialize do |at|
|
6
|
-
# at.testlib = "minitest/unit"
|
7
|
-
#
|
8
|
-
# at.extra_files << "../some/external/dependency.rb"
|
9
|
-
#
|
10
|
-
# at.libs << ":../some/external"
|
11
|
-
#
|
12
|
-
# at.add_exception "vendor"
|
13
|
-
#
|
14
|
-
# at.add_mapping(/dependency.rb/) do |f, _|
|
15
|
-
# at.files_matching(/test_.*rb$/)
|
16
|
-
# end
|
17
|
-
#
|
18
|
-
# %w(TestA TestB).each do |klass|
|
19
|
-
# at.extra_class_map[klass] = "test/test_misc.rb"
|
20
|
-
# end
|
21
|
-
# end
|
22
|
-
|
23
|
-
# Autotest.add_hook :run_command do |at|
|
24
|
-
# system "rake build"
|
25
|
-
# end
|
data/Manifest.txt
DELETED
data/test/test_davenport.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require "minitest/autorun"
|
2
|
-
require "davenport"
|
3
|
-
|
4
|
-
class TestDavenport < Minitest::Test
|
5
|
-
def test_sanity
|
6
|
-
refute_nil(Davenport::VERSION)
|
7
|
-
end
|
8
|
-
|
9
|
-
def test_one_ranking
|
10
|
-
node_ct = 4;
|
11
|
-
pg = Davenport::PreferenceGraph.new(node_ct)
|
12
|
-
expected_ranking = [3, 4, 1, 2];
|
13
|
-
pg.add_preference(expected_ranking);
|
14
|
-
assert_equal(expected_ranking, pg.davenport);
|
15
|
-
end
|
16
|
-
|
17
|
-
def test_constructor_type_error
|
18
|
-
assert_raises(TypeError) do
|
19
|
-
Davenport::PreferenceGraph.new(Object.new)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_add_preference_type_error
|
24
|
-
pg = Davenport::PreferenceGraph.new(4)
|
25
|
-
assert_raises(TypeError) do
|
26
|
-
pg.add_preference(Object.new)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def test_add_preference_array_type_error
|
31
|
-
pg = Davenport::PreferenceGraph.new(3)
|
32
|
-
assert_raises(TypeError) do
|
33
|
-
a = [Object.new, Object.new, Object.new];
|
34
|
-
pg.add_preference(a)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_add_preference_array_length_error
|
39
|
-
pg = Davenport::PreferenceGraph.new(3)
|
40
|
-
assert_raises(Davenport::PreferenceGraphCountException) do
|
41
|
-
a = [1, 1];
|
42
|
-
pg.add_preference(a)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def test_ranking_two
|
47
|
-
pg = Davenport::PreferenceGraph.new(4)
|
48
|
-
pg.add_preference([1, 3, 2, 4])
|
49
|
-
pg.add_preference([1, 2, 2, 4])
|
50
|
-
pg.add_preference([2, 1, 3, 4])
|
51
|
-
pg.add_preference([1, 3, 2, 4])
|
52
|
-
assert_equal([1, 3, 2, 4], pg.davenport)
|
53
|
-
end
|
54
|
-
end
|