jagua_rs/probs/bpp/io/ext_repr.rs
1use crate::io::ext_repr::ExtLayout;
2use serde::{Deserialize, Serialize};
3
4/// Bin Packing Problem instance
5#[derive(Serialize, Deserialize, Clone)]
6pub struct ExtBPInstance {
7 /// The name of the instance
8 pub name: String,
9 /// Minimum distance between items and other hazards, in input units.
10 /// Must be finite and nonnegative. Omitted means zero; null is invalid.
11 #[serde(default)]
12 pub min_item_separation: f32,
13 /// Set of items to be produced
14 pub items: Vec<ExtItem>,
15 /// Set of bins to be used
16 pub bins: Vec<ExtBin>,
17}
18
19/// Item with a demand
20#[derive(Serialize, Deserialize, Clone)]
21pub struct ExtItem {
22 #[serde(flatten)]
23 /// External representation of the item in the base library
24 pub base: crate::io::ext_repr::ExtItem,
25 /// Amount of times this item has to be produced
26 pub demand: u64,
27}
28
29/// Bin with a stock quantity and cost
30#[derive(Serialize, Deserialize, Clone)]
31pub struct ExtBin {
32 #[serde(flatten)]
33 pub base: crate::io::ext_repr::ExtContainer,
34 /// The number of copies of this bin available to be use
35 pub stock: usize,
36 /// The cost of using a bin of this type
37 pub cost: u64,
38}
39
40/// Bin Packing Problem solution
41#[derive(Serialize, Deserialize, Clone)]
42pub struct ExtBPSolution {
43 /// Total cost of all the bins used in the solution
44 pub cost: u64,
45 /// Layouts which compose the solution
46 pub layouts: Vec<ExtLayout>,
47 /// Sum of the area of the produced items divided by the sum of the area of the containers
48 pub density: f32,
49 /// The time it took to generate the solution in seconds
50 pub run_time_sec: u64,
51}