wbreeze / davenport-ruby

Ruby binding for C Implementation of Davenport's algorithm
GNU Lesser General Public License v3.0
0 stars 0 forks source link

= davenport

home :: https://github.com/wbreeze/davenport-ruby code :: https://github.com/wbreeze/davenport-ruby rdoc :: FIX (url) bugs :: https://github.com/wbreeze/davenport-ruby/issues C-lib :: https://github.com/wbreeze/davenport

== DESCRIPTION:

A ranking is a partial order that, given some set of alternatives, places some before others. A preference graph, given some number of rankings, expresses the combination of all of those rankings. It is a directed, weighted graph in which the nodes represent the alternatives and the edges represent preferences.

Use this to build a preference graph from individual rankings and compute a Kemeny order, aggregated preference that minimizes the number of pair-wise disagreements with the individual rankings.

This is a Ruby binding built around a C language implementation of Davenport's algorithm, found on github at {wbreeze/davenport}[https://github.com/wbreeze/davenport]

== FEATURES/PROBLEMS:

Please see https://github.com/wbreeze/davenport-ruby/issues for a list of any issues and add your own there, or contact the author.

== SYNOPSIS:

pg = Davenport::PreferenceGraph.new(4)
pg.add_preference([1, 3, 2, 4]);
pg.add_preference([1, 2, 2, 4]);
pg.add_preference([2, 1, 3, 4]);
pg.add_preference([1, 3, 2, 4]);
pg.davenport
=> [1, 3, 2, 4]

The single array parameter for add_preference has a rank number for the item at the corresponding index. For example, with four items, [1, 2, 2, 4] assigns rank 1 to the first item, 2 to the second and third items, and 4 to the final item. The preference, [2, 2, 2, 1] ranks the last item first and all of the others equally after it.

== REQUIREMENTS:

See .ruby-version for the version of Ruby used in development.

This requires the Davenport library installed according to {wbreeze/davenport}[https://github.com/wbreeze/davenport]

== INSTALL:

gem install davenport

== DEVELOPERS:

After checking out the source, run:

$ rake newb

This task will install any missing dependencies, run the tests/specs, and generate the RDoc.

== LICENSE:

GNU Lesser General Public License v3 (LGPL-3.0)

See the file, {LICENSE}[https://github.com/wbreeze/davenport-ruby/blob/master/LICENSE] for the full text.

Copyright (c) 2019 Douglas Lovell