#### EU2000

1. Return to EU-PLUS page
2. Source Code

        After looking at a text book "Combinatorial Analysis",
    by Fred Roberts I implemented a method of computing the Banzhaf
    index by use of polynomial generating functions. This gives exact
    answers for the USA in an hour or so on my Olivetti Laptop which
    runs a low end pentium. The generating function method does not
    work on the Tompkins County example because the number of votes are
    so high.

          Voting coalitions are enumerated by terms in the polynomial
    expansion P=(1+x^v[0])(1+x^v[1]).....(1+x^v[n-1]). With n states
    the product expands to 1+Sum{ v[i]: i=0 to n-1} terms.

         Given an individual state with v[i] votes, the critical
    coalition count is obtained by looking at terms of P/(1+x^v[i]).
    These are coefficients of the set x^(q-i) where q is the majority
    figure and i=,1,2,v[i]. These polynomial products are re-evaluated
    for each distinct number of votes.

        Source data was taken from an article inThe Guardian.

                            EU VOTES FOR 15 COUNTRIES
        The German government complained about their poor power for their
    population. The Banzhaf power ratio is computed by dividing the voting
    power of a block by the square root of its population. The voting power
    of a block is the number of swing coalitions in which a block may
    participate. For example with three blocks each having 50,50 and 1 vote
    respectively the power of all blocks is equal. For each block there is
    a choice of two partners for a critical coalition where defecting would
    change the result of the vote.

    Total =       87, majority =   44, max =   10
    Block         Population  Weight           Power  BPR
    -----         ----------  ------           -----  ------
    Luxembourg          0.42       2            1002  2.6214
    Portugal            9.90       5            2558  1.3784
    Belgium            10.21       5            2558  1.3573
    Greece             10.53       5            2558  1.3365
    Ireland             3.74       3            1514  1.3273
    Austria             8.08       4            2134  1.2728
    Sweden              8.85       4            2134  1.2162
    Italy              57.61      10            5342  1.1933
    France             58.96      10            5342  1.1795
    United_Kingdom     59.24      10            5342  1.1767
    Finland             5.16       3            1514  1.1300
    Spain              39.39       8            4166  1.1254
    Denmark             5.31       3            1514  1.1139
    Netherlands        15.76       5            2558  1.0925
    Germany            82.03      10            5342  1.0000

                  EU VOTING WITH NEW ARRIVALS
       This was a point of contention at the EU summit in Nice.

       The Nice conference decided on new values for the voting weights.

       As can bee seen Germany benefits, but despite its extra vote the
    Netherlands remains near the bottom of the list.

    Total =      346, majority =  173, max =   29
    Block         Population  Weight           Power  BPR
    -----         ----------  ------           -----  ------
    Luxembourg              0.42   4         2579379  2.4054
    Malta                   0.37   3         1934279  1.9218
    Cyprus                  0.75   4         2579379  1.8000
    Poland                 38.66  27        18068565  1.7562
    Spain                  39.39  27        18068565  1.7399
    Bulgaria                6.23  10         6476963  1.5683
    Italy                  57.61  29        19536933  1.5556
    France                 58.96  29        19536933  1.5377
    United_Kingdom         59.24  29        19536933  1.5340
    Portugal                9.90  12         7787735  1.4958
    Hungary                10.09  12         7787735  1.4817
    Belgium                10.21  12         7787735  1.4729
    Czech_Rep              10.29  12         7787735  1.4672
    Greece                 10.53  12         7787735  1.4504
    Lithuania               3.70   7         4522771  1.4210
    Ireland                 3.74   7         4522771  1.4134
    Austria                 8.08  10         6476963  1.3771
    Sweden                  8.85  10         6476963  1.3158
    Germany                82.03  29        19536933  1.3036
    Estonia                 1.44   4         2579379  1.2990
    Netherlands            15.76  13         8445609  1.2857
    Romania                22.48  15         9773539  1.2458
    Finland                 5.16   7         4522771  1.2033
    Denmark                 5.31   7         4522771  1.1862
    Slovakia                5.39   7         4522771  1.1773
    Slovenia                1.97   4         2579379  1.1106
    Latvia                  2.43   4         2579379  1.0000

