EMIS 3360

Mathematical Programming Examples

Mathematical programming models use decision variables to minimize or maximize an objective function, subject to the requirement that the decision variables satisfy a set of constraints. The following examples illustrate the basic ideas of mathematical programming.

Example 1: The Challenger® Problem

Fill each square with a number, one through nine.


 
 
 
  column 1 column 2 column 3 column 4 23
row 1     3   10
row 2    2     29
row 3       6 19
row 4 7       17
  25 16 15 19 5

Solution:

Let xij be the number in row i, column j of the puzzle.

We get the following system of equations

x11 + x12 + x13 + x14 = 10 (Sum of Row 1)

x21 + x22 + x23 + x24 = 29 (Sum of Row 2)

x31 + x32 + x33 + x34 = 19 (Sum of Row 3)

x41 + x42 + x43 + x44 = 17 (Sum of Row 4)

x11 + x21 + x31 + x41 = 25 (Sum of Column 1)

x12 + x22 + x32 + x42 = 16 (Sum of Column 2)

x13 + x23 + x33 + x43 = 15 (Sum of Column 3)

x14 + x24 + x34 + x44 = 19 (Sum of Column 4)

x11 + x22 + x33 + x44 = 5 (Lower Right-Hand Corner)

x14 + x23 + x32 + x41 = 23 (Upper Right-Hand Corner)

x13 = 3 Given

x22 = 2 Given

x34 = 6 Given

x41 = 7 Given

This gives us a system of 16 variables and 14 equations. You may recall how to solve such a system of equations. If not, you should read Chapter 2 of the textbook. If we go ahead and solve this system, we may get a solution like this:
 

variable value
x11 3
x12 2
x13 3
x14 2
x21 14
x22 2
x23 2
x24 11
x31 1
x32 12
x33 0
x34 6
x41 7
x42 0
x43 10
x44 0

This solution satisfies the equations above, in other words it gives the correct row, column and diagonal sums, but it violates the rule that each number is in the range of one to nine. So, we want a solution to the above equations subject to 1 <= xij <= 9 for all xij.

In mathematical programming terminology, the xij are decision variables and the equations and inequalities are constraints. Any set of values for the decision variables that satisfies the constraints is said to be a feasible solution. A feasible solution to the Challenger Puzzle problem is shown below.
 

variable value
x11
x12
x13
x14
x21
x22
x23
x24
x31
x32
x33
x34
x41
x42
x43
x44



Example 2: The Diet Problem

One of the earliest published examples of a linear programming problem is the so-called "diet problem" in which the goal is to choose a minimum-cost diet that satisfies the minimum recommended daily allowance (RDA), given in milligrams, for various nutrients. Formulate the problem of determining how much of each of the foods listed below should be consumed so as to meet the given RDA requirements while minimizing the cost of the diet as a mathematical program.
 
 
 
Milk (per gallon) Cheese (per lb) Apples (per lb) Minimum RDA
Protein 40 20 10 80
vitamin A 5 40 30 60
vitamin B 20 30 40 50
vitamin C 30 50 60 30
Cost $1.00 $2.5 $0.75  

Let the decision variables "milk", "cheese" and "apples" be the gallons and pounds of milk, cheese and apples consumed, respectively. The cost of the diet in terms of these decision variables is given by the expression, or objective function, milk + 2.5 cheese + 0.75 apples. Thus, the following is a correct mathematical programming model for this diet problem. The last three constraints represent the fact that we can?t consume negative quantities of food.

minimize milk + 2.5 cheese + 0.75 apples

subject to

40 milk + 20 cheese + 10 apples >= 80 (Protein RDA)
  5 milk + 40 cheese + 30 apples >= 60 (vitamin A RDA)
20 milk + 30 cheese + 40 apples >= 50 (vitamin B RDA)
30 milk + 50 cheese + 60 apples >= 30 (vitamin C RDA)
milk     >= 0
cheese >= 0
apples >= 0

A vegan diet of eight lbs of apples per day meets the minimum RDA at cost of $6.00, a diet of one and one half gallons of milk and two pounds of apples also meets the minimum RDA and cost only $3.00. The solution shown below has a cost of slightly less than $2.87.
 
variable value
MILK 1.565217
CHEESE 0.000000
APPLES 1.739130

It turns out that all other feasible solutions cost at least $2.87, so while all three of the solutions above are feasible, only the last one is an optimal solution.



Example 3: GT Railroad has locomotives at IE Junction, Centerville and Wayover City and needs to get locomotives to the following destinations: A-Station, Fine Place, Goodville and Somewhere Street. A single locomotive is required at each destination. Currently there are four locomotives at IE Junction, one at Centerville, and two at Wayover City. GT Railroad can send a locomotive from any of the three origin locations (IE Junction, Centerville and Wayover City) to any of the destinations. For example, they could send one locomotive to each destination from IE Junction. The goal, however, is to minimize the total distance that the locomotives are sent. This may be because the cost of sending a locomotive from one place to another is directly proportional to the distance traveled. The distances between the origins and destinations are given in the following table.
 
 
A-Station Fine Place Goodville Somewhere Street
IE Junction 13 35 42 9
Centerville 6 61 18 30
Wayover City 15 10 5 9

