Metadata-Version: 2.4
Name: bmh
Version: 2026.2.2
Summary: Library for Bulk Material Homogenization simulation and optimization
Keywords: bulk-material,homogenization,simulation,optimization,bmh,jmetalpy
Author: Michael Cipold
Author-email: Michael Cipold <github@cipold.de>
License-Expression: MIT
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Development Status :: 4 - Beta
Classifier: Topic :: Scientific/Engineering
Requires-Dist: jmetalpy==1.5.5
Requires-Dist: numpy>=1.20.0
Requires-Dist: pandas>=1.3.0
Requires-Dist: scipy>=1.10
Requires-Dist: bmh-jmetalpy-extensions~=2026.2.2
Requires-Dist: blending-simulator-lib~=2026.2.2
Requires-Dist: bokeh ; extra == 'bokehplotserver'
Requires-Dist: dask ; extra == 'daskevaluator'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: dask ; extra == 'distributedevaluator'
Requires-Dist: distributed ; extra == 'distributedevaluator'
Requires-Python: >=3.12
Project-URL: Homepage, https://github.com/jcbachmann/blending-evaluation
Project-URL: Repository, https://github.com/jcbachmann/blending-evaluation
Project-URL: Issues, https://github.com/jcbachmann/blending-evaluation/issues
Provides-Extra: bokehplotserver
Provides-Extra: daskevaluator
Provides-Extra: dev
Provides-Extra: distributedevaluator
Description-Content-Type: text/markdown

# Bulk Material Homogenization (bmh)

[![PyPI version](https://img.shields.io/pypi/v/bmh.svg)](https://pypi.org/project/bmh/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Library for the simulation, optimization and evaluation of bulk material homogenization in blending beds: materials and stacker
depositions, stacking and reclaiming with the simulators of [blending-simulation](https://github.com/jcbachmann/blending-simulation)
(through `blending_simulator_lib`) or mathematical models, and the evaluation of the reclaimed material.

## Installation

```bash
pip install bmh
```

Wheels of the simulator bindings are published for Python 3.12 to 3.14 on Linux, Windows and macOS.

## Example

Stack a material of ten quality values in seven stacker positions on a 300 m by 50 m bed, reclaim it and evaluate the reclaimed material:

```python
from bmh.helpers import simple
from bmh.helpers.reclaimed_material_evaluator import ReclaimedMaterialEvaluator

bed_size_x, bed_size_z = 300, 50
material_deposition = simple.generate_material_deposition(
    quality=[1, 5, 3, 10, 5, 8, 3, 9, 3, 1],
    total_volume=100_000,
    x_position=[140, 25, 275, 150, 275, 25, 150],
    bed_size_x=bed_size_x,
    bed_size_z=bed_size_z,
)
reclaimed = simple.bsl_stack_reclaim(material_deposition)  # reclaimed.data: a pandas data frame with one row per slice

evaluator = ReclaimedMaterialEvaluator(reclaimed=reclaimed, x_min=0.5 * bed_size_z, x_max=bed_size_x - 0.5 * bed_size_z)
print(evaluator.get_single_parameter_stdev("quality"))  # F1: standard deviation of the reclaimed quality
print(evaluator.get_volume_stdev())  # F2: deviation of the reclaimed volume from the ideal stockpile
```

`example.ipynb` in the [repository](https://github.com/jcbachmann/blending-evaluation) adds plots of the reclaimed volume and quality.

## Modules

| Module | Contents |
|---|---|
| `bmh.benchmark` | materials, depositions and their combination (`Material`, `Deposition`, `MaterialDeposition`), the simulator benchmark data |
| `bmh.simulation` | simulators behind one interface: `BslBlendingSimulator` (the simulators of `blending_simulator_lib`), `MathematicalBlendingSimulator`, `SmoothBlendingSimulator` |
| `bmh.helpers` | quick setups (`simple`), the standard bed (`bed_setup`), the Chevron, continuous drops along the stacker path, the ideal stockpile, the evaluation of reclaimed material, non-dominated fronts |
| `bmh.optimization` | deposition optimization with jMetalPy (`HomogenizationProblem`, `DepositionOptimizer`), kept unchanged to reproduce the benchmark experiments of 2021 and 2022 |
