Aggregation

Serial Approval Vote Election

Aggregation of Voter Ideals (in 2D)

In this explorable, Figure 1, we look into possible ways of reasonably aggregating voter preferences. In real life, no individual voter or group of voters is ever likely to have complete information. Simulations, like this explorable, however, do allow access to complete information of voter (agent) preferences. The idea we explore here is a working definition of the best possible outcome.

The hope we have is that if we can use complete information to find an ideal outcome for a collective choice in a simulation environment where we have total knowledge, we can test collective choice procedures in the environment using voting agents with data on their own individual preferences and limited information about prior voting outcomes and see if the procedures can reliably deliver outcomes close enough to the theoretical ideal outcomes.

Try it out yourself

Simulation controls reference ,,fold,,

The aggregation controls are a bit more complicated than prior explorables, so they are broken out into sections:

Electorate creation controls ,,fold,,

Electorate PRNG
A radio button control to select the pseudo random number source. The choices are:
random
The Math.random() function from the browser's JavaScript implementation. This PRNG does not use and accessible seed.
(no term)
The next four PRNGS do accept and report seeds. The source code for all four is available, and for this type of light simulation, all four PRNGs are reasonable. More importantly, they allow reproduction of process and results.
sfc32, mulberrry32, xoshiro128ss, jsf32
controllable PRNGs
Seed
A string used to reproduce an electorate when uses with the correct PRNG, and settings.
Initial Motions
The number of motions to create.
Initial Voters
The number of voters to create.
Uniform electorate
button to create a uniform distribution electorate.
Normal electorate
button to create a normal distribution electorate.
Cycle election
button to create an electorate with \(100\) voters, \(3\) motions, using a constrained uniform distribution such that the electorate and motions will have a Condorcet cycle. Note: This button will change the initial motions and voters values (to \(3\) and \(100\) respectively), and will vary its behavior depending on the metric in effect at invocation. The cycle is only guaranteed for the initially active metric.
Hide voters
This is a button toggle that will hide voters when clicked while they are visible, and reveal voters when they are hidden. (This is not strictly part of electorate creation grouping, but has not yet been repositioned.)
lock data
When checked, this prevents manual repositioning or altering of motions or voters. It is useful when dealing with seeds to make sure no accidental movements will change an electorate or motion set.
Metric
There are three basic metrics available, and each may be used with or without weights. The metrics are:
\(L^1\), \(L^2\), \(L^{infty}\)
respectively, taxicab, Euclidean, and Chebyshev.
Use weights
This checkbox controls whether weights will be used or not with whichever basic metric is current.

Position and edit controls ,,fold,,

Select/Edit type(s)
Examining and modifying data
Motion
When checked allows selection of a motion by click
Voter
When checked allows selection of a voter by click
select index
When exactly one of Motion or Voter is checked, enables selection by index.
Item
Displays the identity of the selected item, sprite or none.
X
The X coordinate value for Item.
Y
The Y coordinate value for Item.
Avg. dist
When motion is selected, show the average distance between the motion and all voters.
X wt
When voter is selected and Use weights is checked, shows the weights for the selected voter.
Add
When lock data is not set, and exactly one of Motion or Voter is checked, click to add a new item of the selection type.
Delete
When lock data is not set, click to delete the selected item.
Add best motion
When lock data is not set, click to add or select the best possible motion.

Aggregation graphics controls ,,fold,,

