Skip to content

Commit 336a30b

Browse files
committed
bug fixed where stock values of sheets were not respected.
Thanks to Kyle Booth for reporting this bug
1 parent ebdc3e1 commit 336a30b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/optimization/gdrr.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,12 @@ impl<'a> GDRR<'a> {
232232
let sheettype_id = empty_layout.sheettype().id();
233233

234234
if self.problem.sheettype_qtys()[sheettype_id] == 0 {
235-
insertion_option_cache.remove_all_for_layout(&elected_blueprint.layout_index(), empty_layout);
235+
//There is no more stock left of this sheettype, remove all empty layouts with this sheettype from the cache
236+
self.problem.empty_layouts().iter().enumerate()
237+
.filter(|(_, l)| l.sheettype().id() == sheettype_id)
238+
.for_each(|(i, l)| {
239+
insertion_option_cache.remove_all_for_layout(&LayoutIndex::Empty(i), l);
240+
});
236241
}
237242
}
238243
if *self.problem.parttype_qtys().get(elected_parttype.id()).unwrap() == 0 {

0 commit comments

Comments
 (0)