← All Use Cases
🌱
Box-Behnken Design

Compost Maturity Optimization

Box-Behnken design to minimize maturation time and maximize nutrient content by tuning C:N ratio, moisture, and turning frequency

Summary

This experiment investigates compost maturity optimization. Box-Behnken design to minimize maturation time and maximize nutrient content by tuning C:N ratio, moisture, and turning frequency.

The design varies 3 factors: cn ratio (ratio), ranging from 20 to 40, moisture pct (%), ranging from 40 to 65, and turn freq (per_week), ranging from 1 to 7. The goal is to optimize 2 responses: maturity weeks (weeks) (minimize) and nutrient score (pts) (maximize). Fixed conditions held constant across all runs include pile volume = 1m3, initial material = mixed_greens_browns.

A Box-Behnken design was chosen because it efficiently fits quadratic models with 3 continuous factors while avoiding extreme corner combinations — requiring only 15 runs instead of the 8 needed for a full factorial at two levels.

Quadratic response surface models were fitted to capture potential curvature and factor interactions. The RSM contour plots below visualize how pairs of factors jointly affect each response.

Key Findings

For maturity weeks, the most influential factors were moisture pct (54.5%), cn ratio (26.7%), turn freq (18.8%). The best observed value was 8.4 (at cn ratio = 30, moisture pct = 40, turn freq = 7).

For nutrient score, the most influential factors were moisture pct (52.9%), cn ratio (26.5%), turn freq (20.6%). The best observed value was 7.1 (at cn ratio = 30, moisture pct = 40, turn freq = 7).

Recommended Next Steps

Experimental Setup

Factors

FactorLowHighUnit
cn_ratio2040ratio
moisture_pct4065%
turn_freq17per_week

Fixed: pile_volume = 1m3, initial_material = mixed_greens_browns

Responses

ResponseDirectionUnit
maturity_weeks↓ minimizeweeks
nutrient_score↑ maximizepts

Configuration

use_cases/98_compost_maturity/config.json
{ "metadata": { "name": "Compost Maturity Optimization", "description": "Box-Behnken design to minimize maturation time and maximize nutrient content by tuning C:N ratio, moisture, and turning frequency" }, "factors": [ { "name": "cn_ratio", "levels": [ "20", "40" ], "type": "continuous", "unit": "ratio" }, { "name": "moisture_pct", "levels": [ "40", "65" ], "type": "continuous", "unit": "%" }, { "name": "turn_freq", "levels": [ "1", "7" ], "type": "continuous", "unit": "per_week" } ], "fixed_factors": { "pile_volume": "1m3", "initial_material": "mixed_greens_browns" }, "responses": [ { "name": "maturity_weeks", "optimize": "minimize", "unit": "weeks" }, { "name": "nutrient_score", "optimize": "maximize", "unit": "pts" } ], "settings": { "operation": "box_behnken", "test_script": "use_cases/98_compost_maturity/sim.sh" } }

Experimental Matrix

The Box-Behnken Design produces 15 runs. Each row is one experiment with specific factor settings.

Runcn_ratiomoisture_pctturn_freq
130401
23052.54
34052.57
44052.51
53052.54
63052.54
72052.57
840404
930407
1040654
112052.51
1230657
1320404
1420654
1530651

Step-by-Step Workflow

1

Preview the design

Terminal
$ doe info --config use_cases/98_compost_maturity/config.json
2

Generate the runner script

Terminal
$ doe generate --config use_cases/98_compost_maturity/config.json \ --output use_cases/98_compost_maturity/results/run.sh --seed 42
3

Execute the experiments

Terminal
$ bash use_cases/98_compost_maturity/results/run.sh
4

Analyze results

Terminal
$ doe analyze --config use_cases/98_compost_maturity/config.json
5

Get optimization recommendations

Terminal
$ doe optimize --config use_cases/98_compost_maturity/config.json
6

Multi-objective optimization

With 2 competing responses, use --multi to find the best compromise via Derringer–Suich desirability.

