Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICTSA Programming Contest 2009 Legal Cheating in Elections Gordon Pace Claudia Borg Chris Porter.

Similar presentations


Presentation on theme: "ICTSA Programming Contest 2009 Legal Cheating in Elections Gordon Pace Claudia Borg Chris Porter."— Presentation transcript:

1 ICTSA Programming Contest 2009 Legal Cheating in Elections Gordon Pace Claudia Borg Chris Porter

2 Legal Cheating District boundary manipulation to give an unfair advantage, or gerrymandering has a long history…  1812: Governor Elbridge Gerry in Massachusetts drew up a district so distorted geographically, that it was likened to a salamander – ‘better call it a gerrymander’ someone commented!

3 Legal Cheating

4 Gerrymandering works through the wasted vote effect. Why do we not use a more effective electoral system? Arrow’s impossibility theorem from 1951 demonstrates that no voting system can convert individual rankings into a global one – there can be no fair election system.

5 An Example

6 West Gozo PX=80 PY=100 East Gozo PX=120 PY=190 Cirkewwa PX=60 PY=50 St Paul’s PX=70 PY=90 Mosta PX=100 PY=150 Rabat PX=120 PY=140 Valletta PX=240 PY=100 Marsaxlokk PX=100 PY=50 Zurrieq PX=210 PY=100

7 An Example PX elects 7 Variance = 255

8 An Example PX elects 8 Variance = 147

9 An Example PX elects 8 Variance = 141

10 The Programming Task Given:  A set of villages  Connections between villages  Expected voting preferences in each village for the two parties PX and PY  Number of districts to have To return in less than 5 minutes:  A district partitioning such that districts are connected components

11 The Programming Task A good partition is one which:  Maximises the number of seats il-Partit tax- Xurbana (PX) elects; and  Minimises the differences in populations across districts. Ideally there would have been:  A bound on the difference between district populations;  A bound on the distance between villages in a single district.

12 How to Solve It The problem can be shown to be NP- complete (eg via the Knapsack problem). A brute-force solution will only work for small instances. Larger problems require the use of some search heuristic.

13 The Teams 5.Eat Your Apple! David Bailey Andrew Calleja Alan Cassar Stephen Fenech 6.dot Marco Muscat Joseph Borg 7.HND4 Norbert DeBono Matthew Xuereb Andrew Vella 8.CG Andrew Said 9.Village People Darren Demicoli 1.Beeef Alessio Magro Reuben Bartolo Jonathan Caruana 2.Unicus Gianluca Valentino 3.WM James Scicluna Kevin Falzon Ingram Bondin Andrew Gauci 4.iLike Andrew Borg Cardona Michael Debono

14 The Teams Solutions: Beeef Genetic Algorithm: using only selection and mutation (cross- over did not give better results). Chromosome representation: consist of a list of districts, which in turn are composed of a list of villages. Creation: ensures that:  All the villages in a district must belong to the same `island'.  Districts must be connected. Mutation: works by selecting two districts at random and swapping two villages across:  The two districts must belong to the same `island'.  Check that connectivity is not lost by the addition or the removal. Fitness function: Number of PX members elected, variance. Termination: upon convergence.

15 The Teams Solutions: Unicus Heuristic based: The generator worked as follows, repeating as necessary.  Repeat a number of times: Identified the village where PX has the largest majority and population and place in District 1. Identified the village with the largest PY majority and second largest population, and the village with the second largest PX majority and 3rd largest population, both of which had to be connected to each other, and placed them in District 2.  Create a district with the villages with the largest PX and PY majority, and repeat to use up the remaining villages. Repeat this process for all permutations.  Programmed in C using.NET 2.0

16 The Teams Solutions: WM Special case scenarios, a brute-force search and a Montecarlo method were implemented one of which is chosen depending on the problem given. For non-special cases, a measure of the complexity of the graph is estimated and depending on this one of the solutions is chosen based on benchmarking.  Approach 1: Fully enumerative approach, resembling brute force, but with immediate pruning of some impossible candidate solutions  Approach 2: An adaptive Montecarlo based approach with generation of results through analysis of the given accident space and appropriate ranking of resulting candidate solutions A timer ensures a solution in the allotted 5 minutes.

17 The Teams Solutions: iLike Random search: A modified Monte Carlo method, taking features from genetic algorithms Chromosome: District configurations Random generation: Generates random distribution of villages (randomising villages, and placing random separators), and checked for validity Selection:  Fitness: More elected PX MPs or better variance is preferred.  Validity: Checked later for performance reasons Stopping criteria: 100 generations or reaching a long enough plateau (dependant on size of the problem)

18 The Teams Solutions: Eat Your Apple! Preprocessing:  Split the country into separate islands  Each island (based on its population) is assigned a number of districts to be allocated within it. Phase 1: Clustering Algorithm  On each island a clustering algorithm groups villages into districts such that the number of elected PX candidates is maximized.  Starts off a random village, and adds others clustered around the initial village. Phase 2: Genetic Algorithm  A genetic algorithm is applied on the output of the clustering algorithm to generate fitter solutions  Fitness function was global maximization of PX candidate count and a globally minimized PY candidate count.  Assigning more weight to the PX count gave better results.

19 The Teams Solutions:. (dot, tikka) Preprocessing: Splits the problem into 'islands' to support disconnected nodes. Genetic algorithm  Generation: using random starting village and generate a connected district with a modified BFS search.  Fitness function: Number of PX members elected and variance

20 The Teams Solutions: HND4 Developed using C# on.NET framework 2.0 Preprocessing: Separate into different islands. Heuristic search:  Grouping villages where PY dominates and group them in one district if possible  If more districts are still required PX dominant districts are divided into smaller ones.

21 The Teams Solutions: CG Calculate all possible district sizes For each possible combination of sizes:  A district is created starting from a village and proceeding in a BFS manner.  Try to create the remaining districts ensuring no overlap.  Remember the best solution found. Would have liked to add:  Heuristics to merge villages in a pre-analysis phase eg PY- strong villages close to each other.  Use a timer to ensure giving results on time.

22 The Teams Solutions: Village People Genetic algorithm coded in C Chromosome representation: partitions with connected villages Crossover: injects a district into the chromosone Mutation: randomly assigns a village to a district Genetic repair: is used to ensure that the partitions are still valid Fitness function: Sum of the ratio of members elected of party X against party Y, and the inverse of the variance.

23 The Test Problems Set of properties specified for 17 fictitious countries. Each village has:  300 ≤ Voters ≤ 500 Generated randomly before the contest  The ratio between the votes for the parties PX:PY was allowed to could range between 20:80 and 80:20 Generated randomly before the contest  A number of regular map layouts were used. The number of district was chosen so as to ensure an average of 4 villages per district.

24 The Test Problems 8 grid countries: 3x3 to 10x10 AsgvvjfcneSzoxxldneo Lltrdabguo LczktvafojMoawloiblfTgxgmzcaqw CiioesvamfKazucjrgqfHmxfstqddp 198,264 175,144220,91 129,187267,144 218,179 187,120232,232354,106

25 The Test Problems 3 full-mesh grid countries: 3x3, 7x7, 10x10 AsgvvjfcneSzoxxldneo Lltrdabguo LczktvafojMoawloiblfTgxgmzcaqw CiioesvamfKazucjrgqfHmxfstqddp 198,264 175,144220,91 129,187267,144 218,179 187,120232,232354,106

26 The Test Problems 3 circular countries with 10, 20 and 50 villages Asgvvjfcne Szoxxldneo Lczktvafoj Ciioesvamf 198,264 175,144 129,187 187,120 Lvjanqoway Vvjzivqcmq Xasfeuqsyp 165,309 Yisfhxnfvz Imutautvmw 168,156 84,266 Wdyvaxlzyb 214,285 200,227 174,190

27 The Test Problems 3 circular countries with a hub sizes 10, 20 and 50 Asgvvjfcne Szoxxldneo Lczktvafoj Ciioesvamf 198,264 175,144 129,187 187,120 Lvjanqoway Vvjzivqcmq Xasfeuqsyp 165,309 Yisfhxnfvz Imutautvmw 168,156 84,266 Wdyvaxlzyb 214,285 200,227 174,190 Dastautvmw 74,263

28 The Test Problem The biggest problem of them all

29 The Test Problem The biggest problem of them all Malta

30 The Test Problem: Malta

31 An example from real-life: Malta  69 villages  Connectivity based on geographical proximity  Vote distribution based on the results of the last local elections (2006 – 2008) 1  13 districts 1 taken from http://www.maltadata.com/tr-count1.htmhttp://www.maltadata.com/tr-count1.htm

32 The Results: Grids [3x3] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 829.54 8 860.24 11 829.54 11 829.54

33 The Results: Grids [4x4] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 826.54 8 860.24 11 829.54 11 829.54 4x4 13 743.72 N/A15 2126.26 14 2045.46 14 1855.38 14 1201.70 10 1246.64 14 1385.91 14 1557.84

34 The Results: Grids [5x5] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 826.54 8 860.24 11 829.54 11 829.54 4x4 13 743.72 N/A15 2126.26 14 2045.46 14 1855.38 14 1201.70 10 1246.64 14 1385.91 14 1557.84 5x5 20 628.31 N/A24 2462.99 23 2346.45 21 1759.58 21 488.39 22 1644.56 TIME- OUT 22 2086.26

35 The Results: Grids [6x6] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 826.54 8 860.24 11 829.54 11 829.54 4x4 13 743.72 N/A15 2126.26 14 2045.46 14 1855.38 14 1201.70 10 1246.64 14 1385.91 14 1557.84 5x5 20 628.31 N/A24 2462.99 23 2346.45 21 1759.58 21 488.39 22 1644.56 TIME- OUT 22 2086.26 6x6 IN- VALID N/A33 3182.35 TIME- OUT 32 2932.91 30 545.97 23 3596.41 TIME- OUT 29 1583.77

36 The Results: Grids [7x7] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 826.54 8 860.24 11 829.54 11 829.54 4x4 13 743.72 N/A15 2126.26 14 2045.46 14 1855.38 14 1201.70 10 1246.64 14 1385.91 14 1557.84 5x5 20 628.31 N/A24 2462.99 23 2346.45 21 1759.58 21 488.39 22 1644.56 TIME- OUT 22 2086.26 6x6 IN- VALID N/A33 3182.35 TIME- OUT 32 2932.91 30 545.97 23 3596.41 TIME- OUT 29 1583.77 7x7 IN- VALID N/A43 1670.34 TIME- OUT 42 1158.84 30 2862.67 TIME- OUT 39 2655.99

37 The Results: Grids [8x8] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 826.54 8 860.24 11 829.54 11 829.54 4x4 13 743.72 N/A15 2126.26 14 2045.46 14 1855.38 14 1201.70 10 1246.64 14 1385.91 14 1557.84 5x5 20 628.31 N/A24 2462.99 23 2346.45 21 1759.58 21 488.39 22 1644.56 TIME- OUT 22 2086.26 6x6 IN- VALID N/A33 3182.35 TIME- OUT 32 2932.91 30 545.97 23 3596.41 TIME- OUT 29 1583.77 7x7 IN- VALID N/A43 1670.34 TIME- OUT 42 1158.84 30 2862.67 TIME- OUT 39 2655.99 8x8 45 1286.76 N/A51 3200.13 TIME- OUT 47 759.37 41 3921.77 TIME- OUT IN- VALID

38 The Results: Grids [9x9] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 826.54 8 860.24 11 829.54 11 829.54 4x4 13 743.72 N/A15 2126.26 14 2045.46 14 1855.38 14 1201.70 10 1246.64 14 1385.91 14 1557.84 5x5 20 628.31 N/A24 2462.99 23 2346.45 21 1759.58 21 488.39 22 1644.56 TIME- OUT 22 2086.26 6x6 IN- VALID N/A33 3182.35 TIME- OUT 32 2932.91 30 545.97 23 3596.41 TIME- OUT 29 1583.77 7x7 IN- VALID N/A43 1670.34 TIME- OUT 42 1158.84 30 2862.67 TIME- OUT 39 2655.99 8x8 45 1286.76 N/A51 3200.13 TIME- OUT 47 759.37 41 3921.77 TIME- OUT IN- VALID 9x9 58 921.59 N/A64 2627.06 TIME- OUT 61 647.30 51 3848.34 TIME- OUT IN- VALID

39 The Results: Grids [10x10] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 11 829.54 N/A11 829.54 11 1081.46 11 1081.46 11 826.54 8 860.24 11 829.54 11 829.54 4x4 13 743.72 N/A15 2126.26 14 2045.46 14 1855.38 14 1201.70 10 1246.64 14 1385.91 14 1557.84 5x5 20 628.31 N/A24 2462.99 23 2346.45 21 1759.58 21 488.39 22 1644.56 TIME- OUT 22 2086.26 6x6 IN- VALID N/A33 3182.35 TIME- OUT 32 2932.91 30 545.97 23 3596.41 TIME- OUT 29 1583.77 7x7 IN- VALID N/A43 1670.34 TIME- OUT 42 1158.84 30 2862.67 TIME- OUT 39 2655.99 8x8 45 1286.76 N/A51 3200.13 TIME- OUT 47 759.37 41 3921.77 TIME- OUT IN- VALID 9x9 58 921.59 N/A64 2627.06 TIME- OUT 61 647.30 51 3848.34 TIME- OUT IN- VALID 10x10 71 1477.11 N/A77 3028.64 TIME- OUT 77 884.98 74 4552.36 TIME- OUT 73 2022.64

40 The Results: Grids+Diagonal [3x3] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 7 645.46 N/A7 643.58 7 646.30 7 1258.76 6 36.40 5 1163.59 7 719.40 7 645.46

41 The Results: Grids+Diagonal [7x7] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 7 645.46 N/A7 643.58 7 646.30 7 1258.76 6 36.40 5 1163.59 7 719.40 7 645.46 7x7 35 895.96 N/A42 2153.71 TIME- OUT 40 1111.75 45 3749.09 TIME- OUT 39 2693.27

42 The Results: Grids+Diagonal [10x10] BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 3x3 7 645.46 N/A7 643.58 7 646.30 7 1258.76 6 36.40 5 1163.59 7 719.40 7 645.46 7x7 35 895.96 N/A42 2153.71 TIME- OUT 40 1111.75 45 3749.09 TIME- OUT 39 2693.27 10x10 70 1352.75 N/A75 4132.35 TIME- OUT 72 477.99 82 5560.82 TIME- OUT 69 1917.86

43 The Results: Wheels – 10 Villages BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 10 8 235.65 N/A8 235.65 8 235.65 8 1084.11 8 235.65 7 1071.86 8 235.65 8 235.65

44 The Results: Wheels – 20 Villages BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 10 8 235.65 N/A8 235.65 8 235.65 8 1084.11 8 235.65 7 1071.86 8 235.65 8 235.65 20 15 1042.78 N/A16 2066.65 TIME- OUT 14 1972.18 15 983.30 13 898.80 16 1336.61 15 1164.74

45 The Results: Wheels – 50 Villages BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 10 8 235.65 N/A8 235.65 8 235.65 8 1084.11 8 235.65 7 1071.86 8 235.65 8 235.65 20 15 1042.78 N/A16 2066.65 TIME- OUT 14 1972.18 15 983.30 13 898.80 16 1336.61 15 1164.74 50 37 1021.30 N/A39 1876.99 TIME- OUT 39 703.74 35 2748.83 TIME- OUT IN- VALID

46 The Results: Wheels+Hub: 10 Villages BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 10 9 1323.17 N/A9 839.56 9 1086.27 9 1347.51 8 261.67 9 1323.17 9 839.56 9 1323.17

47 The Results: Wheels+Hub: 20 Villages BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 10 9 1323.17 N/A9 839.56 9 1086.27 9 1347.51 8 261.67 9 1323.17 9 839.56 9 1323.17 20 15 2000.66 N/A16 2475.86 14 2404.72 14 2064.76 15 938.33 11 1826.32 16 1519.45 15 2213.36

48 The Results: Wheels+Hub: 50 Villages BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People 10 9 1323.17 N/A9 839.56 9 1086.27 9 1347.51 8 261.67 9 1323.17 9 839.56 9 1323.17 20 15 2000.66 N/A16 2475.86 14 2404.72 14 2064.76 15 938.33 11 1826.32 16 1519.45 15 2213.36 50 36 3073.85 N/A40 3716.95 TIME- OUT 37 1250.92 43 3851.62 TIME- OUT 37 2533.44

49 The Results: Malta BeeefUnicusWMiLike Eat Your Apple! DotHND4CG Village People Malta 43 16553.87 N/A35 35562.72 TIME- OUT 47 21847.33 28 53259.60 TIME- OUT 42 12016.04

50 The Scores TeamScore UnicusNo submission

51 The Scores TeamScore Eat Your Apple35 UnicusNo submission

52 The Scores TeamScore iLike110 Eat Your Apple35 UnicusNo submission

53 The Scores TeamScore Village People205 iLike110 Eat Your Apple35 UnicusNo submission

54 The Scores TeamScore HND4250 Village People205 iLike110 Eat Your Apple35 UnicusNo submission

55 The Scores TeamScore Beeef275 CG275 HND4250 Village People205 iLike110 Eat Your Apple35 UnicusNo submission

56 The Scores TeamScore dot495 Beeef275 CG275 HND4250 Village People205 iLike110 Eat Your Apple35 UnicusNo submission

57 The Scores TeamScore WM720 dot495 Beeef275 CG275 HND4250 Village People205 iLike110 Eat Your Apple35 UnicusNo submission

58 An Observation Interesting result:  One team managed to elect 47 members of parliament in Malta out of 65! (PX=PL)  Switching parties (not part of the contest) resulted in another layout electing 43 members for the other party. (PX=PN) In practice variance should be given more importance so as not to be accused of breach of the Constitution of Malta 61(4):  “the number obtained by dividing the total electorate in the division by the number of members to be returned to the House of Representatives from that division is as nearly equal to the electoral quota as is reasonably practicable”

59 Prosit tal-Programmi! The password of the test suite was the first line of the Brikkuni song Il-Bar ta’ Taħt il- Knisja: Fil-bar ta’ taħt il-knisja jonxru ħwejjeġ tal-mistħija u smajt li bintek tgħidx kemm tħobb tintelaq hemm


Download ppt "ICTSA Programming Contest 2009 Legal Cheating in Elections Gordon Pace Claudia Borg Chris Porter."

Similar presentations


Ads by Google