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 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 sized piece, you have the following options that you could produce from a single cut:
Two pieces from a horizontal cut at position
Two pieces from a vertical cut at position
A and a piece from a vertical cut at position
Say you decide to make the cut that produces a and a piece. You could then subsequently
cut the into two pieces, and the piece into a piece and a piece, and so on
Or you could stop cutting and sell a piece that you've created.
You can also rotate pieces so a piece is the same as a piece
Suppose you produce different sized products, where product i has dimensions and you
can sell product i for dollars. For examples, perhaps product is a piece that you can sell
for $ and product is a 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
and for iindots, 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 doesn't have to output how you should actually divide the piece, just the
profit. The input to your algorithm should be where and are the size of the
piece, array contains the values array contains the values and the array contains the
values
b Explain why your algorithm is correct. You don't 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 and
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