===========================================================================
CSC 373H                Lecture Summary for Week 11             Winter 2006
===========================================================================

Linear Programming:

Political Advertising problem (from "Introduction to Algorithms, 2nd ed."
by Cormen et al., pp. 770-772).

 -  A political party can advertise on four different platforms:
    building roads, gun control, farm subsidies, and gasoline tax.
    Voters come from three types of ridings: urban, suburban, and rural.
    Assume that advertising can only be done globally: all advertising is
    seen in all three types of ridings.

 -  Market research has provided the party with the following information:
    for each advertising platform and riding type, this table summarizes
    1000's of voters gained or lost in ridings of that type, for each $1000
    of advertising spent on that platform.

              | urb.  sub.  rur.
        ------+------------------
        roads |  -2     5     3
        guns  |   8     2    -5
        farm  |   0     0    10
        gas   |  10     0    -2

 -  Leaders of the party have figured out that the party needs to gain at
    least 50,000 urban voters, 100,000 suburban voters, and 25,000 rural
    voters.

 -  Your task is to figure out how much to spend on advertising for each
    platform in order to gain the required number of votes in each type of
    riding, while spending as little as possible overall.

 -  Here is one way to represent the problem.

    What are we looking for exactly?  Amount to advertise on each platform.
    So introduce variables:

        x1 = $1000's to advertise building roads
        x2 = $1000's to advertise gun controls
        x3 = $1000's to advertise farm subsidies
        x4 = $1000's to advertise gasoline tax

    What's our goal?  Spend as little as possible, in other words,
    minimize x1 + x2 + x3 + x4.

    What are out constraints?  The need to gain some number of voters in
    each riding type, which can be expressed by linear inequalities:

        -2 x1 + 8 x2 +  0 x3 + 10 x4 >= 50     (for urban ridings)
         5 x1 + 2 x2 +  0 x3 +  0 x4 >= 100    (for suburban ridings)
         3 x1 - 5 x2 + 10 x3 -  2 x4 >= 25     (for rural ridings)

    Anything else?  Numerically, we cannot spend negative amounts, so

        x1 >= 0, x2 >= 0, x3 >= 0, x4 >= 0.

    This is our "linear program", which can be solved by various methods.
    Entire courses are devoted to linear programming; for our purposes,
    it's sufficient to know that linear programs can be solved efficiently
    both in practice (the simplex method, worst-case exponential time)
    and in theory (interior point methods, worst-case polynomial time).