Rigging Elections


    {  Exmpl15.3-1_ElectionDistricts.mpl  }

    {  Applications of Optimization with Xpress-MP  }

    {  Chapter 15.3,  Election Districts,  Size: 15x46,  Page 317 }


TITLE
    ElectionDistricts;

INDEX
    quarter := 0..14;
    quarter2 := quarter;
    quarter3 := quarter;
    rdist := 1..46;
    distsetup[rdist,quarter,quarter2,quarter3] := ((1,1,0,0),(2,1,2,3),(3,1,2,0),(4,1,5,0),(5,1,5,6),
                                                   (6,2,0,0),(7,2,3,0),(8,2,5,0),(9,3,4,0),(10,3,5,0),
                                                   (11,4,0,0),(12,4,5,0),(13,5,6,0),(14,5,6,7),(15,5,6,8),
                                                   (16,5,10,0),(17,5,10,11),(18,6,0,0),(19,6,7,0),(20,6,8,0),
                                                   (21,6,7,8),(22,7,0,0),(23,7,8,0),(24,7,8,9),(25,7,9,0),
                                                   (26,8,0,0),(27,8,9,0),(28,8,9,11),(29,8,10,0),(30,8,10,11),
                                                   (31,8,11,0),(32,8,11,12),(33,8,11,13),(34,9,0,0),(35,9,11,0),
                                                   (36,9,11,13),(37,9,12,0),(38,10,0,0),(39,10,11,0),(40,10,13,0),
                                                   (41,11,12,0),(42,11,13,0),(43,12,0,0),(44,12,14,0),(45,13,0,0),(46,13,14,0));

DATA
    Reqd := 6; !5
    Distr[rdist,quarter>0] :=  ( 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0,
                                 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0,
                                 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
                                 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1);


    Pop[quarter] := 10000 * (0,3,5,2,7,2,4,3,3,4,6,1,6,4,4);
    QuarterMaj[quarter] := 100 * (0,175,150,142,420,180,90,120,100,260,340,25,270,290,150);
    DistPop[rdist] := SUM(quarter,quarter2,quarter3 IN distsetup: Pop + Pop[quarter:=quarter2] + Pop[quarter:=quarter3]);
    DistMaj[rdist] := SUM(quarter,quarter2,quarter3 IN distsetup: QuarterMaj + QuarterMaj[quarter:=quarter2] + QuarterMaj[quarter:=quarter3]);
    DDMaj[rdist] := DistMaj * 2;
    Maj[rdist] := FORMULA(IIF(DDMaj >= DistPop, 1, 0));

BINARY VARIABLES
    Choose[rdist];

MODEL

    MAX Votes = SUM(rdist: Maj * Choose);

SUBJECT TO

    Partitioning[quarter] -> PTN:
        SUM(rdist: Distr * Choose) = 1;

    DesiredNumberDistricts -> DND:
        SUM(rdist: Choose) = Reqd;

END




Back To Top | Maximal Home Page | List of Models | Previous Page | Next Page