%
% 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.
%
% Problem from Stack Overflow:
% "printing business cards - a kind of knapsack task"
% http://stackoverflow.com/questions/8779115/printing-business-cards-a-kind-of-knapsack-task
% """
% I am new to Prolog and I have some probably simple issue with a
% piece of code. This is a real world problem that arised last Friday
% and believe me this is not a CS Homework.
%
% We want to print business cards and these can only be printet in
% blocks of 900 cards (100 sheets with 9 cards per sheet). The cards
% for anybody should not be distributet over several blocks. People
% ordered different amount of cards, E.G:
%
% % "braucht" is german and means "needs"
% braucht(anton,400).
% braucht(berta,200).
% braucht(claudia,400).
% braucht(dorothee,100).
% braucht(edgar,200).
% braucht(frank,400).
% braucht(georg,100).
% """
%
% Note: We simplify it by dividing everything with 100.
%
num_jobs = 7; % num_stuff = 7;
% Original problem:
% num_workers = 900; % bin_capacity = 900;
% duration = [ 1, 1, 1, 1, 1, 1, 1];
% resource = [400,200,400,100,200,400,100];
% Simplified version:
num_workers = 9; % bin_capacity = 9;
duration = [1,1,1,1,1,1,1];
resource = [4,2,4,1,2,4,1];
max_time = num_workers; % optimal: 2
allow_idle = true;
collect_workers = false;
do_precendences = false;
num_precedences = 1;
precedences = array2d(1..num_precedences, 1..2,
[
0,0 % dummy
]);