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    /// Set of items to be produced
10    pub items: Vec<ExtItem>,
11    /// Set of bins to be used
12    pub bins: Vec<ExtBin>,
13}
14
15/// Item with a demand
16#[derive(Serialize, Deserialize, Clone)]
17pub struct ExtItem {
18    #[serde(flatten)]
19    /// External representation of the item in the base library
20    pub base: crate::io::ext_repr::ExtItem,
21    /// Amount of times this item has to be produced
22    pub demand: u64,
23}
24
25/// Bin with a stock quantity and cost
26#[derive(Serialize, Deserialize, Clone)]
27pub struct ExtBin {
28    #[serde(flatten)]
29    pub base: crate::io::ext_repr::ExtContainer,
30    /// The number of copies of this bin available to be use
31    pub stock: usize,
32    /// The cost of using a bin of this type
33    pub cost: u64,
34}
35
36/// Bin Packing Problem solution
37#[derive(Serialize, Deserialize, Clone)]
38pub struct ExtBPSolution {
39    /// Total cost of all the bins used in the solution
40    pub cost: u64,
41    /// Layouts which compose the solution
42    pub layouts: Vec<ExtLayout>,
43    /// Sum of the area of the produced items divided by the sum of the area of the containers
44    pub density: f32,
45    /// The time it took to generate the solution in seconds
46    pub run_time_sec: u64,
47}