Optional displays
Display options marked with an asterisk (*) have different behavior when items are selected and consider selection is checked. These displays have a base behavior when not considering selection or when nothing is selected. Special behavior when an item is selected and considered will depend on the item selected.
distance heat map *
Base: show an average distance heat map from the aggregate electorate. Voter considered: show the distance from the voter.
indifference curves *
Base: show all indifference curves from all voters through all motions. Motion: show all voter indifference curves through selected motion. Voter: show selected voter's indifference curves through all motions.
fill
When checked, indifference curves are shown as partially transparent disks and no borders.
weightless regions
When checked, show the sets of points equidistant from pairs of motions under the current metric without weights.
grid gradients *
Base: show a grid of gradient vectors for the entire electorate. Voter: show the gradient grid contribution of the selected voter.
motion gradients *
Base: show a gradient vector for the entire electorate at each motion. Voter: show the gradient contribution from the selected voter at all motions.
distance descent lines
Show the average distance descent lines (start and end points from the paths) from eight start points (two from each edge) to a point of minimum average distance. Depending on the metric and electorate, these lines may not converge.
paths
When checked, show the full distance descent paths.
gradient descent lines
Show the gradient descent lines (start and end points from the paths) from eight start points (corners and mid-points of edges) to a point of zero gradient. Depending on the metric and electorate, these lines may not converge.
paths
When checked, show the full gradient descent paths.
gradient-zero boundary
Show a boundary around the zero gradient region.
tournament *
Base: show the tournament overlay for the electorate and motions. Motion: show only the arrows starting or ending at the selected motion. Voter: show the tournament counting only the voter of the selected voter
* consider selection
When checked, pay attention to the current selected item where it is relevant to the display.

Electorate creation report ,,fold,,

The electorate creation report is the header just above the graphics field that initially reads:

Electorate: R, unseeded, m:3, v:5, U, L2w

This string encodes the default electorate creation settings for the initial electorate created when the page is loaded. This area of the page is updated whenever an electorate is created, or when the data is manually changed. The string is parsed as follows:

Electorate:
The label text for the electorate creation string. (Other explorables can have different or multiple setting strings.)
R
The first character indicates the PRNG used. There are five possible values: R for random, S for sfc32, M for mulberry32, X for xoshiro128ss, and J for jsf32.
unseeded
This is the value of the seed used, or when the PRNG flag is R as it is here the word unseeded. when the PRNG is not random, this field will either contain the supplied seed as single quoted text, or the generated seed which will be a number in single quotes. The number is the creation time in the form of milliseconds since 1-Jan-1970, UTC, or something larger than '1767270739413' (which occurred on 1-Jan-2026). It is probably safe to use Unicode, but I've generally stuck with ASCII. When copying a string, be sure to include everything inside the outer single quotes but not the outer single quotes themselves.
m:3
This is the number of initial motions. The value can be any integer between \(0\) and \(5\), inclusive.
v:5
This is the number of initial voters. The value can be any integer between \(1\) and \(100\), inclusive.
U
This is the code for the button pressed to create the electorate. It can be U for a uniform distribution, N for a normal distribution, or C for a cycle election.
L2w
This encodes the metric setting at the time the electorate was created. The code here does not use the superscript because it is not clear how a superscript is going to come out of a copy and paste process. As is probably obvious, L2w means set the \(L^2\) radio button and check the Use weights checkbox. L1 and L1w mean set the \(L^1\) radio, and L∞ and L∞w mean set the \(L^{\infty}\) radio button. When there is a final 'w' at the end of the metric, check the Use weights checkbox. Otherwise don't. Note: When has a C for the cycle election, the metric and use weights settings are critical. Otherwise they can be ignored.

Note: If the electorate creation report ends in (modified), it means the electorate data was changed after it was created. This means it may not be possible to recreate the current state of the electorate without knowing how the data was modified. Also, nothing with the R PRNG flag or the unseeded designation can be recreated without very extensive external records.

Field of view controls ,,fold,,

The Pan and Zoom controls can be thought of as positioning a camera over the display field. The arrows move the camera in the indicated direction, which cause the contents of the screen to move in the opposite direction. The plus sign causes the camera to move closer to the field or zoom in, making the items in the field of view grow larger and move out of view. The minus sign causes the camera to pull away from the field, making the details smaller and pulling in items that were out of the field of view. The circular arrow is a reset, moving the camera to its original position.

