Skip to content

Conversation

@rafasu4
Copy link

@rafasu4 rafasu4 commented Jan 25, 2023

No description provided.

@rafasu4
Copy link
Author

rafasu4 commented Jan 25, 2023

Consensus Under Deadline algorithm in pure python, followed by the following article: https://arxiv.org/abs/1905.07173

@rafasu4
Copy link
Author

rafasu4 commented Jan 31, 2023

@the-maldridge hi Michael!
I would really appreciate for your notes on the PR, as I'm invested in it and would love to contribute. Further more, this is part of my class grade, so it would really help me if you could take a time for reviewing this PR :)
Thanks!

@the-maldridge
Copy link
Owner

I appreciate the deadlines you are under, but be aware that the open source world moves on a timeline completely divorced from that of academia. I will get to this PR as I have time. Please do not close it and open a new one, git has mechanisms for pushing state changes when conflicts exist.

@@ -0,0 +1,394 @@
import doctest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file should start with a title containing the article name and link, author names, programmer name, and date.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match the style of any of the other files. I will accept a header linking the arxiv papger, but the other information is to be dropped. You may add relevant names to the contributors file at the root of the repo.

@@ -0,0 +1,127 @@
from py3votecore.consensus_under_deadline import ConsensusUnderDeadline, mdvr
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The file should start with a title containing the article name and link, author names, programmer name, and date.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the other file, no it shouldn't. This should match the style of other files in the repo (i.e. GPL header), or I will accpet a very short header that includes the link to the Arxiv reference document.

from collections import Counter


logging.basicConfig(level=logging.DEBUG)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Global logging configuration should not be set in a unit - only in the main program

Copy link
Owner

@the-maldridge the-maldridge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of small issues. Also you will eventually need to perform a rebase and squash to make your PR one functional change without all the intermediate steps. See individual comments for each item.

@@ -0,0 +1,394 @@
import doctest
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match the style of any of the other files. I will accept a header linking the arxiv papger, but the other information is to be dropped. You may add relevant names to the contributors file at the root of the repo.

Returns:
The winner alternative

---------------------------------TESTS---------------------------------
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As near as I can tell the mdvr function is dead code that exists solely to make these tests work. If you want to write an example, it should go into the class docstring. If you want to write an integration test, it should go into an integration test that's part of a different component.

The model was presented by Marina Bannikova, Lihi Dery, Svetlana Obraztsova, Zinovi Rabinovich, Jeffrey S. Rosenschein (2019),
https://arxiv.org/abs/1905.07173

Author: Raphael Suliman
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Migrate authorship information to the CONTRIBUTORS file at the root of the repo.


class ConsensusUnderDeadline():
'''
A class representing a model for group decision making under strict deadline, based on iterative process. Each alternative must be accept
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line wrapping here looks funky. You probably need to reflow this block comment to bring it into the expected line width I see you have used elsewhere in the file.

remaining_rounds - a threshold for the amount if rounds left until decision should be taken
random_selection - whether the selection of voter for changing their ballot. If False - the smallest voter's number will be selected
'''
logger.info('ConsensusUnderDeadline object created')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be at debug, possibly even trace priority, definitely not info.

>>> print(cud.deploy_algorithm())
null
'''
logger.info('deploying algorithm')
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, debug priority at most, this log line probably shouldn't even happen.

'''
Lower round by one - symbolize a passing iteration.

---------------------------------TESTS---------------------------------
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in a block comment? This shouldn't be here.

Returns:
List of alternatives with a chance to win

---------------------------------TESTS---------------------------------
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This really looks like you're embedding what should have been automated integration tests into the docstrings. doctests is meant to ensure that your examples work, not to serve as your general purpose test framework.

@@ -0,0 +1,127 @@
from py3votecore.consensus_under_deadline import ConsensusUnderDeadline, mdvr
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As with the other file, no it shouldn't. This should match the style of other files in the repo (i.e. GPL header), or I will accpet a very short header that includes the link to the Arxiv reference document.

self.assertEqual(mdvr(voters=v, voters_type = v_type, alternatives=alters, default_alternative=df_alter,voters_preferences=[['a', 'b', 'c', 'd'], ['a', 'c', 'b', 'd'], ['a', 'c', 'b', 'd'], ['a', 'b', 'c', 'd'], ['a', 'b', 'd', 'c']], remaining_rounds=t, random_selection=False), 'a') # test case with unanimously on the start

if __name__ == '__main__':
unittest.main() No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing final newline. This is usually a configuration problem with your editor.

@the-maldridge
Copy link
Owner

Also note that at this time I have not yet reviewed the conformance of the implemented algorithm against the workflow discussed in the linked reference material. I made a first pass review of the code, and I will make an additional review pass for the actual results of the algorithm.

@the-maldridge the-maldridge changed the title Structure changes Consensus Under Deadline Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants