178k views
1 vote
Consider a modification of the rod-cutting problem in which, in addition to a price pi for each rod, each cut incurs a fixed cost of c. The revenue associated with a solution is now the sum of the prices of the pieces minus the costs of making the cuts. Give a dynamic-programming algorithm to solve this modified problem. g

User Ernd Enson
by
3.1k points

2 Answers

1 vote

Final answer:

A dynamic-programming algorithm for the modified rod-cutting problem aims to maximize revenue by considering prices of rod segments and the costs incurred by each cut, to find the most profitable cutting strategy.

Step-by-step explanation:

The main goal in the modified rod-cutting problem is to maximize revenue while considering both the selling price of the segments and the costs associated with making cuts. The dynamic-programming algorithm would calculate the best way to cut the rod into pieces by comparing the price obtained for each piece minus the cutting cost to find the combination with the highest revenue. To achieve this, the algorithm would start from the smallest pieces and build up to the full length of the rod, considering all possible places to cut and factoring in the cost for each potential cut. By comparing the sum of the prices for each piece minus the fixed costs of cuts against the best options found for shorter lengths, it can determine the most profitable way to cut the rod at every length until the full length of the rod is considered.

User VenkatKA
by
3.3k points
6 votes

Answer:

Check the explanation

Step-by-step explanation:

We muddy pseudo code for BOTTOM-UP-CUT-ROD by simply adding —c inside the parenthesis you have in line 6 (because that is were cut is made),

so that now it reads like this:


q=max(q,p[i]+r[j-i]-c)

the after results will look like:

Modify pseudo code for BOTTOM-UP-CUT-ROD

User Rputikar
by
3.6k points