class svvamp.GeneratorProfileEuclideanBox(n_v, n_c, box_dimensions, shift=None, sort_voters=False)[source]

Profile generator using the ‘Euclidean box’ model.

Parameters:
  • n_v (int) – Number of voters.

  • n_c (int) – Number of candidates.

  • box_dimensions (list or ndarray) – 1d array of numbers. The length of the Euclidean box along each axis.

  • shift (list or ndarray) – 1d array of numbers, same dimension as box_dimensions. Shift for the mean position of the candidates.

  • sort_voters (bool) – This argument is passed to Profile.

Notes

Denote n_dim the number of elements in box_dimensions. For each voter and each candidate, a position is independently and uniformly drawn in a rectangular box of dimensions box_dimensions[0],… , box_dimensions[n_dim - 1]. If shift is used, the distribution of positions for candidates is displaced by this vector.

Let d[v, c] denote the Euclidean distance between voter v and candidate c. Then preferences_ut[v, c] = A - d[v, c], where A is such that the average utility is 0 over the whole profile.

Remark: if n_dim = 1, then the profile is single-peaked.

Examples

>>> generator = GeneratorProfileEuclideanBox(n_v=10, n_c=3, box_dimensions=[1])
>>> profile = generator()
>>> profile.preferences_rk.shape
(10, 3)