Expand description
A crate for solving binpacking problems using Linear Programming.
§Example
use binpack::Problem;
const PROBLEM: &str = r#"
bins:
b1: 100
b2: 40
b3: 10
items:
i1:
quantity: 30
affinity:
soft:
- weight: 1
bins: [b1]
antiAffinity:
hard:
bins: [b3]
i2:
quantity: 110
affinity:
soft:
- weight: 2
bins: [b1]
i3:
quantity: 10
"#;
const SOLUTION: &str = r#"
solution:
i1:
b2: 30
i2:
b1: 100
b3: 10
i3:
b2: 10
"#;
let problem: Problem = serde_yaml::from_str(PROBLEM).unwrap();
let solution = problem.solve().unwrap();
assert_eq!(serde_yaml::to_string(&solution).unwrap().trim(), SOLUTION.trim());
Re-exports§
pub use serde;
Structs§
- Affinity
- Required and preferred bin assignments for an item
- Anti
Affinity - Required and preferred bin aversions for an item
- Hard
Requirement - A hard requirement for an item to be packed into a set of bins
- Item
Spec - Details about how an item should be packed
- Problem
- A bin packing problem to solve
- Soft
Requirement - A soft requirement (preference) for an item to be packed to a set of bins
- Solution
- A solution to a bin packing problem