From 1dccd6444808354a96ee0e3d5076da644c8bebc9 Mon Sep 17 00:00:00 2001 From: Florian Fontan Date: Sat, 21 Sep 2024 18:38:59 +0200 Subject: [PATCH] Fix column generation algorithm --- data/irregular/users/2024-09-21.json | 57 +++++++++++++ data/irregular/users/2024-09-21_solution.json | 81 +++++++++++++++++++ extern/CMakeLists.txt | 2 +- src/algorithms/column_generation.hpp | 2 +- test/irregular/irregular_test.cpp | 3 + 5 files changed, 143 insertions(+), 2 deletions(-) create mode 100644 data/irregular/users/2024-09-21.json create mode 100644 data/irregular/users/2024-09-21_solution.json diff --git a/data/irregular/users/2024-09-21.json b/data/irregular/users/2024-09-21.json new file mode 100644 index 000000000..29e889870 --- /dev/null +++ b/data/irregular/users/2024-09-21.json @@ -0,0 +1,57 @@ +{ + "objective": "knapsack", + "parameters": { + "item_bin_minimum_spacing": 0.0, + "item_item_minimum_spacing": 0.0 + }, + "bin_types": [ + { + "copies": 1, + "width": 50.0, + "height": 50.0, + "type": "rectangle" + }, + { + "copies": 1, + "width": 200.0, + "height": 200.0, + "type": "rectangle" + } + ], + "item_types": [ + { + "copies": 1, + "shapes": [ + { + "type": "polygon", + "vertices": [ + { + "x": 100.0, + "y": 100.0 + }, + { + "x": 0.0, + "y": 100.0 + }, + { + "x": 0.0, + "y": 0.0 + }, + { + "x": 100.0, + "y": 0.0 + } + ], + "holes": [] + } + ], + "allowed_rotations": [ + { + "start": 0, + "end": 0 + } + ], + "allow_mirroring": false + } + ] +} diff --git a/data/irregular/users/2024-09-21_solution.json b/data/irregular/users/2024-09-21_solution.json new file mode 100644 index 000000000..ee5e4966c --- /dev/null +++ b/data/irregular/users/2024-09-21_solution.json @@ -0,0 +1,81 @@ +{ + "bins": [ + { + "copies": 1, + "id": 1, + "items": [ + { + "angle": 0.0, + "id": 0, + "item_shapes": [ + { + "shape": [ + { + "type": "LineSegment", + "xe": 0.0, + "xs": 100.0, + "ye": 100.0, + "ys": 100.0 + }, + { + "type": "LineSegment", + "xe": 0.0, + "xs": 0.0, + "ye": 0.0, + "ys": 100.0 + }, + { + "type": "LineSegment", + "xe": 100.0, + "xs": 0.0, + "ye": 0.0, + "ys": 0.0 + }, + { + "type": "LineSegment", + "xe": 100.0, + "xs": 100.0, + "ye": 100.0, + "ys": 0.0 + } + ] + } + ], + "mirror": false, + "x": 0.0, + "y": 0.0 + } + ], + "shape": [ + { + "type": "LineSegment", + "xe": 200.0, + "xs": 0.0, + "ye": 0.0, + "ys": 0.0 + }, + { + "type": "LineSegment", + "xe": 200.0, + "xs": 200.0, + "ye": 200.0, + "ys": 0.0 + }, + { + "type": "LineSegment", + "xe": 0.0, + "xs": 200.0, + "ye": 200.0, + "ys": 200.0 + }, + { + "type": "LineSegment", + "xe": 0.0, + "xs": 0.0, + "ye": 0.0, + "ys": 200.0 + } + ] + } + ] +} diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt index 0c63533a5..f2b7ea901 100644 --- a/extern/CMakeLists.txt +++ b/extern/CMakeLists.txt @@ -53,7 +53,7 @@ set(COLUMNGENERATIONSOLVER_USE_CLP ON) FetchContent_Declare( columngenerationsolver GIT_REPOSITORY https://github.com/fontanf/columngenerationsolver.git - GIT_TAG 8f9ac25f724ffe13d239728974752567afd2a586 + GIT_TAG 84c6642d53203259c356d4186b3a0919578b8634 #SOURCE_DIR "${PROJECT_SOURCE_DIR}/../columngenerationsolver/" EXCLUDE_FROM_ALL) FetchContent_MakeAvailable(columngenerationsolver) diff --git a/src/algorithms/column_generation.hpp b/src/algorithms/column_generation.hpp index 6912fc1dd..f86e086cd 100644 --- a/src/algorithms/column_generation.hpp +++ b/src/algorithms/column_generation.hpp @@ -86,7 +86,7 @@ class ColumnGenerationPricingSolver: public columngenerationsolver::PricingSolve std::vector fixed_bin_types_; - std::vector filled_demands_; + std::vector filled_demands_; }; diff --git a/test/irregular/irregular_test.cpp b/test/irregular/irregular_test.cpp index 87fc514a6..215efa5a0 100644 --- a/test/irregular/irregular_test.cpp +++ b/test/irregular/irregular_test.cpp @@ -148,4 +148,7 @@ INSTANTIATE_TEST_SUITE_P( }, { fs::path("data") / "irregular" / "users" / "2024-09-11.json", fs::path("data") / "irregular" / "users" / "2024-09-11_solution.json" + }, { + fs::path("data") / "irregular" / "users" / "2024-09-21.json", + fs::path("data") / "irregular" / "users" / "2024-09-21_solution.json" }}));