Skip to content

Commit

Permalink
Updates after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon-Rey committed Apr 18, 2024
1 parent a246664 commit e3122fe
Show file tree
Hide file tree
Showing 38 changed files with 14,072 additions and 230 deletions.
2 changes: 1 addition & 1 deletion docs/_modules/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<link rel="preload" as="script" href="../_static/scripts/bootstrap.js?digest=e353d410970836974a52" />
<link rel="preload" as="script" href="../_static/scripts/pydata-sphinx-theme.js?digest=e353d410970836974a52" />

<script src="../_static/documentation_options.js?v=56240083"></script>
<script src="../_static/documentation_options.js?v=a1e11e36"></script>
<script src="../_static/doctools.js?v=888ff710"></script>
<script src="../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../_static/scripts/sphinx-book-theme.js?digest=5a5c038af52cf7bc1a1ec88eea08e6366ee68824"></script>
Expand Down
4 changes: 3 additions & 1 deletion docs/_modules/pabutools/rules/mes/mes_rule.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<link rel="preload" as="script" href="../../../../_static/scripts/bootstrap.js?digest=e353d410970836974a52" />
<link rel="preload" as="script" href="../../../../_static/scripts/pydata-sphinx-theme.js?digest=e353d410970836974a52" />

<script src="../../../../_static/documentation_options.js?v=56240083"></script>
<script src="../../../../_static/documentation_options.js?v=a1e11e36"></script>
<script src="../../../../_static/doctools.js?v=888ff710"></script>
<script src="../../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="../../../../_static/scripts/sphinx-book-theme.js?digest=5a5c038af52cf7bc1a1ec88eea08e6366ee68824"></script>
Expand Down Expand Up @@ -680,6 +680,8 @@ <h1>Source code for pabutools.rules.mes.mes_rule</h1><div class="highlight"><pre
<span class="n">current_alloc</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">skipped_project_eff_support</span> <span class="o">=</span> <span class="nb">max</span><span class="p">(</span>
<span class="n">new_eff</span><span class="p">,</span> <span class="n">current_alloc</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">skipped_project_eff_support</span>
<span class="p">)</span>
<span class="k">if</span> <span class="n">analytics</span><span class="p">:</span>
<span class="n">current_alloc</span><span class="o">.</span><span class="n">details</span><span class="o">.</span><span class="n">iterations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">current_iteration</span><span class="p">)</span>
<span class="k">if</span> <span class="n">resoluteness</span><span class="p">:</span>
<span class="n">all_allocs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">current_alloc</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
Expand Down
294 changes: 115 additions & 179 deletions docs/_modules/pabutools/visualisation/visualisation.html

Large diffs are not rendered by default.

27 changes: 23 additions & 4 deletions docs/_sources/usage/outcomevisualisation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ Greedy Utilitarian Welfare

The visualisation for the Greedy Utilitarian Welfare currently works only on additive utility functions.

We provide a way to visualise the results using the class :py:class:`~pabutools.visualisation.visualisation.GreedyWelfareVisualiser`. Note the analytics flag in the function :py:func:`~pabutools.rules.greedywelfare.greedy_utilitarian_welfare` must be set to True to generate the visualisation.
We provide a way to visualise the results using the class
:py:class:`~pabutools.visualisation.GreedyWelfareVisualiser`. Note the analytics flag in the
function :py:func:`~pabutools.rules.greedywelfare.greedy_utilitarian_welfare` must be set to True to
generate the visualisation.

.. code-block:: python
Expand All @@ -36,10 +39,21 @@ The visualisation will be saved in the specified path as a standalone HTML file

Note that the visualisation is only available for additive utility functions.

An example of the generated visualisation can be found
`here <../outcome_vis_ex_greedy.html>`__.

Method of Equal Shares
----------------------

We provide a way to visualise the results using the class :py:class:`~pabutools.visualisation.visualisation.MESVisualiser`. Note the analytics flag in the function :py:func:`~pabutools.rules.mes.method_of_equal_shares` must be set to True to generate the visualisation. The visualisations for MES consist of two pages: one for the summary of the election, containing the allocation of the budget, information about all the elected projects, and summary statistics about the election as a whole. The second page contains the details of the election, giving statistics about each round of the election, including the selected project, and how each round impacts the effective vote count of others. This captures the essence of the method of equal shares, where the effective vote count of each project is updated after each round.
We provide a way to visualise the results using the class :py:class:`~pabutools.visualisation.MESVisualiser`.
Note the analytics flag in the function
:py:func:`~pabutools.rules.mes.method_of_equal_shares` must be set to True to generate the visualisation.
The visualisations for MES consist of two pages: one for the summary of the election, containing the
allocation of the budget, information about all the elected projects, and summary statistics about
the election as a whole. The second page contains the details of the election, giving statistics
about each round of the election, including the selected project, and how each round impacts
the effective vote count of others. This captures the essence of the method of equal shares, where
the effective vote count of each project is updated after each round.

.. code-block:: python
Expand All @@ -49,12 +63,17 @@ We provide a way to visualise the results using the class :py:class:`~pabutools.
from pabutools.election import Cost_Sat
instance, profile = election.parse_pabulib("./{path_to_election_file}.pb")
outcome = method_of_equal_shares(instance, profile, sat_class=Cost_Sat analytics=True)
outcome = method_of_equal_shares(instance, profile, sat_class=Cost_Sat, analytics=True)
# The visualiser takes the profile, instance, and outcome as arguments
visualiser = MESVisualiser(profile, instance, outcome)
# name is optional and defaults to the empty string
visualiser.render("./{path_to_output_file}/", name="{name}")
The visualisations will be saved with the filenames {name}_summary.html and {name}_round_analysis.html respectively in the specified path. These work as standalone HTML files, and must be stored in the same directory to ensure the links between different pages work correctly.
The visualisations will be saved with the filenames {name}_summary.html and
{name}_round_analysis.html respectively in the specified path. These work as standalone HTML files,
and must be stored in the same directory to ensure the links between different pages work correctly.

An example of the generated visualisation can be found
`here <../outcome_vis_ex_mes_summary.html>`__.
2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const DOCUMENTATION_OPTIONS = {
VERSION: '1.1.6',
VERSION: '1.1.7',
LANGUAGE: 'en',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
2 changes: 1 addition & 1 deletion docs/genindex.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=e353d410970836974a52" />
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=e353d410970836974a52" />

<script src="_static/documentation_options.js?v=56240083"></script>
<script src="_static/documentation_options.js?v=a1e11e36"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?digest=5a5c038af52cf7bc1a1ec88eea08e6366ee68824"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=e353d410970836974a52" />
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=e353d410970836974a52" />

<script src="_static/documentation_options.js?v=56240083"></script>
<script src="_static/documentation_options.js?v=a1e11e36"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?digest=5a5c038af52cf7bc1a1ec88eea08e6366ee68824"></script>
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<link rel="preload" as="script" href="_static/scripts/bootstrap.js?digest=e353d410970836974a52" />
<link rel="preload" as="script" href="_static/scripts/pydata-sphinx-theme.js?digest=e353d410970836974a52" />

<script src="_static/documentation_options.js?v=56240083"></script>
<script src="_static/documentation_options.js?v=a1e11e36"></script>
<script src="_static/doctools.js?v=888ff710"></script>
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
<script src="_static/scripts/sphinx-book-theme.js?digest=5a5c038af52cf7bc1a1ec88eea08e6366ee68824"></script>
Expand Down
Binary file modified docs/objects.inv
Binary file not shown.
Loading

0 comments on commit e3122fe

Please sign in to comment.