Skip to main content

jagua_rs/probs/spp/entities/
solution.rs

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