Skip to content
Merged

Dev #230

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
190 changes: 190 additions & 0 deletions data/irregular/users/2025-05-12.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
{
"bin_types": [
{
"copies": 1,
"copies_min": 0,
"cost": 579.6,
"elements": [
{
"end": {
"x": 110.23622047244095,
"y": 0.0
},
"start": {
"x": 0.0,
"y": 0.0
},
"type": "LineSegment"
},
{
"end": {
"x": 110.23622047244095,
"y": 81.49606299212599
},
"start": {
"x": 110.23622047244095,
"y": 0.0
},
"type": "LineSegment"
},
{
"end": {
"x": 0.0,
"y": 81.49606299212599
},
"start": {
"x": 110.23622047244095,
"y": 81.49606299212599
},
"type": "LineSegment"
},
{
"end": {
"x": 0.0,
"y": 0.0
},
"start": {
"x": 0.0,
"y": 81.49606299212599
},
"type": "LineSegment"
}
],
"type": "general"
}
],
"item_types": [
{
"allowed_rotations": [
{
"end": 0.0,
"start": 0.0
}
],
"copies": 1,
"profit": 294.50058871535737,
"shapes": [
{
"elements": [
{
"end": {
"x": 19.685039370000002,
"y": 15.7480315
},
"start": {
"x": 23.62204724,
"y": 15.7480315
},
"type": "LineSegment"
},
{
"end": {
"x": 19.685039370000002,
"y": 3.93700787
},
"start": {
"x": 19.685039370000002,
"y": 15.7480315
},
"type": "LineSegment"
},
{
"end": {
"x": 3.93700787,
"y": 3.93700787
},
"start": {
"x": 19.685039370000002,
"y": 3.93700787
},
"type": "LineSegment"
},
{
"end": {
"x": 3.93700787,
"y": 19.685039370000002
},
"start": {
"x": 3.93700787,
"y": 3.93700787
},
"type": "LineSegment"
},
{
"end": {
"x": 23.62204724,
"y": 19.685039370000002
},
"start": {
"x": 3.93700787,
"y": 19.685039370000002
},
"type": "LineSegment"
},
{
"end": {
"x": 23.62204724,
"y": 23.62204724
},
"start": {
"x": 23.62204724,
"y": 19.685039370000002
},
"type": "LineSegment"
},
{
"end": {
"x": 0.0,
"y": 23.62204724
},
"start": {
"x": 23.62204724,
"y": 23.62204724
},
"type": "LineSegment"
},
{
"end": {
"x": 0.0,
"y": 0.0
},
"start": {
"x": 0.0,
"y": 23.62204724
},
"type": "LineSegment"
},
{
"end": {
"x": 23.62204724,
"y": 0.0
},
"start": {
"x": 0.0,
"y": 0.0
},
"type": "LineSegment"
},
{
"end": {
"x": 23.62204724,
"y": 15.7480315
},
"start": {
"x": 23.62204724,
"y": 0.0
},
"type": "LineSegment"
}
],
"type": "general"
}
]
}
],
"objective": "BinPackingWithLeftovers",
"parameters": {
"item_bin_minimum_spacing": 0.0,
"item_item_minimum_spacing": 1.968503937007874
}
}
123 changes: 123 additions & 0 deletions data/irregular/users/2025-05-12_solution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"bins": [
{
"copies": 1,
"id": 0,
"items": [
{
"angle": 0.0,
"id": 0,
"item_shapes": [
{
"shape": [
{
"type": "LineSegment",
"xe": 19.685039370000002,
"xs": 23.62204724,
"ye": 15.7480315,
"ys": 15.7480315
},
{
"type": "LineSegment",
"xe": 19.685039370000002,
"xs": 19.685039370000002,
"ye": 3.93700787,
"ys": 15.7480315
},
{
"type": "LineSegment",
"xe": 3.93700787,
"xs": 19.685039370000002,
"ye": 3.93700787,
"ys": 3.93700787
},
{
"type": "LineSegment",
"xe": 3.93700787,
"xs": 3.93700787,
"ye": 19.685039370000002,
"ys": 3.93700787
},
{
"type": "LineSegment",
"xe": 23.62204724,
"xs": 3.93700787,
"ye": 19.685039370000002,
"ys": 19.685039370000002
},
{
"type": "LineSegment",
"xe": 23.62204724,
"xs": 23.62204724,
"ye": 23.62204724,
"ys": 19.685039370000002
},
{
"type": "LineSegment",
"xe": 0.0,
"xs": 23.62204724,
"ye": 23.62204724,
"ys": 23.62204724
},
{
"type": "LineSegment",
"xe": 0.0,
"xs": 0.0,
"ye": 0.0,
"ys": 23.62204724
},
{
"type": "LineSegment",
"xe": 23.62204724,
"xs": 0.0,
"ye": 0.0,
"ys": 0.0
},
{
"type": "LineSegment",
"xe": 23.62204724,
"xs": 23.62204724,
"ye": 15.7480315,
"ys": 0.0
}
]
}
],
"mirror": false,
"x": 0.0,
"y": 0.0
}
],
"shape": [
{
"type": "LineSegment",
"xe": 110.23622047244095,
"xs": 0.0,
"ye": 0.0,
"ys": 0.0
},
{
"type": "LineSegment",
"xe": 110.23622047244095,
"xs": 110.23622047244095,
"ye": 81.49606299212599,
"ys": 0.0
},
{
"type": "LineSegment",
"xe": 0.0,
"xs": 110.23622047244095,
"ye": 81.49606299212599,
"ys": 81.49606299212599
},
{
"type": "LineSegment",
"xe": 0.0,
"xs": 0.0,
"ye": 0.0,
"ys": 81.49606299212599
}
]
}
]
}
2 changes: 1 addition & 1 deletion extern/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ FetchContent_MakeAvailable(optimizationtools)
FetchContent_Declare(
shape
GIT_REPOSITORY https://github.com/fontanf/shape.git
GIT_TAG 155ed98ccda6dcb81f0a30ea958b5d618a5099d2
GIT_TAG c89eaae026b9e7f06b7aa73526241da27370caad
#SOURCE_DIR "${PROJECT_SOURCE_DIR}/../shape/"
EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(shape)
Expand Down
5 changes: 3 additions & 2 deletions src/rectangle/optimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ packingsolver::rectangle::Output packingsolver::rectangle::optimize(
algorithm_formatter.start();
algorithm_formatter.print_header();

algorithm_formatter.update_knapsack_bound(instance.item_profit());

// Select algorithms to run.
ItemPos mean_number_of_items_in_bins
= largest_bin_space(instance) / mean_item_space(instance);
Expand Down Expand Up @@ -551,6 +549,9 @@ packingsolver::rectangle::Output packingsolver::rectangle::optimize(
}
}

if (instance.objective() == Objective::Knapsack)
algorithm_formatter.update_knapsack_bound(instance.item_profit());

if (instance.objective() == Objective::BinPacking) {
if (instance.number_of_bin_types() == 1
&& instance.number_of_items() <= 100) {
Expand Down
3 changes: 3 additions & 0 deletions test/irregular/irregular_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,7 @@ INSTANTIATE_TEST_SUITE_P(
}, {
fs::path("data") / "irregular" / "users" / "2025-05-09.json",
fs::path("data") / "irregular" / "users" / "2025-05-09_solution.json"
}, {
fs::path("data") / "irregular" / "users" / "2025-05-12.json",
fs::path("data") / "irregular" / "users" / "2025-05-12_solution.json"
}}));
Loading