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
Modifiable counterpart of BPInstance
.
Items can be placed and removed, bins can be opened and closed.
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
pub fn remove_layout(&mut self, key: LayKey)
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 given BPPlacement
in the problem.
Sourcepub fn remove_item(
&mut self,
lkey: LayKey,
pik: PItemKey,
commit_instant: bool,
) -> BPPlacement
pub fn remove_item( &mut self, lkey: LayKey, pik: PItemKey, commit_instant: bool, ) -> 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(&mut self) -> BPSolution
pub fn save(&mut 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