Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ typing:
python packing3d.py --data_filepath <path to your problem file>

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

Expand Down Expand Up @@ -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.
Released under the Apache License 2.0. See [LICENSE](LICENSE) file.
9 changes: 9 additions & 0 deletions input/sample_data_ecommerce_cartons.txt
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down