# Chapter 15: Dynamic Programming

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Chapter 15: Dynamic Programming Dynamic programming is a general approach to making a sequence of interrelated decisions in an optimum way. While we can describe the general characteristics, the details depend on the application at hand. Most fundamentally, the method is recursive, like a computer routine that calls itself, adding information to a stack each time, until certain stopping conditions are met. Once stopped, the solution is unraveled by removing information from the stack in the proper sequence. Here is an overview of the method: 1. Define a small part of the whole problem and find an optimum solution to this small part. 2. Enlarge this small part slightly and find the optimum solution to the new problem using the previously found optimum solution. 3. Continue with Step 2 until you have enlarged sufficiently that the current problem encompasses the original problem. When this problem is solved, the stopping conditions will have been met. 4. Track back the solution to the whole problem from the optimum solutions to the small problems solved along the way. While this sounds new, you in fact already know how to solve a problem by dynamic programming: Dijkstra s shortest route algorithm is classic dynamic programming! The small part of the problem at each stage is simply to determine the net closest node to the origin. You enlarge this problem slightly at each stage by appending all of the unsolved nodes and arcs that are directly attached to a solved node. The stopping conditions are met when the net closest node is the destination node. Now you recover the solution by tracing back along the arcs in the arc set from destination node back to the origin. There are several important characteristics of dynamic programming, as described net. The problem can be divided into stages. In the shortest route problem, each stage constitutes a new problem to be solved in order to find the net closest node to the origin. In some dynamic programming applications, the stages are related to time, hence the name dynamic programming. These are often dynamic control problems, and for reasons of efficiency, the stages are often solved backwards in time, i.e. from a point in the future back towards the present. This is because the paths that lead from the present state to the future goal state are always just a subset of all of the paths leading forward from the current state. Hence it is more efficient to work backwards along this subset of paths. We will be dealing with static eamples in which the direction is immaterial, but for form s sake we will also work backwards so that it will not be a surprise when you need to do so for a time-related dynamic control problem. This is known as backwards recursion. Practical Optimization: a Gentle Introduction John W. Chinneck,

2 Each stage has a number of states. Most generally, this is the information that you need to solve the small problem at a stage. For the shortest route problem, the state is the set of solved nodes, the arcs in the arc set, and the unsolved arcs and nodes directly connected to solved nodes. The decision at a stage updates the state at the stage into the state for the net stage. In the shortest route problem the decision is the arc to add to the arc set and the corresponding unsolved node that is added to the solved set. This obviously affects the sets of solved and unsolved nodes and arcs and the arcs in the arc set. Hence the decision updates the state for the net stage. Given the current state, the optimal decision for the remaining stages is independent of decisions made in previous states. This is the fundamental dynamic programming principle of optimality. It means that it is okay to break the problem into smaller pieces and solve them independently. For eample, in the shortest route problem, we only care about the total distance from the origin to a solved node; we don t care about the actual route from the origin to that solved node. Decisions made thereafter use only the distance information, without regard to the actual route (i.e. the previous decisions). There is a recursive relationship between the value of decision at a stage and the value of the optimum decisions at previous stages. In other words, the optimum decision at this stage uses the previously found optima. In a recursive relationship, a function appears on both sides of the equation. In words, the shortest route recursive relationship looks like this: Note how the length of shortest route appears on both sides of the equation: it is recursive. All dynamic programming recursive relationships show the optimum function on both sides of the equation: the new optimum is always derived from the old optimum along with some local value. Note that the relationship need not be addition as it is here. It could be anything: multiplication or some other abstract relationship. To formulate a dynamic programming solution, you must answer the following questions: What are the states in the solution? How is the state defined at a stage? What kind of decision must you make at a stage? How does the decision update the state for the net stage? What is the recursive value relationship between the optimum decision at a stage and a previous optimum decision? Students are epected to write out these items as part of their problem formulation. It s time for an eample to clarify all of this theory. For some reason, dynamic programming seems to be one of the less intuitive optimization methods and students seem to learn best by being shown several eamples, hence that is what we will do net. Practical Optimization: a Gentle Introduction John W. Chinneck,

3 An Equipment Replacement Problem A bicycle courier must obviously have a bicycle at all times that he can use for his deliveries; he can t be without one. Hence he wants to determine the cheapest way to buy and maintain bicycles over the 5-year timeframe that he is currently contemplating working as a bicycle courier before finishing his graduate program and moving on to other career options. He has collected some information about costs. A new Acme bicycle costs \$500. Maintenance costs vary with the age of the bike: \$30 in the first year, \$40 in the second year, and \$60 in the third year. Given the amount of use they get, bicycles will last a maimum of three years before they are sold. He figures he can get \$400 if he sells a bicycle after one year of use, \$300 after two years of use, and \$250 after three years of use. He has no bicycle at the moment. When should he buy bicycles and how long should he keep them to minimize his total costs over the 5-year timeframe? Let s formulate this as a dynamic programming problem by answering the required questions. The most important items are the stages and the states. See if you can figure out what they might be before looking below. How might we divide this problem into small stages that can be built upon to reach the final answer? Stages: The problem at time t is to find the minimum cost policy from time t to time 5. Hence we are subdividing the problem by time in this case. And we will be doing a backwards recursion, so the first problem we solve will be trivial: what is the best thing to do from time 5 until time 5? This is just the same as when we start a shortest route solution by labeling the origin with 0, indicating that the distance from the origin to itself is zero. The net stage will solve time 4 to time 5, the net time 3 to time 5, then time 2 to time 5, then time 1 to time 5, and finally we will have enlarged the problem enough to solve the original problem of what to do from time 0 (i.e. now) until time 5. State at a stage: The state at a stage is fairly simple in this case: just how many years remain until time 5. Decision at a stage: Since we are solving the problem anew at each stage, the courier has no bicycle now and must buy a bicycle to get started. The decision then, is how long to keep the bicycle he purchases. Decision update to the state: Given that he buys a bicycle at the start of the current stage, and makes a decision to keep it for a certain number of years, then the state (how many years until time 5) is updated accordingly. For eample if the state is currently 4 (i.e. we are at time 1 and hence it is 4 years until time 5), and the decision is to buy a bicycle now and keep it for 3 years, then the state at the net decision point will be 4-3=1, i.e. we will now be at time 4 with just one year to go until time 5. Recursive value relationship: First, let s define a few functions and variables: o g(t): minimum net cost from time t until time 5, given that a new bicycle is purchased at time t. o c t : net cost of buying a bicycle at time t and operating it until time, including the initial purchase cost, the maintenance costs, and the salvage value when it is sold. Practical Optimization: a Gentle Introduction John W. Chinneck,