Terminal
$ doe optimize --config use_cases/98_compost_maturity/config.json --multi
7

Generate the HTML report

Terminal
$ doe report --config use_cases/98_compost_maturity/config.json \ --output use_cases/98_compost_maturity/results/report.html

Features Exercised

FeatureValue
Design typebox_behnken
Factor typescontinuous (all 3)
Arg styledouble-dash
Responses2 (maturity_weeks ↓, nutrient_score ↑)
Total runs15

Analysis Results

Generated from actual experiment runs using the DOE Helper Tool.

Response: maturity_weeks

Top factors: moisture_pct (54.5%), cn_ratio (26.7%), turn_freq (18.8%).

ANOVA

SourceDFSSMSFp-value
SourceDFSSMSFp-value
cn_ratio24.11722.05861.5320.2733
moisture_pct220.992210.49617.8130.0131
turn_freq22.26221.13110.8420.4657
LackofFit6119.571119.9285
PureError22.6867
Error8122.25781.3433
Total14149.629310.6878

Pareto Chart

Pareto chart for maturity_weeks

Main Effects Plot

Main effects plot for maturity_weeks

Normal Probability Plot of Effects

Normal probability plot for maturity_weeks

Half-Normal Plot of Effects

Half-normal plot for maturity_weeks

Model Diagnostics

Model diagnostics for maturity_weeks

Response: nutrient_score

Top factors: moisture_pct (52.9%), cn_ratio (26.5%), turn_freq (20.6%).

ANOVA

SourceDFSSMSFp-value
SourceDFSSMSFp-value
cn_ratio20.91730.45870.6040.5700
moisture_pct23.33731.66872.1960.1737
turn_freq20.56520.28260.3720.7008
LackofFit65.57750.9296
PureError21.5200
Error87.09750.7600
Total1411.91730.8512

Pareto Chart

Pareto chart for nutrient_score

Main Effects Plot

Main effects plot for nutrient_score

Normal Probability Plot of Effects

Normal probability plot for nutrient_score

Half-Normal Plot of Effects

Half-normal plot for nutrient_score

Model Diagnostics

Model diagnostics for nutrient_score

Response Surface Plots

3D surfaces fitted with quadratic RSM. Red dots are observed data points.

maturity weeks cn ratio vs moisture pct

RSM surface: maturity weeks cn ratio vs moisture pct

maturity weeks cn ratio vs turn freq

RSM surface: maturity weeks cn ratio vs turn freq

maturity weeks moisture pct vs turn freq

RSM surface: maturity weeks moisture pct vs turn freq

nutrient score cn ratio vs moisture pct

RSM surface: nutrient score cn ratio vs moisture pct

nutrient score cn ratio vs turn freq

RSM surface: nutrient score cn ratio vs turn freq

nutrient score moisture pct vs turn freq

RSM surface: nutrient score moisture pct vs turn freq

Multi-Objective Optimization

When responses compete, Derringer–Suich desirability finds the best compromise. Each response is scaled to a 0–1 desirability, then combined via a weighted geometric mean.

Overall Desirability
D = 0.9545

Per-Response Desirability

ResponseWeightDesirabilityPredictedDir
maturity_weeks 1.0
0.9545
8.40 0.9545 8.40 weeks
nutrient_score 1.5
0.9545
7.10 0.9545 7.10 pts

Recommended Settings

FactorValue
cn_ratio20 ratio
moisture_pct40 %
turn_freq4 per_week

Source: from observed run #3

Trade-off Summary

Sacrifice = how much worse than single-objective best.

ResponsePredictedBest ObservedSacrifice
nutrient_score7.107.10+0.00

Top 3 Runs by Desirability

RunDFactor Settings
#120.8132cn_ratio=40, moisture_pct=65, turn_freq=4
#100.7364cn_ratio=40, moisture_pct=52.5, turn_freq=7

Model Quality

ResponseType
nutrient_score0.8922quadratic

Full Multi-Objective Output

