# Optimal apportionment

Optimal apportionment is an approach to apportionment that is based on mathematical optimization.
In a problem of apportionment, there is a resource to allocate, denoted by $h$. For example, it can be an integer representing the number of seats in a house of representatives. The resource should be allocated between some $n$ agents. For example, these can be federal states or political parties. The agents have different entitlements, denoted by a vector of fractions $t_{1},\ldots ,t_{n}$ with a sum of 1. For example, t$_i$ can be the fraction of votes won by party i. The goal is to find an allocation - a vector $a_{1},\ldots ,a_{n}$ with $\sum _{i=1}^{n}a_{i}=h$.
The ideal share for agent i is his/her quota, defined as $q_{i}:=t_{i}\cdot h$. If it is possible to give each agent his/her quota, then the allocation is maximally fair. However, exact fairness is usually unattainable, since the quotas are not integers and the allocations must be integers. There are various approaches to cope with this difficulty (see mathematics of apportionment). The optimization-based approach aims to attain, for eacn instance, an allocation that is "as fair as possible" for this instance. An allocation is "fair" if $a_{i}=q_{i}$ for all agents i, that is, each agent's allocation is exactly proportional to his/her entitlement. in this case, we say that the "unfairness" of the allocation is 0. If this equality must be violated, one can define a measure of "total unfairness", and try to minimize it.

## Minimizing the sum of unfairness levels

The most natural measure is the sum of unfairness levels for individual agents, as in the utilitarian rule:$^{:102–104}$
* One can minimize the sum of differences $\sum _{i=1}^{n}|a_{i}-q_{i}|$, or the sum of squares $\sum _{i=1}^{n}(a_{i}-q_{i})^{2}$, which weight every state (or party) equally. Both minimization problems are solved by Hamilton's method.
* One can weight the elements in the sum by the population, or equivalently by the quota, and try to minimize the chi-squared statistic $\sum _{i=1}^{n}q_{i}(a_{i}/q_{i}-1)^{2}$. This leads to Webster's method.
* One can weight the elements in the sum by the allocations, and try to minimize $\sum _{i=1}^{n}a_{i}(q_{i}/a_{i}-1)^{2}$. This leads to Hill's method.

## Minimizing the largest unfairneses

One can minimize the largest unfairness, as in the egalitarian rule:
* One can minimize $\max _{i=1}^{n}|q_{i}/a_{i}-1|$, and proceed to minimize the next-largest unfairness etc., using the leximin order. This yields a method called the leximin apportionment method. It was first developed by Biro, Koczy and Sziklai, who presented an efficient algorithm to compute it. Its main goal is to satisfy the requirement of the Venice Commission that the maximum departure from equal distribution of items among agents should be as small as possible. Its disadvantage is that it violates the quota rule and all monotonicity criteria.
* Burt and Harris (1963) suggested to minimize $\max _{i,j=1}^{n}|q_{i}/a_{i}-q_{j}/a_{j}|$.
* Minimizing $\max _{i=1}^{n}q_{i}/a_{i}$ leads to Adams's method.
* Minimizing $\max _{i=1}^{n}a_{i}/q_{i}$ leads to Jefferson's method.
* It is also possible to maximize $\min _{i=1}^{n}(a_{i}-q_{i})$, or equivalently, minimize $\max _{i=1}^{n}(q_{i}-a_{i})$. This method satisfies both quotas.
* The minimax method can be generalized to any chosen priority ordering on the fairness criteria.