# Chapter 15: Dynamic Programming

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:

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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

### 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.

### 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

### 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

### 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

### 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

### 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

### 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

### 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.

### 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 }

### 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

### 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

### 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

### 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

### 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

### Information, Entropy, and Coding

Chapter 8 Information, Entropy, and Coding 8. The Need for Data Compression To motivate the material in this chapter, we first consider various data sources and some estimates for the amount of data associated

### 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

### 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

### 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

### 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

### 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)

### 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

### How Traditional Physical Backup Imaging Technology Fits Into a Virtual Backup Solution

Virtualization Backup and Recovery Solutions for the SMB Market The Essentials Series How Traditional Physical Backup Imaging Technology Fits Into a Virtual Backup Solution sponsored by Introduction to

### 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

### 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

### 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

### 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

### 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,

### 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

### 8.1 Min Degree Spanning Tree

CS880: Approximations Algorithms Scribe: Siddharth Barman Lecturer: Shuchi Chawla Topic: Min Degree Spanning Tree Date: 02/15/07 In this lecture we give a local search based algorithm for the Min Degree

### 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

### 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

### 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

### 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

### 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,

### 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

### 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

### 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

### 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

### 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,

### 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

### Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Outline NP-completeness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2-pairs sum vs. general Subset Sum Reducing one problem to another Clique

### Lecture 10: Regression Trees

Lecture 10: Regression Trees 36-350: Data Mining October 11, 2006 Reading: Textbook, sections 5.2 and 10.5. The next three lectures are going to be about a particular kind of nonlinear predictive model,

### Lecture 4 Online and streaming algorithms for clustering

CSE 291: Geometric algorithms Spring 2013 Lecture 4 Online and streaming algorithms for clustering 4.1 On-line k-clustering To the extent that clustering takes place in the brain, it happens in an on-line

### 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 Sierra Clustered Database Engine, the technology at the heart of

A New Approach: Clustrix Sierra Database Engine The Sierra Clustered Database Engine, the technology at the heart of the Clustrix solution, is a shared-nothing environment that includes the Sierra Parallel

### Multi-layer MPLS Network Design: the Impact of Statistical Multiplexing

Multi-layer MPLS Network Design: the Impact of Statistical Multiplexing Pietro Belotti, Antonio Capone, Giuliana Carello, Federico Malucelli Tepper School of Business, Carnegie Mellon University, Pittsburgh

### Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II

Intermediate Math Circles March 7, 2012 Linear Diophantine Equations II Last week: How to find one solution to a linear Diophantine equation This week: How to find all solutions to a linear Diophantine

### Zeros of a Polynomial Function

Zeros of a Polynomial Function An important consequence of the Factor Theorem is that finding the zeros of a polynomial is really the same thing as factoring it into linear factors. In this section we

### IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti

### Management Information System Prof. Biswajit Mahanty Department of Industrial Engineering & Management Indian Institute of Technology, Kharagpur

Management Information System Prof. Biswajit Mahanty Department of Industrial Engineering & Management Indian Institute of Technology, Kharagpur Lecture - 02 Introduction Part II Welcome to all of you

### CHAPTER 3: PRODUCTION BILL OF MATERIALS

Chapter 3: Production Bill of Materials CHAPTER 3: PRODUCTION BILL OF MATERIALS Training Objectives In this chapter, you should learn about: Production Bill of Materials (BOM) Production BOM Advanced Features

### Offline 1-Minesweeper is NP-complete

Offline 1-Minesweeper is NP-complete James D. Fix Brandon McPhail May 24 Abstract We use Minesweeper to illustrate NP-completeness proofs, arguments that establish the hardness of solving certain problems.

### 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

### INVESTIGATIONS AND FUNCTIONS 1.1.1 1.1.4. Example 1

Chapter 1 INVESTIGATIONS AND FUNCTIONS 1.1.1 1.1.4 This opening section introduces the students to man of the big ideas of Algebra 2, as well as different was of thinking and various problem solving strategies.

### 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

### Laboratory work in AI: First steps in Poker Playing Agents and Opponent Modeling

Laboratory work in AI: First steps in Poker Playing Agents and Opponent Modeling Avram Golbert 01574669 agolbert@gmail.com Abstract: While Artificial Intelligence research has shown great success in deterministic

### Notes on Factoring. MA 206 Kurt Bryan

The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor

### Calc Guide Chapter 9 Data Analysis

Calc Guide Chapter 9 Data Analysis Using Scenarios, Goal Seek, Solver, others Copyright This document is Copyright 2007 2011 by its contributors as listed below. You may distribute it and/or modify it

### The number of marks is given in brackets [ ] at the end of each question or part question. The total number of marks for this paper is 72.