#### SOURCE CODE

    Z<-POWER.D4F
    |class description
    |Coalition voting systems
    SQRT2PI<-#sqrt 8 * _3 o 1
    Z<-ADD_ALIAS POWER.D4S

    "POWER.D4S"
    edpower|WW.ED"power.d4f ", ARGS
    ldpower|#copy"power.d4f" & POWER.D4F
    testp|BZ<-POWER_INDEX ARGS,(0=rARGS)/"test.dat"

    "test.dat">>EOF
    Sheepshire    12 12
    Richfolk       9  9
    Candlewick     7  7
    Fiddlesex      3  3
    Slurrey        1  1
    Porkney_Isles  1  1
    EOF

    "tompkins.dat">>EOF
    Lansing          8317 404
    Dryden_East      7604 333
    Enfield_Newfield 6776 306
    Ithaca_3         6550 298
    Ithaca_4         6002 274
    Ithaca_SE        5932 270
    Ithaca_1         5630 261
    Ithaca_2         5378 246
    Ithaca_NE        5235 241
    Groton           5213 240
    Caroline_Danby   5203 240
    Ithaca_5         5172 238
    Ithaca_West      4855 224
    Ulysses          4666 214
    Dryden_West      4552 210
    EOF

    "eu.2000">>EUF
    Luxembourg          0.42       2
    Ireland             3.74       3
    Finland             5.16       3
    Denmark             5.31       3
    Sweden              8.85       4
    Austria             8.08       4
    Portugal            9.90       5
    Netherlands        15.76       5
    Greece             10.53       5
    Belgium            10.21       5
    Spain              39.39       8
    United_Kingdom     59.24      10
    Italy              57.61      10
    Germany            82.03      10
    France             58.96      10
    EUF

    "eu.2020">>EOF
    Austria             8.08       4
    Belgium            10.21       5
    Denmark             5.31       3
    Finland             5.16       3
    France             58.96      10
    Germany            82.03      10
    Greece             10.53       5
    Ireland             3.74       3
    Italy              57.61      10
    Luxembourg          0.42       2
    Netherlands        15.76       5
    Portugal            9.90       5
    Spain              39.39       8
    Sweden              8.85       4
    United_Kingdom     59.24      10
    Bulgaria            6.23       4
    Cyprus              0.75       2
    Czech_Rep          10.29       5
    Estonia             1.44       3
    Hungary            10.09       5
    Latvia              2.43       3
    Lithuania           3.70       3
    Malta               0.37       2
    Poland             38.66       8
    Romania            22.48       6
    Slovakia            5.39       4
    Slovenia            1.97       3
    Turkey             64.38      10
    EOF

    "usa.dat">>EOF
    CA 29760021 54
    NY 17990455 33
    TX 16986510 32
    FL 12937926 25
    PA 11881643 23
    IL 11430602 22
    OH 10847115 21
    MI  9295297 18
    NJ  7730188 15
    NC  6628637 14
    GA  6478216 13
    VA  6187358 13
    MA  6016425 12
    IN  5544159 12
    MO  5117073 11
    WI  4891769 11
    TN  4877185 11
    WA  4866692 11
    MD  4781468 10
    MN  4375099 10
    LA  4219973  9
    AL  4040587  9
    KY  3685296  8
    AZ  3665228  8
    SC  3486703  8
    CO  3294394  8
    CT  3287116  8
    OK  3145585  8
    OR  2842321  7
    IA  2776755  7
    MS  2573216  7
    KS  2477574  6
    AR  2350725  6
    WV  1793477  5
    UT  1722850  5
    NE  1578385  5
    NM  1515069  5
    ME  1227928  4
    NV  1201833  4
    NH  1109252  4
    HI  1108229  4
    ID  1006749  4
    RI  1003464  4
    MT   799065  3
    SD   696004  3
    DE   666168  3
    ND   638800  3
    DC   606900  3
    VT   562758  3
    AK   550043  3
    WY   453588  3
    EOF

    Z<-CJ EXT_COLS NN
    |Get columns from variable
    CJ<-0 #ifndef "CJ"
    Z<-0 #sed "X:d;$",NN
    Z<-AWK"$<-$$[CJ]"
    Z<-#sed":cm"

    Z<-X CV Y;I;J;N;T
    |Convolution or polynomial multiplication
    Z<-iI<-0 & N<-1+c/J<-,(irX) #outer+ irY & T<-,X #outer* Y
    AA: Z<-Z,+/(I=J)/T & I++ & ->(I(0=rIX)/0
    ->(10
    AA: |Split
    N<-(rIX)%2
    Z<-(CV_PRODUCT NtIX) CV CV_PRODUCT NdIX

    Z<-CO_COUNT VEC;GF;Q;V;VL;X
    |Count swing coalitions for each value
    Q<-(1++/VEC)%2
    X<-(1+c/VEC)r 0 & X[VEC]++ & VL<-(X>0)/irX & Z<-i0
    AA: ->(0=rVL)/XX & V<-1tVL & VL<-1dVL
    GF<-CV_PRODUCT ((VECiV) #ne irVEC)/VEC
    Z<-Z,+/GF[Q-1+iV]
    ->AA
    XX: VL<-(X>0)/irX & Z<-Z[VLiVEC]

    Z<-POWER_INDEX NN;DV;GF;H1;MAX;N;PR;Q;V;VS;VL;VOTE;XI;ZP
    |Banzhaf power index in weighted majority voting patterns
    |Use generating functions to check _all_ coalitions
    N<-1tr:V<- #fi ," ",2 EXT_COLS NN
    MAX<-c/V & XI<-(1+MAX)r0 & XI[V]++ & Q<-(1++/V)%2
    H1<-"Total = ########, majority = ####, max = ####" z (+/V),Q,MAX
    H1
    VS<-VL<-(XI>0)/irXI & ZP<-i0
    AA: ->(0=rVL)/XX
    VOTE<-1tVL & VL<-1dVL
    DV<- ((V i VOTE)#ne irV)/V
    "testing ", (zVOTE), " < ", zDV
    GF<-CV_PRODUCT ((V i VOTE)#ne irV)/V
    ZP<-ZP,X<-+/GF[Q-1+iVOTE]
    7 #print "V= ",(6zVOTE),"  ",16 0 z X
    ->AA
    XX:| Use the table
    0 r 7 #sed"X:d;$",NN
    PR<-i0
    0 r AWK "$<-(32t$),16 0 z X<-ZP[VS i #fi $2] & PR<-PR, X % SQRT2PI * #sqrt #fi $1"
    PR<-PR%f/PR
    0 r AWK "$<-(48t$),8 4 z PR[LC]"
    Z<- 7 #sed ":cm"
    Z<-Z[ m #sort PR]
    0 r 7 #sed ":d"
    #print H1
    #print BANZHAF.FMT
    #print Z
    0 r WW.FSCR 7

Back to the Top