pub struct SPProblem {
pub instance: SPInstance,
pub strip: Strip,
pub layout: Layout,
pub item_demand_qtys: Vec<usize>,
}
Expand description
Modifiable counterpart of SPInstance
: items can be placed and removed, strip can be extended or fitted.
Fields§
§instance: SPInstance
§strip: Strip
§layout: Layout
§item_demand_qtys: Vec<usize>
Implementations§
Source§impl SPProblem
impl SPProblem
pub fn new(instance: SPInstance) -> Self
Sourcepub fn change_strip_width(&mut self, new_width: f32)
pub fn change_strip_width(&mut self, new_width: f32)
Modifies the width of the strip in the back, keeping the front fixed.
Sourcepub fn place_item(&mut self, placement: SPPlacement) -> PItemKey
pub fn place_item(&mut self, placement: SPPlacement) -> PItemKey
Places an item according to the given SPPlacement
in the problem.
Sourcepub fn remove_item(
&mut self,
pkey: PItemKey,
commit_instant: bool,
) -> SPPlacement
pub fn remove_item( &mut self, pkey: PItemKey, commit_instant: bool, ) -> SPPlacement
Removes a placed item from the strip. Returns the placement of the item.
Set commit_instantly
to false if there’s a high chance that this modification will be reverted.
Sourcepub fn save(&mut self) -> SPSolution
pub fn save(&mut self) -> SPSolution
Creates a snapshot of the current state of the problem as a SPSolution
.
Sourcepub fn restore(&mut self, solution: &SPSolution)
pub fn restore(&mut self, solution: &SPSolution)
Restores the state of the problem to the given SPSolution
.
pub fn density(&self) -> f32
pub fn strip_width(&self) -> f32
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SPProblem
impl RefUnwindSafe for SPProblem
impl Send for SPProblem
impl Sync for SPProblem
impl Unpin for SPProblem
impl UnwindSafe for SPProblem
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