CS 485 Fall 2005

Obtain a free student edition of MPL Modeling Software from Maximal USA (http://www.maximalusa.com) for use in solving Linear Programming problems (LP's) in this assignment. NOTE: you will not be able to use this software to solve LP's until you receive a license from Maximal USA. The license will be sent via email; you should take care of downloading and requesting a license as soon as possible.
1. Formulate as an LP and solve:
Mr. and Mrs. Adamson are going out of town for the weekend, which means Glen has to fix his own meals on Saturday. They will let him have whatever food he wants, as long as he can prove that he will meet the US Recommended Daily allowances in Protein, Vitamins A, B_{6}, and C, Thiamine, Riboflavin, Niacin, Calcium, Iron, and Phosphorous. (They are not particulalry concerned about Folic Acid, Vitamin B_{12}, Magnesium, Zinc, Copper, or Pantothenic Acid, because Glen has a chemistry set containing these ingredients, and they don't want him to get any ideas.) Glen assembles the nutritional information for his favorite foods (see below), and prepares a shopping list. It is to his benefit to meet the nutritional requirements at minimal cost, because he can keep any money left over after he buys the items. Notice that he must by whole packages of whatever items he buys (e.g., he cannot buy 1.7 bags of potato chips). Furthermore, although some of the items show asterisks in some of the categories (indicating that there is less than 2% of the RDA in a serving, he must consider these amounts to be 0%, because he cannot prove that the content is sufficient to meet his needs.
Formulate as an Integer Linear Program, and solve. (Note: data collected in 1990)
Prot 
Vit. A 
Vit. C 
Thia 
Ribo 
Niac 
Calc 
Iron 
Phos 
Vit. B_{6} 
Serv/Pack 
Price/Pack 

Durkee's Onion Rings 
4 
2 
2 
2 
2 
6 
3.2 
$1.99 

Ben & Jerry's Ice Cream 
15 
8 
4 
20 
20 
15 
4 
$2.69 

Pringle's BBQ Chips 
2 
6 
2 
4 
2 
6.75 
$1.95 

Herr's Cheese Puffs 
2 
15 
2 
2 
8 
$1.29 

Milky Way Candy Bar 
4 
10 
8 
6 
2 
1 
$0.79 

Kellogg's Pop Tarts 
4 
10 
10 
10 
10 
6 
10 
6 
$1.99 

Herr's BBQ Chips 
10 
2 
2 
4 
2 
4 
1 
$0.69 

Pepperidge Farm Cookies 
2 
8 
$2.09 

Keebler Popcorn Deluxe 
2 
2 
2 
2 
4 
2 
4 
$1.29 

Bachman Thin Pretzels 
4 
10 
10 
15 
10 
9 
$1.39 

Nacho Cheese Combos 
4 
2 
2 
4 
4 
2 
8 
$1.89 
2. Transportation Problem:
Five patients require blood transfusions, according to the chart on the left. The current blood supply is shown in the chart on the right:
Patient 1 2 3 4 5 Blood Type A AB B O A Pints Needed 2 3 1 2 3
Blood Type A AB B O Pints Available 7 4 6 5 Cost/Pint 1 4 2 5
Recall that type O is the universal donor and type AB is the universal recipient. This means that anybody can use type O and a type AB patient can use blood of any type. We wish to figure out how many pints of each type blood to give to each patient, in order to minimize cost.
3. A mill of the FineWebb Paper Company produces socalled liner board in jumbo reels having a standard width of 68 inches. (Each reel has a fixed length.) The company's customers, however, order reels having smaller widths (and the same fixed length as the larger reel). Today's orders are for 110 reels of 22inch width, 120 reels of 20inch width, and 80 reels of 12inch width. These smaller widths are to be cut from the larger standard size reel.
For example, the company can decide to slit a jumbo reel into two reels each 22 inches wide, and one reel 20 inches wide; this leaves 4 inches of trim waste from the 68inch jumbo. The production scheduler, Manny Blanks, wants to manufacture today's orders so as to minimize total trim waste.
4. Branch and Bound:
Using Branch and Bound, solve this Integer Linear Program. Show your logic tree in solving the problem.
max z =  6x_{1} + 5x_{2} 
s.t.  6x_{1} + 5x_{2} ≤ 56 
6x_{1} + 3x_{2} ≤ 40  
x_{1} + 2x_{2} ≤ 8  
2x_{1}  2x_{2} ≤ 11  
x_{1} , x_{2} ≥ 0, integer 
5. Traveling Salesman Problem:
We saw that the ncity traveling salesman problem can be formulated and solved as an LP. Unfortunately, the number of constraints is exponential in n. We also saw that this large number of constraints is needed to ensure that no subcycles occur  e.g., for a 5city TSP, we must ensure that subcycles such as 1>2>3>1 and 4>5>4 are eliminated.
Define the Relaxed TSP formulation as a set of constraints that ensure merely that each city is entered and exited exactly once, i.e., if x_{ij} is assigned the value 1 if i>j is in the tour and 0 if it is not in the tour, then constraints of the form x_{i1} + x_{i2} + ... + x_{in} = 1 ensure that city i will be exited exactly once and constraints of the form x_{1j} + x_{2j} + ... + x_{nj} = 1 ensure that city j will be entered exactly once. (Note that the variables x_{ii} and x_{jj} should not be included in these equations, which will ensure they never receive a value.)
An approach to solving the TSP is to begin by solving the Relaxed TSP. If the Relaxed TSP provides a complete tour with no subcycles, stop. Otherwise, if subcycles exist, continue iteratively by introducing constraints that prevent those subcycles only. Using this method, solve the following TSP:
1 2 3 4 5 6 1  3 93 13 33 92 4  77 42 21 163 45 17  36 16 284 39 90 80  56 75 28 46 88 33  256 3 88 18 46 92 
6. Automating Dynamic Programming:
The main concept of dynamic programming is to reduce the amount of computation needed to
solve a problem by carefully arranging the order in which values are computed, and
storing them in a table for reuse. The usual approach is to develop an algorithm that
begins at the end of a series of computations and work backwards, storing values as it
progresses.
This contradicts somewhat the approach of developing a recursive solution to a problem 
whereas a recursive solution can be elegant, it will typically start at the beginning and
work towards the end. We have seen that this can cause recalculation to occur at
staggering rates.
Can topdown recursion coexist with bottomup dynamic programming? Sure!
In class, we discussed calculation of the Fibonacci numbers with the following recursive function:
int Fib(int n) { // precondition: n>=0 if(n<=1) return 1 ; else return Fib(n1) + Fib(n2) ; }
We saw that this was very inefficient, in that it requires recomputation of F(k2) when calculating F(k1) and when calculating F(k), for all values of k≥2. We also saw that this problem could be fixed simply in the following way:
See below:
int Fibo(int n) { // precondition: n>=0 if(n<=1) return 1 ; else if( undefined( f[n] ) ) f[n] = Fibo(n1) + Fibo(n2) ; return f[n] ; }
int LUP(int i, vector<int>& v) // returns length of longest upsequence in list v[i],v[i+1],...,v[n1] // where v.size()==n . { if( i==v.size()1 ) return 1 ; int max = 0 ; int temp ; for(int j=i+1; j<v.size(); j++ ) { temp = LUP(j,v) ; if( v[i]<v[j] ) temp = temp + 1 ; if( temp > max ) max = temp ; } return max ; }This function is horribly inefficient, however! Rewrite this function so that it maintains an array of results as in the Fib/Fibo example in parts (a)(b) and returns the array value whenever it is defined, rather than generating further recursive calls.