distance_to(root,
ranks,
elim_order,
timeout)
| source code
|
Compute the distance_to function from Magrino et al.
This formulation differs from Magrino et al. in three ways.
-
The y_S variables are all removed so all that remains are p_S and
m_S;
-
The constraints on the p_S and m_S are replaced with simple bounds;
and
-
The objective function changed for the new definition of margin.
3 is the most important. The original objective function was sum_S
p_S. We want sum_{S != ()} (p_S + m_S). This works, but seems to be
horribly inefficient. Using sum_S p_S = sum_S m_S, we can rewrite this as
2*sum_{S != ()} m_S - p_{()} + m_{()}.
- Parameters:
root (Node) - Root of the ballot tree.
ranks (number) - The maximum number of candidates a voter can rank.
elim_order (list) - The elimination order we would like.
timeout (number) - The computation timeout.
- Returns: number
- Returns -1 on timeout. Otherwise, it returns the margin.
|