Differentiable tree growth simulation for climate-resilient reforestation planning
Originally intended as a submission for the Tesseract Hackathon 2025.
A fully differentiable simulation of tree growth that enables gradient-based optimization of resource allocation strategies for climate objectives. The inverse problem: given environmental conditions, what allocation policy maximizes carbon sequestration while maintaining survival under stress?
Key capabilities:
- Tree growth dynamics: Energy, water, nutrients, and biomass (roots, trunk, shoots, leaves, flowers, fruit) evolve over ~100 days under environmental stress
- Neural allocation policy: An MLP learns to allocate resources, optimized via gradient descent
- Carbon sequestration metrics: Permanence-weighted carbon scoring that reflects long-term climate impact
- Resilience analysis: Gradient-based sensitivity reveals environmental tipping points where survival collapses
- Tesseract composition: Modular, deployable ML pipeline components
Trees are critical for climate mitigation (carbon sequestration) and adaptation (ecosystem resilience). Effective reforestation requires understanding:
-
Carbon tradeoffs: Trunk wood stores carbon for decades; leaves decompose within a year. How should trees allocate resources to maximize durable sequestration?
-
Tipping points: Where do small environmental changes cause disproportionate fitness loss? What are the critical moisture/wind thresholds?
-
Policy robustness: How do allocation strategies perform across climate scenarios?
Arborhedron addresses these questions with a differentiable framework that exposes gradients for both optimization and sensitivity analysis.
See the Technical Writeup for more details.
Built with JAX, modeling:
- Resource economics (energy, water, nutrient flows)
- Structural constraints (transport bottlenecks, self-shading)
- Environmental response (stomatal closure, wind damage)
- Reproduction (flowering, fruiting, seed production)
An MLP that observes tree state + environment and outputs resource allocation fractions. Trainable via gradient descent on seeds, carbon, or combined objectives.
Biomass is converted to carbon content using tissue-specific fractions, then weighted by permanence:
| Tissue | Carbon Fraction | Permanence |
|---|---|---|
| Trunk | 0.50 | 1.0 |
| Roots | 0.45 | 0.7 |
| Shoots | 0.45 | 0.3 |
| Leaves | 0.45 | 0.1 |
| Flowers | 0.40 | 0.05 |
The permanence-weighted carbon score rewards durable carbon storage (trunk wood persists for decades; leaves decompose within a year).
Tools for identifying critical environmental thresholds:
- 2D parameter sweeps: Map fitness across moisture × wind space
- Gradient sensitivity: ∂fitness/∂param reveals where small changes cause large effects
- Tipping point detection: Locate where gradients spike or fitness collapses
- Resilience boundaries: Contours separating viable from non-viable regions
Three Tesseracts that compose into a differentiable pipeline:
neural_policy → growth_step → seed_production
↑ │
└──────────────┘ (loop N days)
L-system tree rendering with stained-glass style leaves and blossoms.
Neural policies trained for different objectives reveal a fundamental tradeoff:
| Policy | Carbon Integral | Seeds Produced |
|---|---|---|
| Carbon-Optimized | 66.44 | 0.00 |
| Seed-Optimized | 49.02 | 1.63 |
The carbon-optimized policy achieves 35% more carbon sequestration by investing heavily in trunk wood, but produces zero seeds. This mirrors real forestry decisions between fast-growing species (more seeds, less durable wood) and slow-growing hardwoods (fewer seeds, centuries of carbon storage).
2D parameter sweeps reveal where trees can survive and where they fail:
The fitness landscape shows:
- Viable region: High moisture, low wind (green area)
- Collapse zones: Low moisture or high wind causes fitness to drop sharply
- Tipping points: Boundaries where small environmental changes cause large fitness losses
These resilience boundaries help identify which ecosystems are most vulnerable to climate change.
git clone https://github.com/ndouglas/arborhedron.git
cd arborhedron
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Build Tesseracts (requires Docker)
./buildall.shpython main.pyfrom sim import SimConfig, ClimateConfig, TreeState, run_season
config = SimConfig()
climate = ClimateConfig.mild()
initial_state = TreeState.initial()
trajectory = run_season(initial_state, climate, config)
print(f"Seeds produced: {trajectory.seeds:.2f}")from sim import generate_tree_skeleton, render_tree, TreeParams, TreeStyle
params = TreeParams(depth=4)
skeleton = generate_tree_skeleton(params, seed=42)
fig = render_tree(skeleton, TreeStyle())
fig.savefig("tree.png")arborhedron/
├── sim/ # Core simulation
│ ├── config.py # State and config definitions
│ ├── dynamics.py # Growth step logic
│ ├── surrogates.py # Biological response functions
│ ├── policies.py # Allocation policies
│ ├── rollout.py # Season simulation
│ ├── carbon.py # Carbon sequestration metrics
│ ├── resilience.py # Tipping point analysis
│ └── stained_glass.py # Tree visualization
├── tesseracts/ # Tesseract definitions
│ ├── growth_step/ # Single-day dynamics
│ ├── neural_policy/ # Allocation policy
│ └── seed_production/ # Fitness computation
├── notebooks/ # Exploration notebooks
├── docs/ # Technical documentation
│ └── technical_writeup.md # Hackathon submission writeup
├── tests/ # Test suite
└── main.py # Tesseract composition demo
Apache License 2.0



