Created
October 8, 2020 05:41
-
-
Save willingc/dc56d5d11b741e78859e589a59523821 to your computer and use it in GitHub Desktop.
Quorum
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# Quorum and governance" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 56, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"from math import ceil" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 61, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"QUORUM_PERCENTAGE = 0.30\n", | |
"SIMPLE_MAJORITY = 0.5" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 96, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def calculate_majority(group_size=20, quorum_percent=QUORUM_PERCENTAGE):\n", | |
" print(f'Group: {group_size} Quorum: {ceil(group_size * quorum_percent)} Simple majority: {ceil(group_size * quorum_percent * SIMPLE_MAJORITY)}')" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 97, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"groups = [1, 5, 10, 15, 20, 25, 50, 100]" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 98, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Group: 1 Quorum: 1 Simple majority: 1\n", | |
"Group: 5 Quorum: 2 Simple majority: 1\n", | |
"Group: 10 Quorum: 3 Simple majority: 2\n", | |
"Group: 15 Quorum: 5 Simple majority: 3\n", | |
"Group: 20 Quorum: 6 Simple majority: 3\n", | |
"Group: 25 Quorum: 8 Simple majority: 4\n", | |
"Group: 50 Quorum: 15 Simple majority: 8\n", | |
"Group: 100 Quorum: 30 Simple majority: 15\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"[None, None, None, None, None, None, None, None]" | |
] | |
}, | |
"execution_count": 98, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"quorum_percent = 0.30\n", | |
"[calculate_majority(group, quorum_percent) for group in groups] " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 99, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Group: 1 Quorum: 1 Simple majority: 1\n", | |
"Group: 5 Quorum: 1 Simple majority: 1\n", | |
"Group: 10 Quorum: 2 Simple majority: 1\n", | |
"Group: 15 Quorum: 3 Simple majority: 2\n", | |
"Group: 20 Quorum: 3 Simple majority: 2\n", | |
"Group: 25 Quorum: 4 Simple majority: 2\n", | |
"Group: 50 Quorum: 8 Simple majority: 4\n", | |
"Group: 100 Quorum: 15 Simple majority: 8\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"[None, None, None, None, None, None, None, None]" | |
] | |
}, | |
"execution_count": 99, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"quorum_percent = 0.15\n", | |
"[calculate_majority(group, quorum_percent) for group in groups] " | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment