Created
December 8, 2024 20:51
-
-
Save bokner/ad85166f23d8f44291c683d8b3980367 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include "globals.mzn"; | |
% Number of items | |
int: N; | |
% Bin capacity | |
int: C; | |
set of int: ITEMS = 1..N; | |
% Upper Bound on the number of bins used | |
int: max_bins = N; | |
set of int: BINS = 1..max_bins; | |
array[ITEMS] of int: item_sizes; | |
% What bin each item goes to | |
array[ITEMS] of var BINS: item_placement; | |
var BINS: total_bins; | |
constraint bin_packing(C, item_placement, item_sizes); | |
constraint total_bins = max(item_placement); | |
solve minimize total_bins; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Results: (1 minute run)