[gecode-users] On posting bin packing constraints
Christian Schulte
cschulte at kth.se
Tue Mar 12 19:46:29 CET 2013
Hi Stefano,
Completely agree and has already been requested by other users, so it is
already in the trunk!
But thanks for pointing out!
Cheers
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On
> Behalf Of Stefano Gualandi
> Sent: Thursday, March 07, 2013 2:35 PM
> To: users at gecode.org
> Subject: [gecode-users] On posting bin packing constraints
>
> 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
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
More information about the users
mailing list