Skip to content

Commit 280e4a0

Browse files
committed
Initial commit
0 parents  commit 280e4a0

File tree

13,886 files changed

+2013731
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

13,886 files changed

+2013731
-0
lines changed

.bazelrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
build --cxxopt='-std=c++14' --compilation_mode=opt

.gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
data/* linguist-vendored

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
bazel-*
2+
.vscode
3+
checker/checker
4+
checker/logs/*
5+
log*
6+
checker/*
7+
OLD
8+
instances/*
9+
output/*

.ycm_extra_conf.py

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
def Settings( **kwargs ):
2+
return {
3+
'flags': [
4+
'-x', 'c++',
5+
'-Wall', '-Wextra', '-Werror',
6+
'-I', '.',
7+
'-I', './bazel-packingsolver/external/json/single_include',
8+
'-I', './bazel-packingsolver/external/googletest/googletest-release-1.8.0/googletest/include/',
9+
'-I', './bazel-packingsolver/external/',
10+
],
11+
}
12+

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Florian Fontan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# PackingSolver
2+
3+
A state-of-the-art tree search based solver for (geometrical) Packing Problems.
4+
5+
Only rectangle two- and three staged guillotine variants have been implemented yet.
6+
7+
![Example](example.png?raw=true "Example")
8+
9+
* Code author: Florian Fontan
10+
* Algorithm design: [Luc Libralesso](https://github.com/librallu), Florian Fontan
11+
12+
For commercial support, custom developments or industrial collaboration, please do not hesitate to contact me (Florian Fontan).
13+
For academic collaboration, please do not hesitate to contact Luc Libralesso.
14+
15+
## Usage
16+
17+
Note: PackingSolver favours efficiency and flexibility over ease of use. Therefore, some knowledge about tree search algorithms and packing problems is required in order to use it.
18+
19+
Compile:
20+
```shell
21+
bazel build -- //...
22+
```
23+
24+
Execute:
25+
```shell
26+
./bazel-bin/packingsolver/main -v \
27+
--problem-type rectangleguillotine \
28+
--objective knapsack \
29+
--items data/rectangle/alvarez2002/ATP30_items.csv \
30+
--bins data/rectangle/alvarez2002/ATP30_bins.csv \
31+
--certificate ATP30_solution.csv \
32+
--output ATP30_output.json \
33+
--time-limit 2 \
34+
-q "RG -p 3NHO -s 2" -a "MBA* -f 1.5 -c 4" \
35+
-q "RG -p 3NHO -s 3" -a "MBA* -f 1.5 -c 4"
36+
```
37+
38+
Problem types: `rectangleguillotine` (`RG`)
39+
40+
The problem type defines the the certificate format.
41+
Each problem type has a list of available objectives and a list of available branching schemes.
42+
43+
Each branching scheme has a list a compatible algorithms.
44+
45+
Each pair `-q`/`-a` respectively defines the branching scheme and the algorithm for a thread.
46+
47+
Options `--bin-infinite-copies`, `--bin-infinite-width`, `--bin-infinite-height` and `--unweighted` are available to modify the instance properties.
48+
49+
### Problem type rectangleguillotine (RG)
50+
51+
* Available objectives: `default`, `bin-packing` (`BPP`), `knapsack` (`KP`), `strip-packing` (`SPP`), `bin-packing-with-leftovers` (`BPPL`)
52+
* Available branching schemes: `rectangle-guillotine` (`RG`)
53+
54+
### Branching scheme rectangle-guillotine (RG)
55+
56+
options:
57+
* `--cut-type-1`: `three-staged-guillotine`, `two-staged-guillotine`
58+
* `--cut-type-2`: `roadef2018`, `non-exact`, `exact`, `homogenous`
59+
* `--first-stage-orientation`: `vertical`, `horizontal`, `any`
60+
* `--min1cut`, `--max1cut`, `--min2cut`, `--max2cut`: positive integer
61+
* `--min-waste`: positive integer
62+
* `--no-item-rotation`
63+
* `--cut-through-defects`
64+
* `--symmetry`, `-s`: 1, 2, 3 or 4
65+
* `--no-symmetry-2`
66+
* `-p`: predefined configurations. Examples:
67+
* `3RVR`: `--cut-type-1 three-staged-guillotine --cut-type-2 roadef2018 --first-stage-orientation vertical`
68+
* `2NHO`: `--cut-type-1 two-staged-guillotine --cut-type-2 non-exact --first-stage-orientation horizontal --no-item-rotation`
69+
* `3EAR`: `--cut-type-1 three-staged-guillotine --cut-type-2 exact --first-stage-orientation any`
70+
* `roadef2018`
71+
72+
Compatible algorithms: `A*`, `DFS`, `MBA*`, `DPA*`
73+
74+
## Benchmarks
75+
76+
The performances of PackingSolver have been compared to all published results from the scientific literature on corresponding Packing Problems.
77+
Detailed results are available in `results.ods`.
78+
`output.7z` contains all output files and solutions.
79+
80+
Do not hesitate to contact us if you are aware of any variant or article that we missed.
81+
82+
All experiments can be reproduced using the following scripts:
83+
```shell
84+
./packingsolver/scripts/bench "roadef2018_A" "roadef2018_B" "roadef2018_X" # ~50h
85+
./packingsolver/scripts/bench "3NEGH-BPP-O" "3NEGH-BPP-R" "3GH-BPP-O" "3HGV-BPP-O" # ~30h
86+
./packingsolver/scripts/bench "2NEGH-BPP-O" "2NEGH-BPP-R" "2GH-BPP-O" # ~30h
87+
./packingsolver/scripts/bench "3NEG-KP-O" "3NEG-KP-R" "3NEGV-KP-O" "3HG-KP-O" # ~10h
88+
./packingsolver/scripts/bench "2NEG-KP-O" "2NEGH-KP-O" "2NEGV-KP-O" "2NEGH-KP-R" "2G-KP-O" "2GH-KP-O" "2GV-KP-O" # 1h
89+
./packingsolver/scripts/bench "3NEGH-SPP-O" "3NEGH-SPP-R" # ~10h
90+
./packingsolver/scripts/bench "2NEGH-SPP-O" # ~2h
91+
```
92+

WORKSPACE

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
2+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
3+
4+
http_archive(
5+
name = "googletest",
6+
build_file_content = """
7+
cc_library(
8+
name = "gtest",
9+
srcs = ["googletest-release-1.8.0/googletest/src/gtest-all.cc", "googletest-release-1.8.0/googlemock/src/gmock-all.cc",],
10+
hdrs = glob(["**/*.h", "googletest-release-1.8.0/googletest/src/*.cc", "googletest-release-1.8.0/googlemock/src/*.cc",]),
11+
includes = ["googletest-release-1.8.0/googlemock", "googletest-release-1.8.0/googletest", "googletest-release-1.8.0/googletest/include", "googletest-release-1.8.0/googlemock/include",],
12+
linkopts = ["-pthread"],
13+
visibility = ["//visibility:public"],
14+
)
15+
16+
cc_library(
17+
name = "gtest_main",
18+
srcs = ["googletest-release-1.8.0/googlemock/src/gmock_main.cc"],
19+
linkopts = ["-pthread"],
20+
visibility = ["//visibility:public"],
21+
deps = [":gtest"],
22+
)
23+
""",
24+
url = "https://github.com/google/googletest/archive/release-1.8.0.zip",
25+
sha256 = "f3ed3b58511efd272eb074a3a6d6fb79d7c2e6a0e374323d1e6bcbcc1ef141bf",
26+
)
27+
28+
http_archive(
29+
name = "json",
30+
build_file_content = """
31+
cc_library(
32+
name = "json",
33+
hdrs = ["single_include/nlohmann/json.hpp"],
34+
visibility = ["//visibility:public"],
35+
strip_include_prefix = "single_include/"
36+
)
37+
""",
38+
urls = ["https://github.com/nlohmann/json/releases/download/v3.7.3/include.zip"],
39+
sha256 = "87b5884741427220d3a33df1363ae0e8b898099fbc59f1c451113f6732891014",
40+
)
41+
42+
git_repository(
43+
name = "benchtools",
44+
remote = "https://github.com/fontanf/benchtools.git",
45+
commit = "fe56ed683d32f70cd248d77cd4107e57eee05758",
46+
shallow_since = "1576623294 +0100",
47+
)
48+
49+
local_repository(
50+
name = "benchtools_",
51+
path = "/home/florian/Dev/benchtools/",
52+
)
53+

data/rectangle/BUILD

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
filegroup(
2+
name = "rectangle",
3+
srcs = glob(["**/*.csv"]),
4+
visibility = ["//visibility:public"],
5+
)
6+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ID,WIDTH,HEIGHT
2+
0,927,152
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
ID,WIDTH,HEIGHT,COPIES
2+
0,324,27,9
3+
1,111,20,8
4+
2,358,13,6
5+
3,74,43,6
6+
4,190,19,3
7+
5,178,37,2
8+
6,254,21,7
9+
7,57,31,3
10+
8,110,7,6
11+
9,172,25,5
12+
10,158,39,9
13+
11,311,39,4
14+
12,158,18,7
15+
13,69,32,6
16+
14,59,28,5
17+
15,345,23,7
18+
16,210,13,5
19+
17,339,20,9
20+
18,332,24,2
21+
19,104,46,3
22+
20,138,12,7
23+
21,212,32,5
24+
22,320,40,1
25+
23,174,14,2
26+
24,343,37,1
27+
25,139,40,3
28+
26,157,19,3
29+
27,360,58,4
30+
28,337,19,6
31+
29,59,55,3
32+
30,319,53,3
33+
31,215,7,7
34+
32,238,14,6
35+
33,243,32,4
36+
34,213,18,6
37+
35,214,34,4
38+
36,328,50,6
39+
37,205,32,9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ID,WIDTH,HEIGHT
2+
0,856,964
+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
ID,WIDTH,HEIGHT,COPIES
2+
0,290,350,4
3+
1,328,292,3
4+
2,240,206,1
5+
3,246,126,9
6+
4,250,279,7
7+
5,71,353,9
8+
6,67,127,9
9+
7,209,275,1
10+
8,317,264,6
11+
9,119,228,2
12+
10,331,50,4
13+
11,138,163,7
14+
12,60,339,2
15+
13,187,298,1
16+
14,73,104,7
17+
15,164,123,8
18+
16,250,189,5
19+
17,228,143,5
20+
18,154,345,5
21+
19,70,297,4
22+
20,198,376,8
23+
21,170,100,7
24+
22,295,292,6
25+
23,238,177,7
26+
24,195,187,3
27+
25,252,132,5
28+
26,313,148,6
29+
27,175,162,6
30+
28,44,206,5
31+
29,164,366,6
32+
30,161,339,9
33+
31,62,81,5
34+
32,304,165,2
35+
33,284,302,6
36+
34,261,376,6
37+
35,183,80,4
38+
36,224,163,2
39+
37,212,366,8
40+
38,46,75,6
41+
39,66,158,5
42+
40,179,207,7
43+
41,314,98,2
44+
42,96,107,1
45+
43,320,380,3
46+
44,211,82,3
47+
45,252,53,6
48+
46,74,183,6
49+
47,274,72,1
50+
48,65,240,7
51+
49,229,321,4
52+
50,265,280,7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ID,WIDTH,HEIGHT
2+
0,307,124
+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
ID,WIDTH,HEIGHT,COPIES
2+
0,99,18,2
3+
1,80,17,2
4+
2,67,16,2
5+
3,70,44,2
6+
4,23,36,2
7+
5,51,16,2
8+
6,58,8,9
9+
7,53,25,3
10+
8,98,19,6
11+
9,117,21,1
12+
10,52,11,3
13+
11,77,41,2
14+
12,72,27,9
15+
13,92,35,7
16+
14,81,46,6
17+
15,23,18,4
18+
16,64,21,1
19+
17,99,37,1
20+
18,47,34,5
21+
19,109,32,2
22+
20,95,37,7
23+
21,96,29,7
24+
22,105,19,8
25+
23,105,13,1
26+
24,46,19,8
27+
25,55,42,5
28+
26,95,43,6
29+
27,42,6,2
30+
28,49,42,1
31+
29,26,10,2
32+
30,28,19,5
33+
31,59,9,2
34+
32,16,14,5
35+
33,99,37,7
36+
34,55,45,8
37+
35,51,20,7
38+
36,29,26,7
39+
37,39,15,5
40+
38,99,15,8
41+
39,47,39,4
42+
40,84,14,5
43+
41,106,12,6
44+
42,32,14,7
45+
43,72,33,7
46+
44,52,21,2
47+
45,51,26,5
48+
46,62,23,1
49+
47,100,29,4
50+
48,68,32,1
51+
49,37,27,3
52+
50,51,13,4
53+
51,19,30,6
54+
52,60,22,2
55+
53,64,9,4
56+
54,118,28,8
57+
55,120,24,8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ID,WIDTH,HEIGHT
2+
0,241,983

0 commit comments

Comments
 (0)