pub struct Solution {
pub id: usize,
pub layout_snapshots: Vec<LayoutSnapshot>,
pub usage: fsize,
pub placed_item_qtys: Vec<usize>,
pub target_item_qtys: Vec<usize>,
pub bin_qtys: Vec<usize>,
pub time_stamp: Instant,
}
Expand description
Represents a snapshot of a Problem
at a specific moment.
Solutions can be used to restore the state of a Problem
to a previous state.
Fields§
§id: usize
Unique identifier for the solution
layout_snapshots: Vec<LayoutSnapshot>
Snapshots of all Layout
s in the Problem
at the moment the solution was created
usage: fsize
Average usage of bins in the solution
placed_item_qtys: Vec<usize>
Quantity of placed items for each Item
in the solution
target_item_qtys: Vec<usize>
Target quantity of each Item
in the solution
bin_qtys: Vec<usize>
Quantity of bins used for each type of bin
time_stamp: Instant
Instant the solution was created
Implementations§
Source§impl Solution
impl Solution
pub fn new( id: usize, layout_snapshots: Vec<LayoutSnapshot>, usage: fsize, placed_item_qtys: Vec<usize>, target_item_qtys: Vec<usize>, bin_qtys: Vec<usize>, ) -> Self
Sourcepub fn is_complete(&self, instance: &dyn InstanceGeneric) -> bool
pub fn is_complete(&self, instance: &dyn InstanceGeneric) -> bool
Whether all items demanded in the instance
are placed
Sourcepub fn completeness(&self, instance: &Instance) -> fsize
pub fn completeness(&self, instance: &Instance) -> fsize
Ratio of included item area vs total demanded item area in the instance
Sourcepub fn missing_item_qtys(&self, instance: &Instance) -> Vec<isize>
pub fn missing_item_qtys(&self, instance: &Instance) -> Vec<isize>
Returns the quantities of the items that still need to be placed to reach a complete solution.
pub fn n_items_placed(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Solution
impl RefUnwindSafe for Solution
impl Send for Solution
impl Sync for Solution
impl Unpin for Solution
impl UnwindSafe for Solution
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