or-tools: multi-knapsacks (aka bin packing) problem
knapsack.py demonstrates problem with one knapsack and mentions that for multiple knapsacks we can pass an array of multiple capacities,
in the example - capacities = [850]
I want to do - capacities = [850, 850]
to find a solution with two knapsacks. It doesn’t work if I try it. Is it supposed to work? I am guessing so, because it’s an array.
I am currently using KNAPSACK_DYNAMIC_PROGRAMMING_SOLVER
. if I try to use the multidimensional solver I get the error -
AttributeError: type object ‘KnapsackSolver’ has no attribute ‘KNAPSACK_MULTIDIMENSION_SOLVER’
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 21
I would say you have https://github.com/google/or-tools/blob/master/examples/python/tasks_and_workers_assignment_sat.py simply remove workers or group and the remaining entity is your knapsacks
Also close to a “simple” assignment problem (except task/item can be not assigned to any worker) https://github.com/google/or-tools/blob/master/examples/python/assignment_sat.py