Skip to content

Commit 2418046

Browse files
committed
Fix add_item_type call with 0 copies in dual feasible functinos
1 parent 26db32d commit 2418046

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

src/rectangle/dual_feasible_functions.cpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -120,22 +120,26 @@ DualFeasibleFunctionsOutput packingsolver::rectangle::dual_feasible_functions(
120120
bin_type.rect.x,
121121
-1,
122122
2 * instance.number_of_items() + bound);
123-
modified_instance_builder.add_item_type(
124-
bin_type.rect.x,
125-
bin_type.rect.x - bin_type.rect.y,
126-
-1,
127-
bound);
123+
if (bound > 0) {
124+
modified_instance_builder.add_item_type(
125+
bin_type.rect.x,
126+
bin_type.rect.x - bin_type.rect.y,
127+
-1,
128+
bound);
129+
}
128130
} else if (bin_type.rect.x < bin_type.rect.y) {
129131
modified_instance_builder.add_bin_type(
130132
bin_type.rect.y,
131133
bin_type.rect.y,
132134
-1,
133135
2 * instance.number_of_items() + bound);
134-
modified_instance_builder.add_item_type(
135-
bin_type.rect.y - bin_type.rect.x,
136-
bin_type.rect.y,
137-
-1,
138-
bound);
136+
if (bound > 0) {
137+
modified_instance_builder.add_item_type(
138+
bin_type.rect.y - bin_type.rect.x,
139+
bin_type.rect.y,
140+
-1,
141+
bound);
142+
}
139143
}
140144
// Add items.
141145
for (ItemTypeId item_type_id = 0;

0 commit comments

Comments
 (0)