jagua_rs/probs/bpp/entities/bin.rs
1use crate::entities::Container;
2
3#[derive(Debug, Clone)]
4/// A container in the Bin Packing Problem (BPP) with an associated cost and stock.
5pub struct Bin {
6 /// Dense index in the instance's bin list.
7 pub idx: usize,
8 /// Caller-supplied bin type identifier.
9 pub external_id: u64,
10 /// The container in which to pack the items
11 pub container: Container,
12 /// The number of copies of this bin available to be use
13 pub stock: usize,
14 /// The cost of using a bin of this type
15 pub cost: u64,
16}
17
18impl Bin {
19 /// Creates a new bin with the given id, container, stock, and cost.
20 #[must_use]
21 pub fn new(
22 idx: usize,
23 external_id: u64,
24 container: Container,
25 stock: usize,
26 cost: u64,
27 ) -> Self {
28 Self {
29 idx,
30 external_id,
31 container,
32 stock,
33 cost,
34 }
35 }
36}