doe optimize --multi
============================================================ MULTI-OBJECTIVE OPTIMIZATION Method: Derringer-Suich Desirability Function ============================================================ Overall desirability: D = 0.9545 Response Weight Desirability Predicted Direction --------------------------------------------------------------------- maturity_weeks 1.0 0.9545 8.40 weeks ↓ nutrient_score 1.5 0.9545 7.10 pts ↑ Recommended settings: cn_ratio = 20 ratio moisture_pct = 40 % turn_freq = 4 per_week (from observed run #3) Trade-off summary: maturity_weeks: 8.40 (best observed: 8.40, sacrifice: +0.00) nutrient_score: 7.10 (best observed: 7.10, sacrifice: +0.00) Model quality: maturity_weeks: R² = 0.7224 (quadratic) nutrient_score: R² = 0.8922 (quadratic) Top 3 observed runs by overall desirability: 1. Run #3 (D=0.9545): cn_ratio=20, moisture_pct=40, turn_freq=4 2. Run #12 (D=0.8132): cn_ratio=40, moisture_pct=65, turn_freq=4 3. Run #10 (D=0.7364): cn_ratio=40, moisture_pct=52.5, turn_freq=7

Full Analysis Output

doe analyze
=== Main Effects: maturity_weeks === Factor Effect Std Error % Contribution -------------------------------------------------------------- moisture_pct 2.5929 0.8441 54.5% cn_ratio 1.2679 0.8441 26.7% turn_freq 0.8929 0.8441 18.8% === ANOVA Table: maturity_weeks === Source DF SS MS F p-value ----------------------------------------------------------------------------- cn_ratio 2 4.1172 2.0586 1.532 0.2733 moisture_pct 2 20.9922 10.4961 7.813 0.0131 turn_freq 2 2.2622 1.1311 0.842 0.4657 Lack of Fit 6 119.5711 19.9285 14.835 0.0645 Pure Error 2 2.6867 1.3433 Error 8 122.2578 1.3433 Total 14 149.6293 10.6878 === Summary Statistics: maturity_weeks === cn_ratio: Level N Mean Std Min Max ------------------------------------------------------------ 20 4 12.3750 4.7169 8.4000 17.9000 30 7 13.6429 2.6906 11.2000 18.5000 40 4 13.2750 3.4316 10.3000 18.2000 moisture_pct: Level N Mean Std Min Max ------------------------------------------------------------ 40 4 14.0500 3.4694 10.3000 18.5000 52.5 7 11.9571 3.3371 8.4000 18.2000 65 4 14.5500 2.9275 11.9000 17.9000 turn_freq: Level N Mean Std Min Max ------------------------------------------------------------ 1 4 13.8500 4.2821 8.4000 18.2000 4 7 12.9571 2.6229 10.3000 17.9000 7 4 13.0000 4.1263 8.5000 18.5000 === Main Effects: nutrient_score === Factor Effect Std Error % Contribution -------------------------------------------------------------- moisture_pct 1.2000 0.2382 52.9% cn_ratio 0.6000 0.2382 26.5% turn_freq 0.4679 0.2382 20.6% === ANOVA Table: nutrient_score === Source DF SS MS F p-value ----------------------------------------------------------------------------- cn_ratio 2 0.9173 0.4587 0.604 0.5700 moisture_pct 2 3.3373 1.6687 2.196 0.1737 turn_freq 2 0.5652 0.2826 0.372 0.7008 Lack of Fit 6 5.5775 0.9296 1.223 0.5147 Pure Error 2 1.5200 0.7600 Error 8 7.0975 0.7600 Total 14 11.9173 0.8512 === Summary Statistics: nutrient_score === cn_ratio: Level N Mean Std Min Max ------------------------------------------------------------ 20 4 5.6000 1.1225 4.6000 7.1000 30 7 5.4000 0.9557 3.9000 6.7000 40 4 6.0000 0.7616 5.4000 7.1000 moisture_pct: Level N Mean Std Min Max ------------------------------------------------------------ 40 4 4.8500 0.7506 3.9000 5.5000 52.5 7 5.8000 0.7895 4.4000 7.1000 65 4 6.0500 1.0247 4.9000 7.1000 turn_freq: Level N Mean Std Min Max ------------------------------------------------------------ 1 4 5.9250 0.7848 5.5000 7.1000 4 7 5.4571 0.9378 4.4000 7.1000 7 4 5.5750 1.1871 3.9000 6.7000

Optimization Recommendations

doe optimize
=== Optimization: maturity_weeks === Direction: minimize Best observed run: #3 cn_ratio = 30 moisture_pct = 40 turn_freq = 7 Value: 8.4 RSM Model (linear, R² = 0.1793, Adj R² = -0.0445): Coefficients: intercept +13.2067 cn_ratio +1.3750 moisture_pct +1.1500 turn_freq -0.3750 RSM Model (quadratic, R² = 0.7906, Adj R² = 0.4137): Coefficients: intercept +10.5333 cn_ratio +1.3750 moisture_pct +1.1500 turn_freq -0.3750 cn_ratio*moisture_pct +0.1750 cn_ratio*turn_freq -2.7750 moisture_pct*turn_freq +1.5750 cn_ratio^2 +3.4208 moisture_pct^2 -0.0292 turn_freq^2 +1.6208 Curvature analysis: cn_ratio coef=+3.4208 convex (has a minimum) turn_freq coef=+1.6208 convex (has a minimum) moisture_pct coef=-0.0292 negligible curvature Notable interactions: cn_ratio*turn_freq coef=-2.7750 (antagonistic) moisture_pct*turn_freq coef=+1.5750 (synergistic) Predicted optimum (from quadratic model, at observed points): cn_ratio = 40 moisture_pct = 52.5 turn_freq = 1 Predicted value: 20.1000 Surface optimum (via L-BFGS-B, quadratic model): cn_ratio = 31.0507 moisture_pct = 40 turn_freq = 6.07447 Predicted value: 8.7430 Model quality: Good fit — general trends are captured, some noise remains. Factor importance: 1. cn_ratio (effect: 4.7, contribution: 53.6%) 2. moisture_pct (effect: 2.3, contribution: 26.3%) 3. turn_freq (effect: 1.8, contribution: 20.1%) === Optimization: nutrient_score === Direction: maximize Best observed run: #3 cn_ratio = 30 moisture_pct = 40 turn_freq = 7 Value: 7.1 RSM Model (linear, R² = 0.1911, Adj R² = -0.0295): Coefficients: intercept +5.6133 cn_ratio +0.3750 moisture_pct -0.3625 turn_freq +0.1125 RSM Model (quadratic, R² = 0.5541, Adj R² = -0.2486): Coefficients: intercept +6.2333 cn_ratio +0.3750 moisture_pct -0.3625 turn_freq +0.1125 cn_ratio*moisture_pct -0.3000 cn_ratio*turn_freq +0.4000 moisture_pct*turn_freq -0.5250 cn_ratio^2 -0.7042 moisture_pct^2 -0.0792 turn_freq^2 -0.3792 Curvature analysis: cn_ratio coef=-0.7042 concave (has a maximum) turn_freq coef=-0.3792 concave (has a maximum) moisture_pct coef=-0.0792 negligible curvature Notable interactions: moisture_pct*turn_freq coef=-0.5250 (antagonistic) cn_ratio*turn_freq coef=+0.4000 (synergistic) Predicted optimum (from linear model, at observed points): cn_ratio = 40 moisture_pct = 40 turn_freq = 4 Predicted value: 6.3508 Surface optimum (via L-BFGS-B, linear model): cn_ratio = 40 moisture_pct = 40 turn_freq = 7 Predicted value: 6.4633 Model quality: Weak fit — consider adding center points or using a different design. Factor importance: 1. cn_ratio (effect: 1.0, contribution: 47.4%) 2. moisture_pct (effect: 0.7, contribution: 32.8%) 3. turn_freq (effect: 0.4, contribution: 19.7%)
← Previous: Tomato Greenhouse Yield Next: Seed Germination Rate →