test_pricer.py giving wrong answer
Describe the bug
Function cuttingstock() is not giving the correct answer for the following example:
# item widths
widths = [3, 2, 1]
# width demand
demand = [3, 4, 3]
# roll length
rollLength = 4
The number of rolls needed is 6. However, the function gives the answer 5.
To Reproduce Comment the lines:
# item widths
widths = [14, 31, 36, 45]
# width demand
demand = [211, 395, 610, 97]
# roll length
rollLength = 100
Replace them with:
# item widths
widths = [3, 2, 1]
# width demand
demand = [3, 4, 3]
# roll length
rollLength = 4
Also, comment the lines that start with assert.
Expected behavior The sum of used cutting patterns should be 6.
Hello, @sandropa! Why do you say that it's wrong? The given solution seems to work:
Having
[item2, item2] + [item2, item2] + [item1, item3] + [item1, item3] + [item1, item3]
seems like it does the trick. 4 item2s, 3 item1s, 3 item3s. The length of each roll is 4 and the total number of rolls is 5.
The answer is wrong for the demand [3, 4, 4].
Thank you for this issue @sandropa! There was a mistake in displaying the solution. The actual solution is this:
(We are using 0.25 of a roll because this is only the linear relaxation)
The pricer itself seems correct, but there a couple of things that warrant changes.
Displayed solution fixed in #852.
I think that's everything, @sandropa. I'll be closing the issue, but if you feel like there are other things wrong, don't be afraid to reopen!