4 o The recursive value relationship is then: g( t) min { c g( )} for t=0,1,2,3,4. Note how g( ) appears on both sides of the recursive relationship. The optimum from time t to time 5 depends on two things: the value of the current decision c t, and the value of a previously found optimum g(). Note that c t depends only on how long we keep the bicycle (1-3 years only), so we can work out its possible values in advance to save a little calculation later. Each calculation takes into account the initial purchase price, the maintenance costs, and the salvage value: Keep bicycle 1 year: c 01 = c 12 = c 23 = c 34 = c 45 = = \$130 Keep bicycle 2 years: c 02 = c 13 = c 24 = c 35 = ( ) 300 = \$270 Keep bicycle 3 years: c 03 = c 14 = c 25 = ( ) 250 = \$380 Before starting the solution, it is interesting to do some simple analysis to see which length of ownership is the most economical. Is it generally better to keep a bicycle for 1, 2, or for 3 years? The average annual cost of ownership is: for 1 year \$130/1=\$130, for 2 years \$270/2=\$135, for 3 years \$380/3=\$ So it is cheapest to keep each bicycle for 3 years, but if that is not possible, then for just 1 year. Given that we have a 5 year timeframe, we should epect to see some combination of 3 year and 1 year ownerships. Now back to dynamic programming to find the optimum solution We also define g(5) = 0. No costs are incurred after the timeframe ends. Given that we are using a backwards recursion, we start at time 5 and work backwards. The optimum choice (lowest cost) at each stage is highlighted in bold. g(5) = 0. [This is the trivial first stage.] g(4) = c 45 + g(5) = = 130. [Also a trivial stage since there is only one possible decision.] g(3) = minimum over: [finally a real decision] o c 34 + g(4) = = 260 o c 35 + g(5) = = 270 g(2) = minimum over: o c 23 + g(3) = = 390 o c 24 + g(4) = = 400 o c 25 + g(5) = = 380 g(1) = minimum over: o c 12 + g(2) = = 510 [tie] o c 13 + g(3) = = 530 o c 14 + g(4) = = 510 [tie] g(0) = minimum over: o c 01 + g(1) = = 640 [tie] o c 02 + g(2) = = 650 o c 03 + g(3) = = 640 [tie] t Practical Optimization: a Gentle Introduction John W. Chinneck,

6 her knapsack. To keep it simple, let s consider just 3 possible items, whose weights and values are summarized in the table below. item weight (kg) value 1. food pack large bottle of water tent 6 11 She is going to a scout meeting with her troop, so it is possible that she can take more than one of each item on behalf of the troop. How many of each item should she take to maimize the total value while not eceeding her 10 kg carrying capacity? Before even starting, let s try to guess the solution for this tiny problem, based on the value/weight ratios for the items. These are 7/3=2.33 for food packs, 8/4=2 for bottles of water, and 11/6=1.83 for tents. Hence we would prefer to take as many food backs as possible since they have the greatest value/weight ratio. It s a pretty good bet that the final solution will include some food packs, but it s hard to determine eactly what the final solution will be. We ll have to set up and solve the dynamic program to find out. But first, note that this problem can be restated as: Maimize subject to where 1, 2, 3 0 and integer. Do you know a way to solve this problem without using dynamic programming? It can be solved as an integer program via branch and bound in this case. As we will see in the net eample though, there are many dynamic programming problems that cannot be turned into more familiar forms such as linear programs (as for the equipment replacement problem) or integer programs solved by branch and bound. Let s formulate this knapsack problem for a dynamic programming solution. Stages: The natural breakdown in this case is by item. And since we are practicing backwards recursions, we will work in the order tents, bottles of water, food packs. We will first consider just tents, then bottles of water and tents, then food packs, bottles of water and tents. State at a stage: The state at a stage is the amount of carrying capacity remaining in the knapsack. Decision at a stage: The hiker must decide how many copies to take of the item being considered at the current stage. Decision update to the state: The number of copies of the item taken reduces the carrying capacity for future stages in an obvious way. Recursive value relationship: First, let s define a few functions and variables: o t is the current stage (1, 2, or 3, indicating food packs, bottles of water, or tents) Practical Optimization: a Gentle Introduction John W. Chinneck,

