Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You run a plant that produces sheets of aluminum alloy, and then you cut them to size for customers. Your machine produces rectangular sheets of
You run a plant that produces sheets of aluminum alloy, and then you cut them to size for customers.
Your machine produces rectangular sheets of dimension Q times R and you can cut any sheet into two
smaller sheets by making a vertical or horizontal cut at an integer location. So for example, if you
have a times sized piece, you have the following options that you could produce from a single cut:
Two times pieces from a horizontal cut at position
Two times pieces from a vertical cut at position
A times and a times piece from a vertical cut at position
Say you decide to make the cut that produces a times and a times piece. You could then subsequently
cut the times into two times pieces, and the times piece into a times piece and a times piece, and so on
Or you could stop cutting and sell a piece that youve created.
You can also rotate pieces so a times piece is the same as a times piece
Suppose you produce n different sized products, where product i has dimensions xi times yi and you
can sell product i for vi dollars. For examples, perhaps product is a times piece that you can sell
for $ and product is a times piece that you can sell for $ dollars. You can sell multiple copies
of the ith product if you can produce multiple pieces of that size from your original sheet. Assume
Q R xi yi and vi for i in n are positive integers. You will design an algorithm that figures
out your maximum profit among any possible sequence of horizontalvertical cuts.
a Provide pseudocode for a dynamic programming algorithm that outputs your maximum profit.
Note: your code doesnt have to output how you should actually divide the piece, just the
profit. The input to your algorithm should be Q R x y v where Q and R are the size of the
piece, array x contains the values xi array y contains the values yi and the array v contains the
values vi
b Explain why your algorithm is correct. You dont need to write a full proof, but you should
describe the logic behind the recurrences that you developed to create your algorithm and explain
how your algorithm checks the appropriate cases.
c What is the runtime of your algorithm in terms of Q R and n
d Explain briefly how you would modify your algorithm to tell you whether you should divide the
current sheet, and if so where you should make the cut
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started