Designing new borders to optimize happiness in the population of a country

Abstract

In some sovereign states there is a high degree of heterogeneity within the population across different territories. A great source to empirically observe this phenomenon are the election results. In this article we analyse the Spanish general elections results for 2011 to detect the different communities within the Spanish state. We continue describing a model in which we measure the global happiness of the population with the results of the elections. The final section of the article shows an algorithm that is able to optimize the global happiness by more than 11% by creating a few new borders.

Data

The data has been obtained from the official website of the government of Spain. Table 1 shows, how many votes each political party got in each region.

Happiness

We define the happiness of each voter as the representation (or share of votes) that the party he voted for got. Its range is from 0 to 1, higher meaning more happy. For example, if party A gets 70% of the votes, a person who voted for party A will be 0.7 happy.

We then define the happiness of a whole country as the sum of the happiness of each individual. We can calculate this number for the country of Spain given the elections of 2011 and the result is 7,570,311.

We can express this mathematically. The respresentation of party p is.

Where Vij is the number of votes of party i and region j.

The we can calculate the total happiness of a country as.

It's easy to see that with the previous definition, a country with more consensus will be happier than a heterogeneous one. It is possible however, to create borders to split a heterogeneous state into more than one homogeneous smaller states. In the next section we present an algorithm that will let us do it efficiently.

To calculate the happiness of several states, we just calculate the happiness of each state and we add them up.

Optimizing happiness

We use the method of Extremal optimization for this task. We keep a vector S with as many elements as regions. The i-th element of the vector contains the state the region i belongs to. At the beginning of the algorithm, all the elements of the vector are set to 0, wich means that all the regions belong to the same state. Then we search for the region that would yield to the highest happiness if it belonged to a different state (by setting the correspoding element of S to 1). Next, we repeat the process to find a second region that will join the first into the newly created state that will also optimize the happiness. Then we try with a 3rd region. The process goes on until there is no improvement possible for the happiness measure.

This is the pseudo code of the algorithm.

S = [0,0,...,0]
h0 = happiness(V,S)
maxi = 0
while maxi != -1
	maxi = -1
	maxhappiness = happiness(V,S)
	for i = 0 to numregions
		S[i] = 1
		h1 = happiness(V,S)
		if h1 > maxhappiness
			maxi = i
		S[i] = 0		

The python code for the program is available at main.py. You will also need the data.

Results

When we execute our algorithm with the data, we observe that a new state has been created with the Provinces of Barcelona, Girona, Tarragona, Lleida, Bizkaia, Gipuzkoa and Álava that correspond to the Automous Communities of Catalonia and Basque Country [Figure 1]. And this new partition would yield a happiness of 8,196,354, which is more than a 8% increase. The problem is that the new state is not connected.

We can rerun the algorithm to generate another state. In this case we find that the previously created state has been divided into two, each one containing the Autonomous Communities of Catalonia and Basque Country [Figure 2]. Now the happiness is 8,412,420 which is more than 11% increase over the single state.

If we create yet another state. We will separate the regions of Sevilla, Asturias, Jaén, Córdoba, Huelva, Granada, Badajoz, Cádiz, Zaragoza, Cáceres and Huesca [Figure 3]. This new state would generate a happiness of 8,483,369 wich is an increase of 12% wich is not very different from the previous result. Besides, this new state is disconnected with 3 components.

Conclusion

We have proposed a simple model to calculate happiness in a country based on eletoral results. Next, we designed a strategy to increase this happiness by splitting a heterogeneous country into several homogeneous smaller countries. We apply our approach using 2011 Spanish electoral data, and we find that creating two new connected states increases the happiness of the population by more than 11%.

Figures and Tables

Figure 1

Figure 2

Figure 3

Table 1

Provincia PP PSOE CIU IU AMAIUR UPYD PNV ERC BNG
Albacete 127995 69981 14324 11614
Alicante 489946 239318 57677 49662
Almería 180249 93495 16445 12225
Araba/Álava 46034 39698 6917 32439 4662 31931
Asturias 223906 185526 83755 24721
Ávila 65600 24278 4803 8217
Badajoz 207068 153692 24344 14174
Illes Balears 217327 126512 21668 18525
Barcelona 547376 727220 710178 237327 33111 169601
Bizkaia 113401 136853 24205 122796 10886 208683
Burgos 116057 59878 11892 16090
Cáceres 132169 92822 13422 8739
Cádiz 291897 203251 54262 29761
Cantabria 183244 88624 12608 12614
Castellón 156683 87657 15692 12008
Ciudad Real 164776 95375 16116 13106
Córdoba 209067 170367 46066 17998
A Coruña 343270 182056 30557 8812 77945
Cuenca 69939 41293 5968 4468
Gipuzkoa 51362 78462 12595 130055 5734 83703
Girona 49617 65674 120156 16777 1798 33000
Granada 237785 185867 40360 26255
Guadalajara 71362 36589 9036 9947
Huelva 115651 106835 18532 9048
Huesca 58435 40721 9937 5408
Jaén 183339 165348 28059 13727
León 152672 100210 15598 13672
Lleida 37401 39157 79511 7487 1069 16529
Lugo 121422 61357 6554 2020 19811
Madrid 1719709 878724 271209 347354
Málaga 357578 227463 64969 40407
Murcia 471851 154225 41896 45984
Navarra 126516 72892 18251 49208 6829
Ourense 115796 57340 4757 1677 19054
Palencia 58759 33328 6259 4686
Las Palmas 240897 123486 19971 13208
Pontevedra 284079 156880 25834 7460 67227
La Rioja 95124 54066 7995 10367
Salamanca 128887 56331 9256 13276
Santa Cruz de Tenerife 205221 107600 20152 11316
Segovia 52173 24780 5237 6889
Sevilla 410046 442267 91519 58502
Soria 28063 16066 2385 2190
Tarragona 81977 90496 105846 18561 3672 25724
Teruel 39993 25426 6103 2656
Toledo 220474 112568 22373 19089
Valencia 743604 370499 96417 84394
Valladolid 172671 94521 24223 23536
Zamora 68228 35059 6161 4641
Zaragoza 241074 158167 58904 32968
Ceuta 20968 6445 576 1061
Melilla 17828 6766 992