%
% Bin packing as a scheduling problem.
%
% Here we see the bin packing as a scheduling problem (with
% assignments) as follows:
% - the number of things to pack is the number of jobs
% - the capacity of each bin is the number of workers
% - the weight/height of each thing is the resource
% - all durations is set to 1
% - max_time is the number of workers
% - the minimum number of bins to use (to be minimized)
% is then - of course - the makespan.
%
%
% Cf http://www.hakank.org/minizinc/bin_packing_me.mzn
% where I have took this example.
%
% This problem instance is via
% http://yetanothermathprogrammingconsultant.blogspot.com/2011/08/bin-packing.html
% and is "critical" to the result in
% "Bin Packing, What is It?"
% http://www.developerfusion.com/article/5540/bin-packing/
% where the minimum bins are 19,
% whereas Erwin K's code have 17 as the optimal result.
%
num_jobs = 45; % num_stuff = 45;
num_workers = 80; % bin_capacity = 80;
resource = [ 26, 57, 18, 8, 45,
16, 22, 29, 5, 11,
8, 27, 54, 13, 17,
21, 63, 14, 16, 45,
6, 32, 57, 24, 18,
27, 54, 35, 12, 43,
36, 72, 14, 28, 3,
11, 46, 27, 42, 59,
26, 41, 15, 41, 68];
duration = [1 | i in 1..num_jobs];
max_time = 45; % optimal:
allow_idle = true;
collect_workers = false;
do_precendences = false;
num_precedences = 1;
precedences = array2d(1..num_precedences, 1..2,
[
0,0 % dummy
]);