Closed cs-jlopezr closed 1 year ago
Hi,
I tested the code both on my computer (code in a file like you) and in Google colab (https://colab.research.google.com/?hl=fr): Three cells as follows: First cell (to be executed once) pip install pycsp3 Second cell: from pycsp3 import * Third cell: sizes = [10, 7, 3, 9, 5, 7, 8, 4, 6, 4] nItems = len(sizes)
x = VarArray(size=10, dom={0, 1, 2})
satisfy( BinPacking(x, sizes=sizes, limits=[23,20,21]) )
And everything is fine. It seems that you have an older version. This is the only explanation I get.
You are right. I update the package and it is now working properly!
I think the BinPacking constraint has some problems. When I use the second variant (which requires the parameter limits) I get this error even using the basic problem of the documentation:
Model:
from pycsp3 import *
sizes = [10, 7, 3, 9, 5, 7, 8, 4, 6, 4] nItems = len(sizes)
x = VarArray(size=10, dom={0, 1, 2})
satisfy( BinPacking(x, sizes=sizes, limits=[23,20,21]) );
Error:
File "/Users/jlopez/PhD/RobustSolutions/ROADEF/basic_binPacking.py", line 9, in
BinPacking(x, sizes=sizes, limits=[23,20,21])
TypeError: BinPacking() got an unexpected keyword argument 'limits'
Warning: no constraints for this model!