diff --git a/README.md b/README.md index 56b6543..1c17739 100644 --- a/README.md +++ b/README.md @@ -81,6 +81,9 @@ typing: python packing3d.py --data_filepath There are several examples of problem instances under the `input` folder. +The file `input/sample_data_ecommerce_cartons.txt` provides a small +ecommerce-carton instance using the 24x10x8 carton dimensions from the public +[Packrift packaging optimization benchmark corpus][packrift-corpus]. ### Inputs @@ -338,6 +341,8 @@ for the height constraints, however, here we want to track the bin height `s_j`. "The three-dimensional bin packing problem." Operations research 48.2 (2000): 256-267. +[packrift-corpus]: https://github.com/Packrift/packaging-optimization-benchmark-corpus/blob/main/examples/ortools-carton-selection/sample_cartons.csv + ## License -Released under the Apache License 2.0. See [LICENSE](LICENSE) file. \ No newline at end of file +Released under the Apache License 2.0. See [LICENSE](LICENSE) file. diff --git a/input/sample_data_ecommerce_cartons.txt b/input/sample_data_ecommerce_cartons.txt new file mode 100644 index 0000000..92f6c91 --- /dev/null +++ b/input/sample_data_ecommerce_cartons.txt @@ -0,0 +1,9 @@ +# Max num of bins : 2 +# Bin dimensions (L * W * H): 24 10 8 + + case_id quantity length width height +--------- ---------- -------- ------- -------- +0 2 10 6 2 +1 3 8 4 3 +2 2 12 5 4 +3 1 16 6 4 diff --git a/tests/test_utils.py b/tests/test_utils.py index 310225d..aded8cf 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -104,6 +104,22 @@ def test_read_write_input_data(self): ) self.assertEqual(data1, data) + def test_read_ecommerce_carton_sample(self): + data = read_instance(instance_path=project_dir + "/input/sample_data_ecommerce_cartons.txt") + + self.assertEqual( + data, + { + "Case ID": [0, 1, 2, 3], + "Quantity": [2, 3, 2, 1], + "Length": [10, 8, 12, 16], + "Width": [6, 4, 5, 6], + "Height": [2, 3, 4, 4], + "num_bins": 2, + "bin_dimensions": [24, 10, 8], + }, + ) + def test_write_solution_to_file(self): data = read_instance(instance_path=project_dir + "/tests/test_data_1.txt") cases = Cases(data)