Inspiration
Crop rotation decisions get made on gut instinct and habit, not math, even though bad rotation quietly wrecks soil over years: nutrient depletion, disease buildup, yield decline. Wanted to see what happens when you actually model the soil physics and let different optimization strategies compete on equal footing, fully inspectable, no black box.
What it does
Rotato takes field soil type and a planning horizon, then runs four strategies against the same deterministic soil model to build a multi-season planting plan:
Baseline: grower's habitual rotation repeated as control Greedy: picks best immediate score each season, myopic by design Simulated annealing + hill-climb: 12,000 iterations of Metropolis search over the legal sequence space, then polished to a local optimum Tabular Q-learning: reinforcement-learning agent that never sees the soil equations, learns purely from reward over 600 episodes Results dashboard shows strategy rankings, yield-per-season charts, soil health trajectories, and the full math behind every number.
How we built it
React 19 + TypeScript + Vite, fully client-side, no backend. Soil engine (src/engine/) models five state variables (N, P, K, organic matter, structure) plus per-family disease pressure, evolving under each of 12 crops' uptake, residue, and rooting profiles. Yield comes out as a chain of multipliers: fertility times structure times organic matter times disease times soil fit times water stress. Both stochastic solvers use a seeded mulberry32 PRNG so runs stay deterministic. All four strategies solve in about 50ms. UI built with Framer Motion for the sunflower hero (SVG botanical illustration, parallax plus mouse-tracking tilt) and Recharts for the results.
Challenges we ran into
Getting soil dynamics believable took most of the effort: tuning mean-reversion rates, erosion, disease decay so monoculture visibly self-destructs but legume rotation visibly heals soil, without hardcoding the "right" answer, so the optimizers had something real to discover. Discretizing continuous soil state for tabular Q-learning without blowing up the state space was another one; landed on bucketing NPK, OM, structure, disease, and seasons remaining into small ranges to keep the lookup table tractable.
Accomplishments that we're proud of
Built four genuinely different solvers (rule-based baseline, greedy, simulated annealing, RL) on top of one shared soil model, and made every equation visible in the UI, not hidden behind a score. Got a soil model with 5 state variables, 7 disease families, and 12 crops running full multi-season plans client-side in about 50ms, with zero backend. Annealer's hill-climb polish reliably lands on rotations that beat naive baselines on both yield and soil health, not just one or the other.
What we learned
How much of "sustainable farming" is really constraint satisfaction plus lookahead. Also that simulated annealing with a decent hill-climb polish beats tabular Q-learning on this kind of small discrete combinatorial problem, a good baseline to keep in mind before reaching for RL.
What's next for rotato
More crops and regional soil presets, so rotations reflect real local agronomy, not just four generic soil types Weather variability (drought years, wet years) layered onto the deterministic model, so plans account for risk not just averages Export a rotation plan to a shareable/printable format farmers could actually take to a field Compare strategies against real historical yield data as a sanity check on the model, not just internal scores Multi-field planning, since real farms rotate crops across several fields with shared constraints (equipment, labor, market timing)
Built With
- css
- framer-motion
- html
- javascript
- lucide-react
- oxlint
- react
- recharts
- reinforcement-learning
- tsx
- typescript
- vite
Log in or sign up for Devpost to join the conversation.