Pan and Zoom Controls
The Pan and Zoom controls include buttons for moving the point of view in increments and numeric input for finer control.
Arrow buttons
The buttons have arrows pointing left, up, right, and down, and those are the directions the camera moves when they are clicked. The distance the camera moves each click is about \(1/40^{th}\) of the way across the field.
Plus and Minus buttons
These are the zoom in (plus) and zoom out (minus) controls. Each plus click increases the magnification by a factor of \(1.25\). Each minus click reduces the magnification by a factor of \(0.80\).
Counter-clockwise Arrow button
This is the reset button. It moves the camera back over the center of the field to the origin, and restores the magnification setting to \(1\).
Center X and Y
These are both output fields showing the current position of the camera and input fields letting you position the camera directly over a point or element.
Mag
This is the magnification output field showing its current value, and an input field for making changes.

What IS the best possible election result?

null.svg

Figure 1: An electorate with motions to choose from using various metrics, and how voter preferences aggregate. (No caption updates here. Look at the control settings.)

Details on electorate creation ,,fold,,

This explorable introduces a choice for the electorate PRNG. The default is the Math.random() function native to JavaScript. JavaScript does not provide a way to set or record the underlying PRNG state, which means there is no easy way to repeat an electorate. These public domain PRNG implementations (from https://github.com/bryc/code/blob/master/jshash/PRNGs.md) can be selected to allow repeating electorates when desired. There should be no visible behavior differences between the PRNGs when the seed field is empty.

Electorate creation is triggered by clicking one of the Uniform electorate, Normal electorate, or Cycle election buttons. The result depends upon the choice of PRNG (with or without seed), the motion and voter counts, and for the Cycle button, the active metric. These settings are recorded in a header preceding the display. Examples of the header include:

  1. "Electorate: R, unseeded, m:3, v:5, U, L2w",
  2. "Electorate: S, '1760269053575', m:4, v:10, N, L1", and
  3. "Electorate: M, 'an arbitrary text seed', m:3, v:100, C, L∞w".

The first example uses the initial default settings for this explorable, namely an R for the random PRNG, unseeded to indicate no seed can be provided, m:3 for \(3\) initial motions, v:5 for \(5\) initial voters, U for a uniform distribution, and L2w for a weighted Euclidean metric.

The second header indicates the sfc32 PRNG, a seed of '1760269053575' (no provided seed triggered the use of the time in milliseconds after midnight, 1-Jan-1969 UTC to be used, that number translates to 575 milliseconds after 11:37:33 UTC, 12-Oct-2025), \(4\) motions, \(10\) voters, a normal distribution, and the unweighted taxicab metric.

The third heading shows the mulberry32 PRNG, the seed 'an arbitrary text seed' (without the surrounding single quotes), \(3\) motions, \(100\) voters, cycle election and weighted Chebyshev metric.

If you configure your controls to match the header string (assuming the string does not include "R, unseeded,") you should get an exact match of the prior electorate.

If you are trying to work with a reproducible electorate, be sure to check the lock data checkbox to prevent any accidental modifications of the desired data.

Details on the various display options ,,fold,,

This section describes the various display options controlled by the checkboxes in the control section. Some of these options have slightly different behavior when a voter or motion is selected and the final option, consider selection is checked.

  • distance heat map * : The difference heat map fills the display area with squares that vary from light to dark based on the average distance of the center of the square and the voters. When the viewpoint is changed, the values are recalculated and the colors are scaled so the worst distance in the region remains the darkest, and the best distance remains the lightest.

    When the consider selection option is checked, a selected voter causes the grid coloration to only consider distance to the selected voter. Nothing special happens when a motion is selected.

  • indifference curves * : The indifference curves option shows all the indifference curves for each voter and motion combination. No indifference curve is shown for a voter and that voter's ideal motion because the radius would be zero.

    When the consider selection option is checked, selecting a voter limits the display to only the indifference curves centered on that voter. Selecting a motion limits the display to only the indifference curves that pass through the motion.

    • fill : The fill option affects the display of the indifference curves. Instead of being shown as an empty ellipse, rhombus, or rectangle, the boundary is not shown and the shape is filled with a degree of transparency so that the regions inside the greatest number of indifference curves will be the darkest areas.

      This option only affects how the indifference curves are displayed. The behavior under selection is governed by the indifference curve rules.

  • weightless regions : The weightless regions option draws the lines or paths on which a voter is indifferent between the defining pair of motions. When the metric is unweighted, these lines divide the display into regions in which all voters have the same preference order over the motions. When the metric is weighted the lines are only valid for voters with weight close to 1.
  • grid gradients * : The grid gradients option shows a \(13x13\) grid with a gradient arrow pointing downhill, towards a better collective motion. The arrows show only the direction of the gradient and not the magnitude because the magnitude can vary across several orders of magnitude and trying to scale the value makes the arrows too small to see when they approach the best positions.

    When the consider selection option is checked, a selected voter will cause only the portion of the gradient due that voter to be shown. Nothing special is done when a motion is selected.

  • motion gradients * : The motion gradient option shows the gradient at the position of the motions rather than on a grid. It is otherwise identical to grid gradients, including its behavior when items are selected.
  • distance descent lines : The distance descent lines option shows the result of running a hill-climbing algorithm with the goal of reaching the point with the lowest aggregate voter distance. The line start from eight points with two lines starting from each edge. Under most circumstances, the lines converge to the best possible motion position. Non-convergence generally requires unweighted metrics and very few voters. If you want to see this, try an electorate with two voters, then run through the various metric combinations. The descent stops when there are no more steps down, or all the possible steps are too short to worry about. (Too short is less than \(1e-20\) where the display is \(400x400\).)
    • paths : The paths option affects the distance descent lines display in that instead of simply showing a line segment from the start point to the end point of each descent path, the display shows the steps in the traversal.
  • gradient descent lines : The gradient descent lines is again a descent algorithm, but this time it follows the gradient vectors to the best position. The eight start points are at the corners and the midpoints of each edge. In general the gradient descent lines and the distance descent lines should all converge to the same point.
    • paths : As with the paths option subordinate to the distance descent line option, this paths option affects the gradient descent lines display, showing the steps in the traversal.
  • gradient-zero boundary : The gradient-zero boundary option draws a boundary outside the region in which the gradient is effectively zero. In side this region there is no gradient, so the grid gradients and the motion gradients are not significant enough to show a direction, so are not shown. This is also the region in which both the distance and gradient descent lines stop. The actual boundary is a closed path of vertical and horizontal lines with integer coordinates. When there is convergence, the gradient-zero position is a single point, and the boundary is one of a \(1x1\), \(1x2\), \(2x1\) or \(2x2\) depending on whether the convergence point has zero, one, or two integer coordinates.
  • tournament * : The tournament option superimposes a tournament over the motion positions, with an arrow pointing from the winner to the loser of each motion pair, with no line drawn if the two motions tie.

    When the consider selection option is checked, and a motion is selected, only the arrows for the pairs that include the selected motion are shown. Nothing special is done for a selected voter.

  • * consider selection : The consider selection option governs whether any of the other optional displays should act differently when a motion or a voter is currently selected.

Two more things to note:

  • When a motion is selected its average voter-motion distance is displayed next to the motion's position coordinates in the selection section of the control panel.
  • When the Add best motion button is clicked and there is not convergence, a best motion is generated and shown, but to signal that this "best" motion may not be unique, the gradient descent lines are shown, illustrating the lack of complete convergence, and the zero-gradient boundary is displayed to provide a sense where other "best" motions can be found.

Things to look for in this simulation ,,fold,,

The previous simulation, Voter metrics, explores how different metrics affect a voter's preference orders. This simulation explores how voter preferences aggregate.

One of the take-away points here is that while there may not be a generally accepted order for the different motions, there is quite often a very well defined motion position that is collectively best. Finding this electoral collective ideal is possible in this simulation because all the preferences are completely known.

In the real world, and particularly in a voting context, finding this electoral ideal can be difficult. In most cases, with voting systems with only one or two rounds, the best you can do is select the motion that is closer to this unknown ideal than the others.

The main point of this explorable is the idea that, quite often, there is a collective ideal motion. And it may well be possible to design a collective choice procedure that can get acceptably close to that ideal motion.

Author: Thomas Edward Cavin

Created: 2026-01-15 Thu 02:24

Validate