ADVANCED SUBSIDIARY GCE UNIT 4736/01 MATHEMATICS Decision Mathematics 1 THURSDAY 14 JUNE 2007 Afternoon Additional Materials: Answer Booklet (8 pages) List of Formulae (MF1) Time: 1 hour 30 minutes INSTRUCTIONS

### Chapter 6 Cost-Volume-Profit Relationships

Chapter 6 Cost-Volume-Profit Relationships Solutions to Questions 6-1 The contribution margin (CM) ratio is the ratio of the total contribution margin to total sales revenue. It can be used in a variety

### Core Maths C2. Revision Notes

Core Maths C Revision Notes November 0 Core Maths C Algebra... Polnomials: +,,,.... Factorising... Long division... Remainder theorem... Factor theorem... 4 Choosing a suitable factor... 5 Cubic equations...

### 24. The Branch and Bound Method

24. The Branch and Bound Method It has serious practical consequences if it is known that a combinatorial problem is NP-complete. Then one can conclude according to the present state of science that no

### at which branching takes place, a "middleman," if you will. See the transship model panel. ABSTRACT

Optimal Solution of Discrete Resource Allocation Problems with SAS/OR Software by LTC Doug McAllaster, US Army Logistics Management College, Fort Lee, VA ABSTRACT This paper is a tutorial on how to use

### 3.2 The Factor Theorem and The Remainder Theorem

3. The Factor Theorem and The Remainder Theorem 57 3. The Factor Theorem and The Remainder Theorem Suppose we wish to find the zeros of f(x) = x 3 + 4x 5x 4. Setting f(x) = 0 results in the polynomial

### Check Digits for Detecting Recording Errors in Horticultural Research: Theory and Examples

HORTSCIENCE 40(7):1956 1962. 2005. Check Digits for Detecting Recording Errors in Horticultural Research: Theory and Examples W.R. Okie U.S. Department of Agriculture, Agricultural Research Service, Southeastern

### Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design

Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design Hongsik Choi and Hyeong-Ah Choi Department of Electrical Engineering and Computer Science George Washington University Washington,

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### REWARD System For Even Money Bet in Roulette By Izak Matatya

REWARD System For Even Money Bet in Roulette By Izak Matatya By even money betting we mean betting on Red or Black, High or Low, Even or Odd, because they pay 1 to 1. With the exception of the green zeros,

### Copyrighted Material. Chapter 1 DEGREE OF A CURVE

Chapter 1 DEGREE OF A CURVE Road Map The idea of degree is a fundamental concept, which will take us several chapters to explore in depth. We begin by explaining what an algebraic curve is, and offer two

### Multi-layer Structure of Data Center Based on Steiner Triple System

Journal of Computational Information Systems 9: 11 (2013) 4371 4378 Available at http://www.jofcis.com Multi-layer Structure of Data Center Based on Steiner Triple System Jianfei ZHANG 1, Zhiyi FANG 1,

### Computational Finance Options

1 Options 1 1 Options Computational Finance Options An option gives the holder of the option the right, but not the obligation to do something. Conversely, if you sell an option, you may be obliged to

### Bandcounter: Counting Bands of Multiband Chaotic Attractors

Course of Study: Computer Science Eaminer: Supervisor: Prof. Dr. rer. nat. habil. P. Levi Dr. Viktor Avrutin PD Dr. Michael Schanz Studienarbeit Nr. 2047 Bandcounter: Counting Bands of Multiband Chaotic

### Some Polynomial Theorems. John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.

Some Polynomial Theorems by John Kennedy Mathematics Department Santa Monica College 1900 Pico Blvd. Santa Monica, CA 90405 rkennedy@ix.netcom.com This paper contains a collection of 31 theorems, lemmas,

### Unit. Area Model Factoring. Research-based National Science Foundation-funded. Learning transforms lives.

Unit 10 Area Model Factoring Research-based National Science Foundation-funded Learning transforms lives. Dear Student, When we multiply two factors, we get their product. If we start with the product,

### Warshall s Algorithm: Transitive Closure

CS 0 Theory of Algorithms / CS 68 Algorithms in Bioinformaticsi Dynamic Programming Part II. Warshall s Algorithm: Transitive Closure Computes the transitive closure of a relation (Alternatively: all paths

### 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

### Part II Management Accounting Decision-Making Tools

Part II Management Accounting Decision-Making Tools Chapter 7 Chapter 8 Chapter 9 Cost-Volume-Profit Analysis Comprehensive Business Budgeting Incremental Analysis and Decision-making Costs Chapter 10

### Regular Languages and Finite Automata

Regular Languages and Finite Automata 1 Introduction Hing Leung Department of Computer Science New Mexico State University Sep 16, 2010 In 1943, McCulloch and Pitts [4] published a pioneering work on a