7 o d t is the carrying capacity remaining when you reach stage t. o t is the decision, i.e. the number of copies of item t that the hiker decides to take o v t is the value of one copy of item t o f t (d t ) is the maimum value obtainable when you enter stage t with a remaining carrying capacity of d t, considering only stages t, t+1, 3. o The recursive value relationship is: f d ) ma { v f ( d w )} t where 0 t d t /w t and integer. t( t t t t 1 t t t Note how f( ) appears on both sides of the recursive relationship. The optimum for stage t to stage 3 depends on two things: the value of the current decision at stage t (i.e. v t t ), and the value of the previously found optimum f t+1 ( ). Note also that f t+1 ( ) is calculated with a remaining carrying capacity of d t w t t meaning that the weight of the items taken at stage t has reduced the carrying capacity d t with which you entered stage t. A difference from the equipment replacement problem is immediately apparent: you can enter a stage in different states. When you are working with stage 3 by itself (the first stage to be calculated), you have no idea what the state might be by the time stages 1 and 2 are considered. Hence for each stage we have to take into account all possible states. This means we need to use a table representation instead of the simple list we used for equipment replacement. Here goes: We start with stage 3, the tents. You will see that in many dynamic programming problems, the first and last stages considered are simpler than the intermediate stages. That is the case here, where we are considering only tents at this time. So the recursive value relationship reduces to f d ) ma {11 3} where The hiker can take just 0 or 1 copies of the tent since it 3( 3 3 weighs 6 kg and her carrying capacity is just 10 kg. The fully epanded table for stage 3 looks like this, where the best choice in each row is shown in bold: d 3 3 = 0 3 = 1 f 3 (d 3 ) The first column indicates the possible remaining carrying capacity when we finally reach stage 3: it could be anything between 0 and 10. The two centre columns show the value of making the decision indicated at the top of the column: note that - indicates that the particular decision is Practical Optimization: a Gentle Introduction John W. Chinneck,

8 not possible. For eample, look at the d 3 =2 line in the table. If you have only 2 kg of carrying capacity left, then you obviously can t take a 6 kg tent, hence the entry in the 3 =1 column is -. The rightmost column just summarizes the best possible thing to do in each row (i.e. the largest value you can attain given your remaining carrying capacity upon entry. For stage 3, the most important breakpoints are those associated with the weight of a tent (6 kg). If you have less than 6 kg carrying capacity remaining, then you obviously can t take a tent; 6 kg or more left and you can. For this reason, the table for stage 3 can be compressed quite a bit: d 3 3 = 0 3 = 1 f 3 (d 3 ) Stage 2 will encompass items 2 and 3, and hence will make reference to the table for stage 3. The recursive relationship is now f d ) ma {8 f ( d 4 )} where (since, at 2( a weight of 4 kg per bottle of water, we can take at most 2 bottles). The corresponding table is: d 2 2 = 0 2 = 1 2 = 2 f 2 (d 2 ) d 3 =d This table may be a little counterintuitive. Let s look at cell for row d 2 =10 and column 2 =1, which has a value of 19. How did it get that value? d 2 =10 means that we enter stage 2 and 3 (which is what is represented in this table) with 10 kg of carrying capacity remaining, and =1 means that the hiker has decided to take one copy of item 2 (i.e. a bottle of water). This has a value of 8 and a weight of 4 kg, leaving 6 kg of carrying capacity for stage 3. Now enter the table for Stage 3 on the d 3 =6 line, and we see right away that the best thing to do has a value of 11. Hence the total value is 8 (for a bottle of water) plus 11 (for a tent), for a total of 19. The other cells are calculated in the same way, following the recursive relationship. Stage 1 is again simpler, but for an interesting reason. Now that we have epanded the problem enough to encompass the entire original problem, we know eactly what d 1, the carrying capacity as we start the problem, is: it is 10 kg! Hence the table for stage 1 (which encompasses stages 2 and 3 as well), has just a single row for d 1 =10, as shown below. The recursive relationship is also slightly simplified because d 1 is replaced by a numeric value: f 10) ma {7 f (10 3 )}. 1( Practical Optimization: a Gentle Introduction John W. Chinneck,

9 d 1 1 = 0 1 = 1 1 =2 1 =3 f 1 d 2 = The values in this last table are calculated using only the information about item 1 and the table for stage 2. We don t need the table for stage 3 at this point, because stage 2 already incorporates stage 3. As an eample, consider the value in the 1 =1 column. The value of 18 is obtained (just as in the recursive relationship) from 1 copy of item 1 (value 7), which has a weight of 3 kg, leaving 7 kg carrying capacity, plus the best thing to do in the stage 2 table when there is 7 kg of carrying capacity left, and that has a value of 11, for a total of 18. Now at this point we can see that the maimum value combination of items that the hiker can carry has a value of 22, but we still need to unravel the actual solution. To do this we trace back through the tables from stage 1 to stage 3. In stage 1, the best value comes from setting 1 =2, leaving a carrying capacity of 4 kg for the net stage (as summarized in the rightmost column). Entering the table for stage 2 on the line for d 2 =4, the best value is for 2 =1, leaving a carrying capacity of 0 as summarized in the rightmost column. Entering the table for stage 3 on the line for d 3 =0, the best value is for 3 =0. Hence the solution associated with the maimum value of 22 is to take 2 food packs (item 1), plus one large bottle of water (item 2), and no tents (item 3). There are a few things to notice about this eample. First, the number of rows in the tables can become quite large if there are many states. The number of columns can also become large if there are many possible decisions, so dynamic programming can be crippled by combinatorial eplosion for large problems. Second, each cell calculation involves only the item considered at the current stage and the optimum results from just the previous table (since that table encapsulates all the data from all of the previous tables). This is helpful for efficiency. Finally, we need all of the tables to recover the actual solution, and not just its value. A More General Eample: Simultaneous Failure A data storage company maintains banks of disk drives in three separate locations for security reasons, with probabilities of failure that depend on the locations. For additional security, the company can also provide backup disk drives in each location. There are two backup disk drives available, and the company wishes to determine where to install them to minimize the overall probability that all three locations will fail simultaneously. The estimated probabilities of failure are summarized in the following table. Location A B C backup drives assigned For eample, if no backup drives are assigned, then the overall probability of simultaneous failure of all three locations is = This eample is still discrete and deterministic, but it is different in that the recursive relationship that will result is not additive, but multiplicative. The objective is to distribute the 2 available Practical Optimization: a Gentle Introduction John W. Chinneck,

10 backup disk drives so that the overall probability of failure is minimized. This can be formulated for a dynamic programming solution. Again there is no implied direction in this problem, but we will choose a backwards recursion. Stages: The natural breakdown in this case is by location. For a backwards recursion we will first consider location C, then locations B and C, then locations A and B and C. State at a stage: The state at a stage is the number of backup disk drives left to distribute. Decision at a stage: How many backup disk drives should be assigned to this location? The number could be anything between 0 and 2, depending on the state. Decision update to the state: The number of backup disk drives assigned to a location reduces the number of backup disk drives available for assignment. Recursive value relationship: First, let s define a few functions and variables: o t is the current stage (A, B, or C, indicating the location) o d t is the number of backup disk drives remaining for assignment when we enter stage t. o t is the decision, i.e. the number of backup disk drives assigned to this location o p t ( t ) is the probability of failure at stage t given that t backup disk drives are assigned to this location o f t (d t ) is the minimum overall probability of failure for stages t+1, 3 obtainable when you enter stage t with d t backup disk drives available for allocation o The recursive value relationship is: f d ) min { p ( ) f ( d )} t where 0 t 2. t( t t t t 1 t t As usual, the first table (for location C) is relatively simple. The recursive value relationship is just f d ) min { p ( )} because we not have to worry about stages beyond stage C. The C( C C C C resulting table is: d C C =0 C =1 C =2 f C (d C ) The second stage (covering locations B and C) has the recursive relationship f d ) min { p ( ) f ( d )}. As you can see, the minimum function f( ) appears on B B( B B B C B B both sides of the relationship as we epect. The stage B table is: d B B =0 B =1 B =2 f B (d B ) d C =d B B Practical Optimization: a Gentle Introduction John W. Chinneck,

11 Let s make sure we understand this table. Consider the row in which d B =1 and the column in which B =0, which has a cell value of Where does that value come from? Well, if we have one backup disk drive left to allocate (i.e. d B =1) and we decide not to allocate it to location B (i.e. B =0), then the probability of failure of location B is 0.30, but we still have one backup disk drive left to allocate, so now we enter the stage C table on the d C =1 line, and the best decision in that line has a value of 0.25, so our recursive relationship for stage B gives a lowest probability of failure under these conditions of =0.075 for stage B and C. This is the value in that cell. See if you can see why the other cells have the values they do. Now we come to the last stage, stage A, which will encompass stages B and C as well and will then encompass the entire original problem, our signal to stop. The recursive relationship for stage A is f d ) min { p ( ) f ( d )}. The stage A table is again somewhat simpler A A( A A A B A A than the others since we know the number of backup disk drives available when we start the problem: it is eactly 2. We don t have to worry about intermediate numbers as we do for stages B and C. d A A =0 A =1 A =2 f A (d A ) d B =d A A Let s review again where the numbers in this table come from. Let s consider the optimum solution in the A =2 column, which has a value of That results from the stage A value of assigning 2 backup disk drives to stage A (i.e. 0.05) multiplied by the value of the best action given that you go forward to the net table with 0 backup disk drives left to distribute: the d B =0 row in the stage B table has a best value of 0.12, so the final result is = Note that we don t have to look at the stage C table at all to make this calculation. That s because the stage B table already incorporates all the information from the stage C table. This is a general property of dynamic programming: you only need to look at the current stage and one other optimum solution. There is not very much savings from this property in this tiny eample, but there can be a huge savings when you have a large problem with many stages. So at this point we know that the optimum solution has a minimum probability of failure of , but we still need to unwind the recursion to find the actual assignment of backup drives to locations that achieves this result (pretty simple in this eample). It goes like this: From the stage A table we see that of the 2 backup drives available, 2 should be assigned to stage A. So we enter the stage B table with 0 backup drives, and the optimum decision in this case is to assign 0 backup drives to stage B. So we enter the stage C table with 0 backup drives, and the optimum decision in this case is to assign 0 backup drives to stage C. This eample shows some of the generality of dynamic programming. The recursive relationship is multiplicative in this case, so there is no possibility of some kind of conversion to linear programming. Plus it also shows the value of redundancy in designing failsafe systems! Practical Optimization: a Gentle Introduction John W. Chinneck,

12 Final Comments on Dynamic Programming We have dealt thus far with the simplest possible case for dynamic programming: discrete and deterministic problems in which the direction of solution really didn t matter. Let s discuss each of these cases. First, there are problems which must be done by backwards recursion. For eample, consider the employee scheduling problem in which we must choose the number of employees working in each month over the net year. For each month we have forecasts of the number needed to do the work. However skilled workers are hard to hire, so layoffs are to be avoided since they incur a cost and we may not get the workers back. On the other hand, ecess employees are costly. The problem is to determine how many employees to hire and lay off every month to minimize overall costs. It is hugely more efficient to solve this problem working backwards in time since we know the numbers of employees needed each month. If we work forwards in time, then we have to keep track of a huge number of possible staffing levels that might be needed at future times instead of the small number of known staffing levels. Continuous models (e.g. water level behind a dam) can be handled by finding meaningful break points in the continuum (e.g. empty, minimum level for water supply, minimum level for hydroelectricity generation, full). Probabilistic versions of dynamic programming are also possible; the goal is then to minimize or maimize the epected value of the recursive value relationship. Finally it s important to understand that dynamic programming, though tedious to carry out by hand, is actually quite efficient compared to a brute force listing of all possible combinations to find the best one. For eample, if you are finding your way through a graph which has 5 possible nodes to go to at each of 6 stages (and is fully connected between each stage), then there are 5 5 =3125 possible paths if they are all enumerated, and each of these requires 5 addition operations for 15,625 total operations. However an analysis of a Dijkstra s algorithm dynamic programming solution shows that it takes just 105 operations. Hence the dynamic programming solution requires just 105/ of the work! Practical Optimization: a Gentle Introduction John W. Chinneck,

### Chapter 10: Network Flow Programming

Chapter 10: Network Flow Programming Linear programming, that amazingly useful technique, is about to resurface: many network problems are actually just special forms of linear programs! This includes,

### Chapter 13: Binary and Mixed-Integer Programming

Chapter 3: Binary and Mixed-Integer Programming The general branch and bound approach described in the previous chapter can be customized for special situations. This chapter addresses two special situations:

### Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture - 15 Limited Resource Allocation Today we are going to be talking about

### Introduction to Diophantine Equations

Introduction to Diophantine Equations Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles September, 2006 Abstract In this article we will only touch on a few tiny parts of the field

### Chapter 11: PERT for Project Planning and Scheduling

Chapter 11: PERT for Project Planning and Scheduling PERT, the Project Evaluation and Review Technique, is a network-based aid for planning and scheduling the many interrelated tasks in a large and complex

### Linear Programming Notes VII Sensitivity Analysis

Linear Programming Notes VII Sensitivity Analysis 1 Introduction When you use a mathematical model to describe reality you must make approximations. The world is more complicated than the kinds of optimization

### Two Ways of Thinking about Dynamic Programming Jeff Edmonds

Two Ways of Thinking about Dynamic Programming Jeff Edmonds Here are two set of steps that you could follow to design a new dynamic programming algorithm. The first are the steps that I teach in 3101 using

### LINEAR PROGRAMMING THE SIMPLEX METHOD

LINEAR PROGRAMMING THE SIMPLE METHOD () Problems involving both slack and surplus variables A linear programming model has to be extended to comply with the requirements of the simplex procedure, that

### Dynamic programming formulation

1.24 Lecture 14 Dynamic programming: Job scheduling Dynamic programming formulation To formulate a problem as a dynamic program: Sort by a criterion that will allow infeasible combinations to be eli minated

### SIMS 255 Foundations of Software Design. Complexity and NP-completeness

SIMS 255 Foundations of Software Design Complexity and NP-completeness Matt Welsh November 29, 2001 mdw@cs.berkeley.edu 1 Outline Complexity of algorithms Space and time complexity ``Big O'' notation Complexity

### Chapter 6: Sensitivity Analysis

Chapter 6: Sensitivity Analysis Suppose that you have just completed a linear programming solution which will have a major impact on your company, such as determining how much to increase the overall production

### The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science

Trees Mathematically speaking trees are a special class of a graph. The relationship of a trees to a graph is very important in solving many problems in Maths and Computer Science However, in computer

### Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture - 9 Basic Scheduling with A-O-A Networks Today we are going to be talking

### 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT

DECISION 1 Revision Notes 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT Make sure you show comparisons clearly and label each pass First Pass 8 4 3 6 1 4 8 3 6 1 4 3 8 6 1 4 3 6 8 1

### Chapter 5: Solving General Linear Programs

Chapter 5: Solving General Linear Programs So far we have concentrated on linear programs that are in standard form, which have a maximization objective, all constraints of type, all of the right hand

### Chapter 4: The Mechanics of the Simplex Method

Chapter 4: The Mechanics of the Simplex Method The simplex method is a remarkably simple and elegant algorithmic engine for solving linear programs. In this chapter we will examine the internal mechanics

### Dynamic programming. Doctoral course Optimization on graphs - Lecture 4.1. Giovanni Righini. January 17 th, 2013

Dynamic programming Doctoral course Optimization on graphs - Lecture.1 Giovanni Righini January 1 th, 201 Implicit enumeration Combinatorial optimization problems are in general NP-hard and we usually

### Network Models 8.1 THE GENERAL NETWORK-FLOW PROBLEM

Network Models 8 There are several kinds of linear-programming models that exhibit a special structure that can be exploited in the construction of efficient algorithms for their solution. The motivation

### Mathematics More Visual Using Algebra Tiles

www.cpm.org Chris Mikles CPM Educational Program A California Non-profit Corporation 33 Noonan Drive Sacramento, CA 958 (888) 808-76 fa: (08) 777-8605 email: mikles@cpm.org An Eemplary Mathematics Program

### Approximation Algorithms

Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

### The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints

### Dynamic Programming 11.1 AN ELEMENTARY EXAMPLE

Dynamic Programming Dynamic programming is an optimization approach that transforms a complex problem into a sequence of simpler problems; its essential characteristic is the multistage nature of the optimization

### COLORED GRAPHS AND THEIR PROPERTIES

COLORED GRAPHS AND THEIR PROPERTIES BEN STEVENS 1. Introduction This paper is concerned with the upper bound on the chromatic number for graphs of maximum vertex degree under three different sets of coloring

### CPM Educational Program

CPM Educational Program A California, Non-Profit Corporation Chris Mikles, National Director (888) 808-4276 e-mail: mikles @cpm.org CPM Courses and Their Core Threads Each course is built around a few

### Chapter 5.1 Systems of linear inequalities in two variables.

Chapter 5. Systems of linear inequalities in two variables. In this section, we will learn how to graph linear inequalities in two variables and then apply this procedure to practical application problems.

### Solving Quadratic Equations by Graphing. Consider an equation of the form. y ax 2 bx c a 0. In an equation of the form

SECTION 11.3 Solving Quadratic Equations b Graphing 11.3 OBJECTIVES 1. Find an ais of smmetr 2. Find a verte 3. Graph a parabola 4. Solve quadratic equations b graphing 5. Solve an application involving

### Unit 1 Number Sense. In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions.

Unit 1 Number Sense In this unit, students will study repeating decimals, percents, fractions, decimals, and proportions. BLM Three Types of Percent Problems (p L-34) is a summary BLM for the material

### Kenken For Teachers. Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 27, 2010. Abstract

Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles June 7, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic skills.

### Lecture 5: Conic Optimization: Overview

EE 227A: Conve Optimization and Applications January 31, 2012 Lecture 5: Conic Optimization: Overview Lecturer: Laurent El Ghaoui Reading assignment: Chapter 4 of BV. Sections 3.1-3.6 of WTB. 5.1 Linear

### Polynomial Degree and Finite Differences

CONDENSED LESSON 7.1 Polynomial Degree and Finite Differences In this lesson you will learn the terminology associated with polynomials use the finite differences method to determine the degree of a polynomial

### max cx s.t. Ax c where the matrix A, cost vector c and right hand side b are given and x is a vector of variables. For this example we have x

Linear Programming Linear programming refers to problems stated as maximization or minimization of a linear function subject to constraints that are linear equalities and inequalities. Although the study

### Project Scheduling: PERT/CPM

Project Scheduling: PERT/CPM CHAPTER 8 LEARNING OBJECTIVES After completing this chapter, you should be able to: 1. Describe the role and application of PERT/CPM for project scheduling. 2. Define a project

### Leaving Certificate Technology. Project Management. Teacher Notes

Leaving Certificate Technology Project Management Teacher Notes 1 Project Management This is the first of three key topics that form Project and Quality Management in the Technology Syllabus core. These

### Linear Programming. Solving LP Models Using MS Excel, 18

SUPPLEMENT TO CHAPTER SIX Linear Programming SUPPLEMENT OUTLINE Introduction, 2 Linear Programming Models, 2 Model Formulation, 4 Graphical Linear Programming, 5 Outline of Graphical Procedure, 5 Plotting

### Probability and Expected Value

Probability and Expected Value This handout provides an introduction to probability and expected value. Some of you may already be familiar with some of these topics. Probability and expected value are

### EXAMPLE A Evaluate the expression without a calculator. Then, enter the expression into your calculator to see if you get the same answer.

CONDENSED L E S S O N 4.1 Order of Operations and the Distributive Property In this lesson you will apply the order of operations to evaluate epressions use the distributive property to do mental math

### 5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1

5 INTEGER LINEAR PROGRAMMING (ILP) E. Amaldi Fondamenti di R.O. Politecnico di Milano 1 General Integer Linear Program: (ILP) min c T x Ax b x 0 integer Assumption: A, b integer The integrality condition

### SUPPLEMENT TO CHAPTER

SUPPLEMENT TO CHAPTER 6 Linear Programming SUPPLEMENT OUTLINE Introduction and Linear Programming Model, 2 Graphical Solution Method, 5 Computer Solutions, 14 Sensitivity Analysis, 17 Key Terms, 22 Solved

### Section P.9 Notes Page 1 P.9 Linear Inequalities and Absolute Value Inequalities

Section P.9 Notes Page P.9 Linear Inequalities and Absolute Value Inequalities Sometimes the answer to certain math problems is not just a single answer. Sometimes a range of answers might be the answer.

### Fractions and Decimals

Fractions and Decimals Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles December 1, 2005 1 Introduction If you divide 1 by 81, you will find that 1/81 =.012345679012345679... The first

### Arithmetic Circuits Addition, Subtraction, & Multiplication

Arithmetic Circuits Addition, Subtraction, & Multiplication The adder is another classic design example which we are obliged look at. Simple decimal arithmetic is something which we rarely give a second

### 11 Dynamic Programming

11 Dynamic Programming EXAMPLE 1 Dynamic programming is a useful mathematical technique for making a sequence of interrelated decisions. It provides a systematic procedure for determining the optimal combination

### The Problem of Scheduling Technicians and Interventions in a Telecommunications Company

The Problem of Scheduling Technicians and Interventions in a Telecommunications Company Sérgio Garcia Panzo Dongala November 2008 Abstract In 2007 the challenge organized by the French Society of Operational

### Lecture 3. Linear Programming. 3B1B Optimization Michaelmas 2015 A. Zisserman. Extreme solutions. Simplex method. Interior point method

Lecture 3 3B1B Optimization Michaelmas 2015 A. Zisserman Linear Programming Extreme solutions Simplex method Interior point method Integer programming and relaxation The Optimization Tree Linear Programming

### IEOR 4404 Homework #2 Intro OR: Deterministic Models February 14, 2011 Prof. Jay Sethuraman Page 1 of 5. Homework #2

IEOR 4404 Homework # Intro OR: Deterministic Models February 14, 011 Prof. Jay Sethuraman Page 1 of 5 Homework #.1 (a) What is the optimal solution of this problem? Let us consider that x 1, x and x 3

. Quadratic Functions 9. Quadratic Functions You ma recall studing quadratic equations in Intermediate Algebra. In this section, we review those equations in the contet of our net famil of functions: the

### Analysis of Algorithms I: Optimal Binary Search Trees

Analysis of Algorithms I: Optimal Binary Search Trees Xi Chen Columbia University Given a set of n keys K = {k 1,..., k n } in sorted order: k 1 < k 2 < < k n we wish to build an optimal binary search

### Min-cost flow problems and network simplex algorithm

Min-cost flow problems and network simplex algorithm The particular structure of some LP problems can be sometimes used for the design of solution techniques more efficient than the simplex algorithm.

### Fast Sequential Summation Algorithms Using Augmented Data Structures

Fast Sequential Summation Algorithms Using Augmented Data Structures Vadim Stadnik vadim.stadnik@gmail.com Abstract This paper provides an introduction to the design of augmented data structures that offer

### Architecting Large Networks

MIT 6.02 DRAFT Lecture Notes Spring 2010 (Last update: May 4, 2010) Comments, questions or bug reports? Please contact 6.02-staff@mit.edu LECTURE 24 Architecting Large Networks The network layer mechanisms

### Bonus Maths 2: Variable Bet Sizing in the Simplest Possible Game of Poker (JB)

Bonus Maths 2: Variable Bet Sizing in the Simplest Possible Game of Poker (JB) I recently decided to read Part Three of The Mathematics of Poker (TMOP) more carefully than I did the first time around.

### Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4

Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4 I. Algorithm Design and Divide-and-Conquer There are various strategies we

### The Goldberg Rao Algorithm for the Maximum Flow Problem

The Goldberg Rao Algorithm for the Maximum Flow Problem COS 528 class notes October 18, 2006 Scribe: Dávid Papp Main idea: use of the blocking flow paradigm to achieve essentially O(min{m 2/3, n 1/2 }

### Introduction to Accounting

Introduction to Accounting Text File Slide 1 Introduction to Accounting Welcome to SBA s online training course, Introduction to Accounting. This program is a product of the agency s Small Business Training

### Project Scheduling: PERT/CPM

Project Scheduling: PERT/CPM Project Scheduling with Known Activity Times (as in exercises 1, 2, 3 and 5 in the handout) and considering Time-Cost Trade-Offs (as in exercises 4 and 6 in the handout). This

### Problem Solving Basics and Computer Programming

Problem Solving Basics and Computer Programming A programming language independent companion to Roberge/Bauer/Smith, "Engaged Learning for Programming in C++: A Laboratory Course", Jones and Bartlett Publishers,

### Induction Problems. Tom Davis November 7, 2005

Induction Problems Tom Davis tomrdavis@earthlin.net http://www.geometer.org/mathcircles November 7, 2005 All of the following problems should be proved by mathematical induction. The problems are not necessarily

### Parallelization of a "Masyu" Puzzle solver

John Lilley Parallelization of a "Masyu" Puzzle solver The "Masyu" (aka "Pearls") puzzle consists of a rectangular board divided into rows and columns, on which a number of white and black "pearls" are

### Return on Investment (ROI)

ROI 1 Return on Investment (ROI) Prepared by Sarah Major What is ROI? Return on investment (ROI) is a measure that investigates the amount of additional profits produced due to a certain investment. Businesses

### Objectives. By the time the student is finished with this section of the workbook, he/she should be able

QUADRATIC FUNCTIONS Completing the Square..95 The Quadratic Formula....99 The Discriminant... 0 Equations in Quadratic Form.. 04 The Standard Form of a Parabola...06 Working with the Standard Form of a

### File Management. Chapter 12

Chapter 12 File Management File is the basic element of most of the applications, since the input to an application, as well as its output, is usually a file. They also typically outlive the execution

### 1. LINEAR EQUATIONS. A linear equation in n unknowns x 1, x 2,, x n is an equation of the form

1. LINEAR EQUATIONS A linear equation in n unknowns x 1, x 2,, x n is an equation of the form a 1 x 1 + a 2 x 2 + + a n x n = b, where a 1, a 2,..., a n, b are given real numbers. For example, with x and

### Competitive Analysis of On line Randomized Call Control in Cellular Networks

Competitive Analysis of On line Randomized Call Control in Cellular Networks Ioannis Caragiannis Christos Kaklamanis Evi Papaioannou Abstract In this paper we address an important communication issue arising

### Performing equity investment simulations with the portfoliosim package

Performing equity investment simulations with the portfoliosim package Kyle Campbell, Jeff Enos, and David Kane February 18, 2010 Abstract The portfoliosim package provides a flexible system for back-testing

### Grade 6 Math Circles. Binary and Beyond

Faculty of Mathematics Waterloo, Ontario N2L 3G1 The Decimal System Grade 6 Math Circles October 15/16, 2013 Binary and Beyond The cool reality is that we learn to count in only one of many possible number

### 7.7 Solving Rational Equations

Section 7.7 Solving Rational Equations 7 7.7 Solving Rational Equations When simplifying comple fractions in the previous section, we saw that multiplying both numerator and denominator by the appropriate

### The Knapsack Problem. Decisions and State. Dynamic Programming Solution Introduction to Algorithms Recitation 19 November 23, 2011

The Knapsack Problem You find yourself in a vault chock full of valuable items. However, you only brought a knapsack of capacity S pounds, which means the knapsack will break down if you try to carry more

### Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams

Scheduling Home Health Care with Separating Benders Cuts in Decision Diagrams André Ciré University of Toronto John Hooker Carnegie Mellon University INFORMS 2014 Home Health Care Home health care delivery

### Finance 400 A. Penati - G. Pennacchi Market Micro-Structure: Notes on the Kyle Model

Finance 400 A. Penati - G. Pennacchi Market Micro-Structure: Notes on the Kyle Model These notes consider the single-period model in Kyle (1985) Continuous Auctions and Insider Trading, Econometrica 15,

### COST-VOLUME-PROFIT RELATIONSHIPS

TM 5-1 COST-VOLUME-PROFIT RELATIONSHIPS Cost-volume-profit (CVP) analysis is concerned with the effects on net operating income of: Selling prices. Sales volume. Unit variable costs. Total fixed costs.

### Pre-Algebra Class 3 - Fractions I

Pre-Algebra Class 3 - Fractions I Contents 1 What is a fraction? 1 1.1 Fractions as division............................... 2 2 Representations of fractions 3 2.1 Improper fractions................................

### Dividing Polynomials; Remainder and Factor Theorems

Dividing Polynomials; Remainder and Factor Theorems In this section we will learn how to divide polynomials, an important tool needed in factoring them. This will begin our algebraic study of polynomials.

### Section 7.2 Linear Programming: The Graphical Method

Section 7.2 Linear Programming: The Graphical Method Man problems in business, science, and economics involve finding the optimal value of a function (for instance, the maimum value of the profit function

### Introduction to the Smith Chart for the MSA Sam Wetterlin 10/12/09 Z +

Introduction to the Smith Chart for the MSA Sam Wetterlin 10/12/09 Quick Review of Reflection Coefficient The Smith chart is a method of graphing reflection coefficients and impedance, and is often useful

### SAT Math Hard Practice Quiz. 5. How many integers between 10 and 500 begin and end in 3?

SAT Math Hard Practice Quiz Numbers and Operations 5. How many integers between 10 and 500 begin and end in 3? 1. A bag contains tomatoes that are either green or red. The ratio of green tomatoes to red

### Decision Mathematics 1 TUESDAY 22 JANUARY 2008

ADVANCED SUBSIDIARY GCE 4736/01 MATHEMATICS Decision Mathematics 1 TUESDAY 22 JANUARY 2008 Additional materials: Answer Booklet (8 pages) Graph paper Insert for Questions 3 and 4 List of Formulae (MF1)

### MATHEMATICS Unit Decision 1

General Certificate of Education January 2008 Advanced Subsidiary Examination MATHEMATICS Unit Decision 1 MD01 Tuesday 15 January 2008 9.00 am to 10.30 am For this paper you must have: an 8-page answer

### 10.1. Solving Quadratic Equations. Investigation: Rocket Science CONDENSED

CONDENSED L E S S O N 10.1 Solving Quadratic Equations In this lesson you will look at quadratic functions that model projectile motion use tables and graphs to approimate solutions to quadratic equations

### Budgeting. Once the year is over, company leaders often think that the budget no longer serves a purpose.

Calculating Part 3 of 3 Operating Variances Completing a Benchmarking Analysis with Your Excel-based Master Budget By Jason Porter and Teresa Stephenson, CMA Budgeting. Once the year is over, company leaders

### Industry Environment and Concepts for Forecasting 1

Table of Contents Industry Environment and Concepts for Forecasting 1 Forecasting Methods Overview...2 Multilevel Forecasting...3 Demand Forecasting...4 Integrating Information...5 Simplifying the Forecast...6

### Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

### Linear Equations in Linear Algebra

1 Linear Equations in Linear Algebra 1.2 Row Reduction and Echelon Forms ECHELON FORM A rectangular matrix is in echelon form (or row echelon form) if it has the following three properties: 1. All nonzero

### 4.2 Description of the Event operation Network (EON)

Integrated support system for planning and scheduling... 2003/4/24 page 39 #65 Chapter 4 The EON model 4. Overview The present thesis is focused in the development of a generic scheduling framework applicable

### Session 7 Fractions and Decimals

Key Terms in This Session Session 7 Fractions and Decimals Previously Introduced prime number rational numbers New in This Session period repeating decimal terminating decimal Introduction In this session,

### Using the Simplex Method in Mixed Integer Linear Programming

Integer Using the Simplex Method in Mixed Integer UTFSM Nancy, 17 december 2015 Using the Simplex Method in Mixed Integer Outline Mathematical Programming Integer 1 Mathematical Programming Optimisation

### Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach

### Branch-and-Price Approach to the Vehicle Routing Problem with Time Windows

TECHNISCHE UNIVERSITEIT EINDHOVEN Branch-and-Price Approach to the Vehicle Routing Problem with Time Windows Lloyd A. Fasting May 2014 Supervisors: dr. M. Firat dr.ir. M.A.A. Boon J. van Twist MSc. Contents

### Load Balancing and Termination Detection

Chapter 7 slides7-1 Load Balancing and Termination Detection slides7-2 Load balancing used to distribute computations fairly across processors in order to obtain the highest possible execution speed. Termination

### Optimization: Optimal Pricing with Elasticity

Chapter 7 Load Balancing and Termination Detection Load balancing used to distribute computations fairly across processors in order to obtain the highest possible execution speed. Termination detection

### Kapitel 1 Multiplication of Long Integers (Faster than Long Multiplication)

Kapitel 1 Multiplication of Long Integers (Faster than Long Multiplication) Arno Eigenwillig und Kurt Mehlhorn An algorithm for multiplication of integers is taught already in primary school: To multiply

### Project Management Chapter 3

Project Management Chapter 3 How Project Management fits the Operations Management Philosophy Operations As a Competitive Weapon Operations Strategy Project Management Process Strategy Process Analysis

### Packet 1 for Unit 2 Intercept Form of a Quadratic Function. M2 Alg 2

Packet 1 for Unit Intercept Form of a Quadratic Function M Alg 1 Assignment A: Graphs of Quadratic Functions in Intercept Form (Section 4.) In this lesson, you will: Determine whether a function is linear

### Problem Set 7 Solutions

8 8 Introduction to Algorithms May 7, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Handout 25 Problem Set 7 Solutions This problem set is due in

### Confidence Intervals on Effect Size David C. Howell University of Vermont

Confidence Intervals on Effect Size David C. Howell University of Vermont Recent years have seen a large increase in the use of confidence intervals and effect size measures such as Cohen s d in reporting