PySCIPOpt icon indicating copy to clipboard operation
PySCIPOpt copied to clipboard

test_pricer.py giving wrong answer

Open sandropa opened this issue 2 years ago • 4 comments

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.

sandropa avatar May 15 '24 15:05 sandropa

Hello, @sandropa! Why do you say that it's wrong? The given solution seems to work:

image

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.

Joao-Dionisio avatar May 15 '24 16:05 Joao-Dionisio

The answer is wrong for the demand [3, 4, 4]. image

sandropa avatar May 15 '24 18:05 sandropa

Thank you for this issue @sandropa! There was a mistake in displaying the solution. The actual solution is this:

image

(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.

Joao-Dionisio avatar May 15 '24 18:05 Joao-Dionisio

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!

Joao-Dionisio avatar May 17 '24 06:05 Joao-Dionisio