jagua_rs/probs/spp/entities/
solution.rs

1use crate::entities::LayoutSnapshot;
2use crate::probs::spp::entities::SPInstance;
3use crate::probs::spp::entities::strip::Strip;
4use std::time::Instant;
5
6/// Snapshot of [`SPProblem`](crate::probs::spp::entities::SPProblem) at a specific moment. Can be used to restore to a previous state.
7#[derive(Debug, Clone)]
8pub struct SPSolution {
9    pub strip: Strip,
10    pub layout_snapshot: LayoutSnapshot,
11    /// Instant the solution was created
12    pub time_stamp: Instant,
13}
14
15impl SPSolution {
16    pub fn density(&self, instance: &SPInstance) -> f32 {
17        self.layout_snapshot.density(instance)
18    }
19    pub fn strip_width(&self) -> f32 {
20        self.strip.width
21    }
22}