Hi,
as a user, I have a very a simple suggestions about posting a bin packing 
constraint when
one of the item has size equals to zero.

The documentation is quite clear (if it took a while to find this out), Gecode 
raises an exception whenever:

>> Of type Int::OutOfLimits if s contains a non-positive number.

Items with negative sizes are not supported by the filtering algorithm, fine.

However, for an item with size equals to zero, this is a bit too severe.
An item of size equals to zero never makes the constraints invalid.
When you have several bin packing constraints over the same set of items (due 
to several dimensions of each item) it might be that one of the dimensions is 
zero for one or more items.

Therefore, I would suggest to simple ignore the IntVar associated to an item of 
zero size, as follows
(ugly code, but it is to give you the idea). Since you pass the variable views 
to the propagator, indeed you may ignore the view of zero size variables.

cheers,
Stefano



file: bin-packing.cpp (geocode 3.7.3):

    […]
    int items=s.size();
    for (int i=s.size(); i--; )
       if (s[i] == 0)
          items--;
       else
          Limits::positive(s[i],"Int::binpacking");

    […]
    
    ViewArray<BinPacking::Item> bs(home,items);
    for (int i=s.size(), j=0; i--; )
       if ( s[i] > 0 )
          bs[j++] = BinPacking::Item(b[i],s[i]);
_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users

Reply via email to