pub struct BPProblem {
pub instance: BPInstance,
pub layouts: SlotMap<LayKey, Layout>,
pub item_demand_qtys: Vec<usize>,
pub bin_stock_qtys: Vec<usize>,
}Expand description
Dynamic counterpart of BPInstance.
Fields§
§instance: BPInstance§layouts: SlotMap<LayKey, Layout>§item_demand_qtys: Vec<usize>§bin_stock_qtys: Vec<usize>Implementations§
Source§impl BPProblem
impl BPProblem
pub fn new(instance: BPInstance) -> Self
Sourcepub fn remove_layout(&mut self, key: LayKey)
pub fn remove_layout(&mut self, key: LayKey)
Removes a layout from the problem. The bin used by the layout will be closed and all items placed inside it will be deregistered.
Sourcepub fn place_item(&mut self, p_opt: BPPlacement) -> (LayKey, PItemKey)
pub fn place_item(&mut self, p_opt: BPPlacement) -> (LayKey, PItemKey)
Places an item according to the provided BPPlacement in the problem.
Sourcepub fn remove_item(&mut self, lkey: LayKey, pik: PItemKey) -> BPPlacement
pub fn remove_item(&mut self, lkey: LayKey, pik: PItemKey) -> BPPlacement
Removes an item from a layout. If the layout is empty, it will be closed.
Set commit_instantly to false if there’s a high chance that this modification will be reverted.
Sourcepub fn save(&self) -> BPSolution
pub fn save(&self) -> BPSolution
Creates a snapshot of the current state of the problem as a BPSolution.
Sourcepub fn restore(&mut self, solution: &BPSolution)
pub fn restore(&mut self, solution: &BPSolution)
Restores the state of the problem to the given BPSolution.
pub fn density(&self) -> f32
pub fn item_placed_qtys(&self) -> impl Iterator<Item = usize>
pub fn bin_used_qtys(&self) -> impl Iterator<Item = usize>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BPProblem
impl RefUnwindSafe for BPProblem
impl Send for BPProblem
impl Sync for BPProblem
impl Unpin for BPProblem
impl UnwindSafe for BPProblem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more