I have problem with my homework.
Given a board of dimensions m
x n
is given, cut this board into rectangular pieces with the best total price. A matrix gives the price for each possible board size up through the original, uncut board.
Consider a 2 x 2
board with the price matrix:
3 4
3 6
We have a constant cost for each cutting for example 1
.
Piece of length 1 x 1
is worth 3
.
Horizontal piece of length 1 x 2
is worth 4
.
Vertical piece of length 1 x 2
is worth 3
.
Whole board is worth 6
.
For this example, the optimal profit is 9, because we cut board into 1 x 1
pieces. Each piece is worth 3
and we done a 3
cut, so 4 x 3
- 3 x 1
= 9
.
Second example:
1 2
3 4
Now I have to consider all the solutions:
4
1x1
pieces is worth4x1 - (cost of cutting) 3x1 = 1
2
horizontal1x2 is worth 2x2 - (cost of cutting) 1x1 = 3
2
vertical1x2 is worth 3x2 - (cost of cutting) 1x1 = 5
-> best optimal profit1
horizontal1x2 + 2 x (1x1) pieces is worth 2 + 2 - (cost of cutting) 2 = 2
1
vertical1x2 + 2 x (1x1) pieces is worth 3 + 2 - (cost of cutting) 2 = 3
I've read a lot about rod cutting algorithm but I don't have any idea how to bite this problem. Do you have any ideas?