Skip to content

Commit

Permalink
bug fixed where stock values of sheets were not respected.
Browse files Browse the repository at this point in the history
Thanks to Kyle Booth for reporting this bug
  • Loading branch information
JeroenGar committed Apr 30, 2023
1 parent ebdc3e1 commit 336a30b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/optimization/gdrr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,12 @@ impl<'a> GDRR<'a> {
let sheettype_id = empty_layout.sheettype().id();

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

0 comments on commit 336a30b

Please sign in to comment.