pub struct SolveResult<S> {
pub placements: Vec<Placement<S>>,
pub boundaries_used: usize,
pub utilization: f64,
pub unplaced: Vec<GeometryId>,
pub computation_time_ms: u64,
pub generations: Option<u32>,
pub iterations: Option<u64>,
pub best_fitness: Option<f64>,
pub fitness_history: Option<Vec<f64>>,
pub strategy: Option<String>,
pub cancelled: bool,
pub target_reached: bool,
}Expand description
Result of a nesting or packing solve operation.
Fields§
§placements: Vec<Placement<S>>List of placements for all successfully placed geometry instances.
boundaries_used: usizeNumber of boundaries (bins) used.
utilization: f64Utilization ratio (0.0 - 1.0). Calculated as: total_geometry_measure / total_boundary_measure
unplaced: Vec<GeometryId>IDs of geometries that could not be placed.
computation_time_ms: u64Computation time in milliseconds.
generations: Option<u32>Number of generations (for GA-based solvers).
iterations: Option<u64>Number of iterations (for SA-based solvers).
best_fitness: Option<f64>Best fitness value achieved (for GA/SA-based solvers).
fitness_history: Option<Vec<f64>>Fitness history over generations (for analysis).
strategy: Option<String>Strategy used for solving.
cancelled: boolWhether the solve was cancelled early.
target_reached: boolWhether the target utilization was reached.
Implementations§
Source§impl<S> SolveResult<S>
impl<S> SolveResult<S>
Sourcepub fn all_placed(&self) -> bool
pub fn all_placed(&self) -> bool
Returns true if all geometries were placed.
Sourcepub fn placed_count(&self) -> usize
pub fn placed_count(&self) -> usize
Returns the number of placed geometry instances.
Sourcepub fn unplaced_count(&self) -> usize
pub fn unplaced_count(&self) -> usize
Returns the number of unplaced geometry types.
Sourcepub fn is_successful(&self) -> bool
pub fn is_successful(&self) -> bool
Returns true if the solve was successful (at least one placement).
Sourcepub fn completed_normally(&self) -> bool
pub fn completed_normally(&self) -> bool
Returns true if the solve completed within the time limit.
Sourcepub fn with_strategy(self, strategy: impl Into<String>) -> Self
pub fn with_strategy(self, strategy: impl Into<String>) -> Self
Sets the strategy name.
Sourcepub fn with_generations(self, generations: u32) -> Self
pub fn with_generations(self, generations: u32) -> Self
Sets the generations count.
Sourcepub fn with_best_fitness(self, fitness: f64) -> Self
pub fn with_best_fitness(self, fitness: f64) -> Self
Sets the best fitness.
Sourcepub fn with_fitness_history(self, history: Vec<f64>) -> Self
pub fn with_fitness_history(self, history: Vec<f64>) -> Self
Sets the fitness history.
Sourcepub fn deduplicate_unplaced(&mut self)
pub fn deduplicate_unplaced(&mut self)
Removes duplicate entries from the unplaced list. This is useful when multiple instances of the same geometry failed to place.
Sourcepub fn placement_stats(&self) -> PlacementStats
pub fn placement_stats(&self) -> PlacementStats
Computes placement statistics.
Sourcepub fn utilization_percent(&self) -> String
pub fn utilization_percent(&self) -> String
Returns utilization as a percentage string.
Sourcepub fn merge(&mut self, other: SolveResult<S>, boundary_offset: usize)
pub fn merge(&mut self, other: SolveResult<S>, boundary_offset: usize)
Merges placements from another result (for multi-bin scenarios).
Trait Implementations§
Source§impl<S: Clone> Clone for SolveResult<S>
impl<S: Clone> Clone for SolveResult<S>
Source§fn clone(&self) -> SolveResult<S>
fn clone(&self) -> SolveResult<S>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<S: Debug> Debug for SolveResult<S>
impl<S: Debug> Debug for SolveResult<S>
Source§impl<S> Default for SolveResult<S>
impl<S> Default for SolveResult<S>
Source§impl<S> From<&SolveResult<S>> for SolveSummary
impl<S> From<&SolveResult<S>> for SolveSummary
Source§fn from(result: &SolveResult<S>) -> Self
fn from(result: &SolveResult<S>) -> Self
Auto Trait Implementations§
impl<S> Freeze for SolveResult<S>
impl<S> RefUnwindSafe for SolveResult<S>where
S: RefUnwindSafe,
impl<S> Send for SolveResult<S>where
S: Send,
impl<S> Sync for SolveResult<S>where
S: Sync,
impl<S> Unpin for SolveResult<S>where
S: Unpin,
impl<S> UnwindSafe for SolveResult<S>where
S: UnwindSafe,
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
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.