Skip to main content

jagua_rs/probs/spp/io/
ext_repr.rs

1use serde::{Deserialize, Serialize};
2
3use crate::io::ext_repr::ExtLayout;
4
5/// Strip Packing Problem instance
6#[derive(Serialize, Deserialize, Clone)]
7pub struct ExtSPInstance {
8    /// The name of the instance
9    pub name: String,
10    /// Minimum distance between items and other hazards, in input units.
11    /// Must be finite and nonnegative. Omitted means zero; null is invalid.
12    #[serde(default)]
13    pub min_item_separation: f32,
14    /// Set of items to be produced
15    pub items: Vec<ExtItem>,
16    /// Fixed height of the strip
17    pub strip_height: f32,
18}
19
20/// Item with a demand
21#[derive(Serialize, Deserialize, Clone)]
22pub struct ExtItem {
23    #[serde(flatten)]
24    /// External representation of the item in the base library
25    pub base: crate::io::ext_repr::ExtItem,
26    /// Amount of times this item has to be produced
27    pub demand: u64,
28}
29
30/// Strip Packing Problem solution
31#[derive(Serialize, Deserialize, Clone)]
32pub struct ExtSPSolution {
33    /// The strip width of the solution
34    pub strip_width: f32,
35    /// Layout of the single strip. Exports always use `container_id: 0`.
36    pub layout: ExtLayout,
37    /// Sum of the area of the produced items divided by the sum of the area of the containers
38    pub density: f32,
39    /// The time it took to generate the solution in seconds
40    pub run_time_sec: u64,
41}