Example code for Python-bindings of the Pack() constraint ?

39 views
Skip to first unread message

Dirk Schroetter

unread,
Apr 11, 2013, 1:15:44 PM4/11/13
to or-tools...@googlegroups.com
Folks,

I was wondering if someone had shareable example code for the Python bindings of the Pack() API.

I have studied the "steel" examples in the examples directory, but fail to translate my model into what I am looking for.

The idea is that I have a number of capacitated demands that should be packed into a number of bins (of different capacities). The number of bins is fixed and the demands for a set of bins is stored in a BoolVar array.

Any pointers greatly appreciated.

Best Regards,

/Dirk

Laurent Perron

unread,
Apr 16, 2013, 9:37:43 AM4/16/13
to or-tools-discuss
Hello, 

If you already have the bool variables, you don't need the pack constraint.
Just add the correct for all bins j, sum(bi * size_i < capacity_j)

and you would be fine.

The pack constraints is here mostly to gain space and share the same boolean variables and propagation events on those variables internally. There is no fancy propagation.

--Laurent


--
You received this message because you are subscribed to the Google Groups "or-tools-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to or-tools-discu...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
--Laurent

Dirk Schroetter

unread,
Apr 17, 2013, 4:39:11 AM4/17/13
to or-tools...@googlegroups.com
Thanks Laurent,

worked around it as you suggested and works perfectly.

Best Regards,

/Dirk
Reply all
Reply to author
Forward
0 new messages