If all four locomotives are sent from IE Junction, the total distance traveled would be 13 + 35 + 42 + 9 = 99. If GT Railroad instead sends locomotives from IE Junction to A-Station and Somewhere Street and from Wayover City to Fine Place and Goodville, the total distance traveled would be 13+10+5+9 = 37. Notice that this second solution can be improved by sending the locomotive that goes to A-Station from Centerville rather than IE Junction. As it turns out, this is in fact an optimal solution. Can you see why?

We will now formulate the problem faced by GT Railroad as a mathematical program.

Decision variables: Let Xij be the number of locomotives sent from origin i to destination j. Where origin 1 is IE Junction, origin 2 is Centerville, origin 3 is Wayover City, destination 1 is A-Station, destination 2 is Fine Place, destination 3 is Goodville and destination 4 is Somewhere Street.

Objective Function: Minimize the total distance traveled.

Minimize 13 X11 + 35 X12 + 42 X13 + 9 X14 + 6 X21 + 61 X22 + 18 X23 + 30 X24 + 15 X31 + 10 X32 + 5 X33 + 9 X34

Constraints:

There are only 4 locomotives at IE Junction:    X11 + X12 + X13 + X14 <= 4
There is only 1 locomotive at Centerville:          X21 + X22 + X23 + X24 <= 1
There are only 2 locomotives Wayover City:     X31 + X32 + X33 + X34 <= 2

At least one locomotive is required at A-Station:               X11 + X21 + X31 >= 1
At least one locomotive is required at Fine Place:              X12 + X22 + X32 >= 1
At least one locomotive is required at Goodville:                X13 + X23 + X33 >= 1
At least one locomotive is required at Somewhere Street:  X14 + X24 + X34 >= 1

Nonnegative Constraints: Xij >= 0

Integrality:

An important consideration in this problem is that locomotives are indivisible units, so we don?t want a solution that, for example, sends 1.5 locomotives from IE Junction to A-Station. Thus, we should really add an additional set of constraints that say the Xij variables must be integers. Mathematical programs with these types of constraints are called integer programs (IP). In general, IPs are very difficult to solve. We will discuss this point in some detail later in the semester.



Example 4: Production Planning

The National Steel Corporation (NSC) produces a special-purpose steel that is used in the aircraft and aerospace industries. The marketing department of NSC has received orders for 2400, 2200, 2700 and 2500 tons of steel during each of the next four months. NSC can meet these demands by producing the steel, by drawing from its inventory or by a combination of both.

The production costs per ton of steel during each of the next four months are projected to be $7400, $7500, $7600 and $7800. Because of these inflationary costs, it might be advantageous for NSC to produce more steel than it needs in a given month and store the excess, although production capacity can never exceed 4000 tons in any month. All production takes place at the beginning of the month and immediately thereafter the demand is met. The remaining steel is then stored in inventory at a holding cost of $120/ton for each month that it remains there.

The inventory at the beginning of the first month is 1000 tons of steel and the inventory level at the end of the fourth month should be at least 1500 tons. Formulate a mathematical program for NSC that will minimize the total production cost over the next four months while satisfying the demand.

Solution:

Decision variables

Let Pi be the tons of steel produced in month i.

Let Ii be the inventory at the end of month i. Note that I0 is the initial inventory (i.e. at the start of Month 1).

Objective Function:

We wish to minimize the production cost which is given by 7400 P1 + 7500 P2 + 7600 P3 + 7800 P4 and the holding cost which is given by 120 (I1 + I2 + I3).

The objective function is thus 7400 P1 + 7500 P2 + 7600 P3 + 7800 P4 + 120 (I1 + I2 + I3).

Constraints:

First, we have to meet the demand. Thus, we have the following constraints.

P1 + I0 >= 2400
P2 + I1 >= 2200
P3 + I2 >= 2700
P4 + I3 >= 2500

Next, we consider the inventory levels at the end of each month.

I0 = 1000
I1 = P1 + I0 - 2400
I2 = P2 + I1 - 2200
I3 = P3 + I2 - 2700
I4 = P4 + I3 - 2500
I4 >= 1500

Since at most 4000 tons of steel can be produced each month, we have the following constraints.

Pi <= 4000 for i = 1, 2, 3, 4

Finally, we have to ensure that the Pi and Ii variables are all non-negative.

Pi >= 0 for i = 1,2,3,4
Ii  >= 0 for i = 1,2,3,4