xcsp3team / pycsp3

A Python Library for modeling combinatorial constrained problems
https://www.pycsp.org
MIT License
61 stars 9 forks source link

is the BinPacking constraint working properly? #38

Closed cs-jlopezr closed 1 year ago

cs-jlopezr commented 1 year ago

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!

xcsp3team commented 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.

cs-jlopezr commented 1 year ago

You are right. I update the package and it is now working properly!