Rod cutting Decide where to cut steel rods:

Slides:



Advertisements
Similar presentations
Algorithms Chapter 15 Dynamic Programming - Rod
Advertisements

Solving IPs – Cutting Plane Algorithm General Idea: Begin by solving the LP relaxation of the IP problem. If the LP relaxation results in an integer solution,
UMass Lowell Computer Science Analysis of Algorithms Prof. Giampiero Pecelli Fall, 2010 Paradigms for Optimization Problems Dynamic Programming.
CSCI 6212 Design and Analysis of Algorithms Dynamic Programming Dr. Juman Byun The George Washington University Please drop this course if you have not.
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
Scholastic Aptitude Test (SAT)
Dynamic Programming.
How many squares can you count? Online Textbook: Activation Code: Create your online account!
EXAMPLE 4 Standardized Test Practice SOLUTION STEP 1 Convert meters to centimeters by multiplying by = 32,250, so m = 32,250.
Applications of Cubic Functions
1 Applications of Extrema OBJECTIVE  Solve maximum and minimum problems using calculus. 6.2.
Reminder: The Extreme Value Theorem states that every continuous function on a closed interval has both a maximum and a minimum value on that interval.
1 Chapter 6 Sensitivity Analysis and Duality PART 3 Mahmut Ali GÖKÇE.
Dynamic Programming CIS 606 Spring 2010.
Linear Approximations
KNAPSACK PROBLEM A dynamic approach. Knapsack Problem  Given a sack, able to hold K kg  Given a list of objects  Each has a weight and a value  Try.
1 times table 2 times table 3 times table 4 times table 5 times table
5.3 Break-Even Analysis Chapter 32.
COLLEGE ENTRY EXAM AVID: MATH ASSESSMENT PRACTICE.
GREATEST COMMON FACTOR GCF. Divisibility Rules 2, if it ends in a even number in the ones place (0,2,4,6,8). Example: 558 because there is a 8 in the.
Dynamic Programming Chapter 15 Highlights Charles Tappert Seidenberg School of CSIS, Pace University.
Sullivan PreCalculus Section 2.6 Mathematical Models: Constructing Functions Objectives Construct and analyze functions.
4.1 to 4.4 In this assignment, you will be able to... 1.Graph a function. Calculate the vertex and axis of symmetry. 3. Solve quadratics by factoring.
Evaluating Algebraic Expressions 2-6 Adding and Subtracting with Unlike Denominators NS1.2 Add, subtract, multiply, and divide rational numbers (integers,
OPTIMIZATION.
By Angel Acevedo The Question  #1: Fabian has a wooden board that is 13 feet long. He uses an electric saw to cut the board into five pieces. Every.
Translating Problems Into Equations Objective – To translate simple word problems into equations A word problem describes a situation in which certain.
CSC5101 Advanced Algorithms Analysis
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
Precalculus Section 2.4 Use polynomials to find maximum and minimum values Example 1 page 69 Area = length x width A(x) = (60 – 2x)(x) A(x) = 60x - 2x².
Tables Learning Support
Nonstandard Units of Measure SOL 6.10 Royal Foot and Hand The Royal Foot and Hand.
2.7 Mathematical Models Some will win, some will lose, some are born to sing the blues. Oh the movie never ends, it goes on and on and on and on. -Journey.
1 Exercise 1. (a) Find all optimal sequences for the scheduling problem 1 ||  w j C j with the following jobs. (b) Determine the effect of a change in.
You are Master of the Word. Be sure to read the directions in each problem.
Unit 1 Test Review. 1.What is the difference between 5x, x 5, and x -5 ? Use the polynomial to answer the following questions: 3x 2 – 4y – 6 2.What are.
 Graph is a parabola.  Either has a minimum or maximum point.  That point is called a vertex and is Quadratic Functions & Applications.
The ratio of boys to girls in the 6 th grade is 2 : 3. a. If there are 24 boys, how many girls are there?
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Maximum-Minimum (Optimization) Problems OBJECTIVE  Solve maximum and minimum.
Optimization Problems
Optimization. A company manufactures and sells x videophones per week. The weekly price-demand and cost equations are What price should the company charge.
This graph shows a parabola, what are the root(s) of this equation X=-1 X=-3.
Rod cutting Decide where to cut steel rods:
Design & Analysis of Algorithm Dynamic Programming
1.3 Applications.
Length Word Problems.
Times Tables.
Intoduction to Fractions
Benchmark 2 Review.
GCF Problem Solving How can you tell if a word problem requires you to use Greatest Common Factor?
Sample Foldable 1. Take out a piece of notebook paper and make a hot dog fold over from the right side over to the pink line.
3.6 Mathematical Models: Constructing Functions
2.7 Mathematical Models: Constructing Functions
1.6) Storing Integer:.
There are a total of 6/3 or 2 whole rectangles
Cutting Stock Problem Problem of cutting an unlimited number of pieces of material (paper rolls, for instance) of length l to produce ni pieces of length.
Dividing Fractions.
Tests of Divisibility 1 - All integers can be divided by 1
Optimization (Max/Min)
Dividing fractions Word problem.
Measuring Length Name: ________________________________
Prime Factorization Prime factorization or integer factorization of a number is the determination of the set of prime numbers which multiply together to.
2.7 Mathematical Models: Constructing Functions
Writing a Function Rule
3 times tables.
6 times tables.
Measurement.
Optimization (Max/Min)
Chapter 19 When you finish Take the worksheets
Divide 9 × by 3 ×
Presentation transcript:

Rod cutting Decide where to cut steel rods: Given a rod of length n inches and a table of prices pi, i=1,2,…,n, find the maximum revenue rn obtainable by cutting up the rod and selling the pieces Rod lengths are integers For i=1,2,…,n we know the price pi of a rod of length i inches

Example length I: 1 2 3 4 5 6 7 8 9 10 ------------------------------------------------ price pi: 1 5 8 9 10 17 17 20 24 30 For a rod of length 4: 2+2 is optimal (p2+p2=10) In general, can cut a rod of length n 2n-1 ways

If optimal sol. cuts rod in k pieces then optimal decomposition: n=i1+i2+…+ik Revenue: rn=pi1+pi2+…+pik In general: rn=max{pn,r1+rn-1,r2+rn-2,…,rn-1+r1} Initial cut of the rod: two pieces of size i and n-I Revenue ri and rn-i from those two pieces Need to consider all possible values of i May get better revenue if we sell the rod uncut

A different view of the problem Decomposition in A first, left-hand piece of length i A right-hand reminder of length n-i Only the reminder is further divided Then rn=max{pi+rn-i, 1 <= i <= n} Thus, need solution to only one subproblem

Top-down implementation CUT-ROD(p,n) if n==0 return 0 q = -∞ for i=1 to n q=max{q,p[i]+CUT-ROAD(p,n-i)} return q Time recurrence: T(n)=1+T(1)+T(2)+…+T(n-1) T(n)=O(2n)

Dynamic Programming Optimality of subproblems is obvious DP-CUT-ROD(p,n) let r[0..n], s[0..n] be new arrays r[0]=0 for j=1 to n q=-∞ for i=1 to j if q < p[i]+r[j-i] s[j]=i; q= p[i]+r[j-i] r[j]=q return r and s

Retrieving an optimal solution PRINT-CUT-ROD (r,s) = DP-CUT-ROD(p,n) while n>0 print s[n] n=n-s[n] Example: i 0 1 2 3 4 5 6 7 r[i] 0 1 5 8 10 13 17 18 s[i] 0 1 2 3 2 2 6 1