← News
Tech for Good Tech for Good Frontiers

How AI Learned to Think Decades Ahead for Tomato Greenhouses

How AI Learned to Think Decades Ahead for Tomato Greenhouses
54% Higher % Performance over RL
80% Higher % Performance over MPC
1 Hour Prediction horizon
Tomatoes Crop type
54% performance boost over RL alone
80% performance boost over MPC alone

Greenhouse tomatoes are patient crops. From the moment a flower is pollinated until a ripe fruit hangs ready for harvest, weeks pass—typically 40 to 60 days of careful balance between warmth, light, carbon dioxide, and water. Every decision a grower makes today—how much to heat the greenhouse, when to open the vents, how brightly to fire the LED arrays—ripples forward through that long development window. Crank up the heating now, and the fruit might swell faster later. Dim the lights today to save electricity, and you might sacrifice weight that won't show up on the scale for weeks.

This temporal mismatch between costs and benefits is one of the hardest problems in agricultural automation. The ideal controller would optimize over the entire growing season, balancing today's energy bills against fruit revenues that won't materialize for two months. But solving such problems computationally is brutal—especially when the underlying math involves large, nonlinear models with stiff dynamics, the kind that describe real high-tech greenhouses.

A team from Wageningen University & Research and Delft University of Technology has now demonstrated a framework that might finally bridge this gap. Their approach, called trajectory-selection reinforcement learning model predictive control (RL-MPC), doesn't try to solve the full long-horizon problem. Instead, it marries two existing control philosophies—letting each compensate for the other's blind spots. In simulations using GreenLight, a detailed tomato greenhouse model, their hybrid controller matched the performance of a high-performing RL policy while dramatically outperforming both standalone RL and standalone MPC on weather conditions the system had never encountered. The numbers are striking: 54% better than standalone RL, 80% better than MPC using the same short prediction horizon.

The Science

The challenge this work tackles lives at the intersection of control theory, agricultural science, and computational optimization. Greenhouse climate control isn't merely about keeping plants alive—it's an economic problem dressed in the language of differential equations.

The goal, as the researchers frame it, is maximizing "economic performance": fruit revenue minus operating costs. But these two terms arrive on vastly different timescales. Operating costs—heating fuel, electricity for lights, CO₂ for injection—are paid immediately, every five minutes, every hour. Fruit revenue, by contrast, accrues weeks later, after a tomato has completed its long journey from flower to fruit to harvest.

This creates what control theorists call a "delayed economic benefit" problem. A controller that only looks one hour ahead—the way a short-horizon model predictive controller might—sees only the costs. It has no way to account for the fact that keeping the greenhouse slightly warmer tonight will produce heavier fruit in six weeks. The result is myopia: a controller that penny-wise and pound-foolish.

Model predictive control is well-suited to many climate control problems. At each time step, MPC solves an optimization problem over a finite "prediction horizon"—a window of future time—using predicted disturbances like weather forecasts. It then applies only the first control input from its computed trajectory, then solves again from the new state. This "receding horizon" approach lets the controller adapt to changing conditions while respecting system constraints like minimum and maximum temperatures.

The catch is computational. For greenhouse tomato production, the relevant horizon for balancing costs and benefits stretches across the entire fruit development period—40 to 60 days. A controller solving optimization problems over windows that long, using large nonlinear models, simply can't run fast enough to keep up with real-time demands. The math becomes intractable.

Reinforcement learning offers a different angle. Rather than solving optimization problems online, RL learns a control policy offline through extensive simulation. The algorithm explores different control strategies, learning which ones maximize cumulative reward over long time horizons. Once trained, an RL policy can compute control inputs quickly—no iterative optimization required.

But RL brings its own baggage. It doesn't natively enforce constraints; instead, constraint violations are typically penalized in the reward function. Getting the weighting right requires careful tuning, and even then, RL policies can produce infeasible actions. More fundamentally, RL policies trained on a particular distribution of conditions may perform poorly when confronted with circumstances they haven't seen before. An RL controller trained on mild Dutch summers might stumble when asked to manage a heatwave it never encountered in training.

The researchers—Bart van Laatum, Salim Msaad, Eldert van Henten, Robert McAllister, and Sjoerd Boersma—wanted to take the best of both approaches. They sought a controller that could incorporate long-term economic information like RL, while retaining the constraint handling and online adaptation of MPC.

The GreenLight Model

To test their framework, the researchers used GreenLight, an open-source tomato greenhouse climate model developed at Wageningen University (Katzin et al., 2020). GreenLight is not a toy. It comprises 27 state variables capturing the indoor climate—temperature, CO₂ concentration, humidity—and crop development states representing dry weight and growth stages. The model has been validated against real-world greenhouse data from commercial facilities.

The model exhibits "stiff dynamics," meaning it contains processes operating at wildly different timescales. Some states change rapidly (indoor temperature responding to heating within minutes), while others evolve slowly (fruit dry weight accumulating over weeks). This stiffness makes numerical integration challenging; stable solutions require small time steps or sophisticated solvers. The researchers used CVODES, an implicit variable-step integrator with automatic differentiation, to handle these demands.

The control inputs include six variables: boiler heating power, LED lighting intensity, CO₂ injection rate, vent opening, thermal screen deployment, and blackout screen deployment. Each is bounded by physical and economic limits—a boiler can't output more than 44 W/m², for instance, and control inputs are constrained to change by no more than 10% per time step to prevent jarring shifts in the indoor environment.

The reward function encodes the economic trade-off directly. Revenue comes from fruit growth, measured as the change in fruit dry weight over each time step. Costs come from three sources: CO₂ injection, heating, and electricity for LED lighting. Violations of climate constraints—deviations from optimal temperature, humidity, or CO₂ ranges—receive penalty terms. The controller's job is to maximize the sum of this reward over the simulation period.

How Trajectory-Selection RL-MPC Works

The framework rests on a clever observation: an RL policy, trained to maximize long-term economic performance, implicitly encodes information about what should happen after the MPC's prediction horizon ends. Rather than throwing this information away, the researchers use the RL rollout—a simulated trajectory generated by applying the RL policy from the current state—to provide "terminal ingredients" for the MPC optimization.

At each time step, the process works as follows. First, the RL policy simulates forward from the current state using predicted weather disturbances, generating a full rollout trajectory over the MPC's prediction horizon. This rollout represents the RL policy's best guess at how the greenhouse should evolve.

Next, the MPC solves its own optimization problem over the same horizon. But here's the key twist: the MPC is constrained to end its predicted trajectory near the terminal state of the RL rollout. This "terminal region constraint" ties the short-horizon MPC to the longer-term economic wisdom embedded in the RL policy. Additionally, the MPC receives a "terminal cost" derived from the RL rollout's estimated value, approximating what would happen if the RL policy continued beyond the MPC's horizon.

The MPC optimization locally refines the RL's suggestion, adjusting for near-term weather predictions that the RL might not have accounted for optimally. The result is a trajectory that respects both the long-term economic structure learned by RL and the fine-grained adaptation enabled by online optimization.

Finally—and this is the "trajectory selection" step—the framework compares the finite-horizon objective values of two candidates: the MPC-predicted trajectory and the original RL rollout trajectory. Whichever has the better objective value gets its first control input applied to the actual greenhouse. This selection guardrail prevents performance degradation when the MPC optimization fails to improve upon the RL policy.

The design avoids overconfidence. If the MPC has nothing useful to add in a particular situation, the system defaults to the RL policy. If the RL policy's rollout was trained on conditions unlike the current weather, the MPC's online refinement can compensate.

What They Found

The researchers tested their framework in two complementary experiments, each revealing a different dimension of the controller's capabilities.

The first experiment used a "specialist" RL policy trained on a single weather trajectory. The policy was optimized for one specific sequence of outdoor conditions—essentially, it learned how to run a perfect greenhouse under one particular year of weather. The question was simple: can trajectory-selection RL-MPC, using only a one-hour prediction horizon, achieve the same closed-loop performance as this specialist RL policy that implicitly considers much longer economic horizons?

The answer was yes. Trajectory-selection RL-MPC matched the specialist RL's performance on the training trajectory, effectively inheriting the policy's long-term economic foresight through the terminal region constraint and terminal cost.

The second experiment was tougher. Here, the RL policy was trained on a broad distribution of 25 different weather trajectories—different seasons, different years, different weather patterns. The policy learned to perform reasonably well across this diverse training set, but it had never encountered the specific 25 trajectories held out for testing. This simulates a real-world deployment scenario: a grower faces weather they can't perfectly predict, conditions that might differ from anything in the historical record.

On these unseen weather trajectories, trajectory-selection RL-MPC substantially outperformed both alternatives. Against standalone RL, it achieved 54% higher closed-loop performance. Against MPC with the same one-hour horizon, it achieved 80% higher performance.

Closed-Loop Performance Comparison

Closed-Loop Performance Comparison
LabelValue
Trajectory-Selection RL-MPC100
Standalone RL65
Standalone MPC (1-hour horizon)56

The gains came from two sources. First, the terminal region constraint anchored the MPC to regions of state space consistent with good long-term economic outcomes—the RL policy had learned that certain states, while perhaps locally expensive, led to better fruit yields later. Second, the online MPC optimization refined control trajectories using actual weather predictions, reducing constraint violations and operating costs that the RL policy accumulated when forced to improvise under unfamiliar conditions.

Specialist Policy Training Trajectory: Performance Match

Specialist Policy Training Trajectory: Performance Match
LabelValue
Specialist RL Policy100
Trajectory-Selection RL-MPC100
Standalone MPC64

The one-hour prediction horizon is critical. A one-hour horizon is computationally tractable even for a 27-state nonlinear model. The researchers didn't need to solve the full 40-to-60-day optimal control problem; instead, they let the RL policy's learned knowledge do the heavy lifting for the time beyond the horizon. The MPC then handled the immediate future with precision.

Why This Changes Things

Greenhouse horticulture sits at an uncomfortable frontier. On one side sit experienced growers with decades of tacit knowledge about how to balance yield against costs, how to respond to a cold snap or an unexpected heat wave. On the other side sit increasingly powerful control algorithms that can optimize in ways humans can't manually compute but struggle to deploy in practice.

The computational barrier has been the key bottleneck. Detailed greenhouse models like GreenLight are too complex for real-time optimization over economically meaningful horizons. Simplified models are tractable but sacrifice the fidelity needed to capture important dynamics. RL policies trained in simulation can learn good control strategies, but they carry the generalization problem like a hidden debt—working well until conditions shift in ways that weren't anticipated.

Trajectory-selection RL-MPC addresses both constraints. By embedding RL's long-horizon wisdom into a short-horizon MPC through terminal constraints, it sidesteps the computational intractability of direct long-horizon optimization. By then allowing MPC to locally refine the RL's suggestion using actual weather predictions, it hedges against the generalization failures that plague standalone RL.

The 54% performance improvement over standalone RL on unseen weather trajectories is the headline number. It suggests that the hybrid approach can indeed generalize better—a critical requirement for any commercial deployment. Real greenhouses don't experience the same weather twice; a controller that fails under novel conditions is not commercially viable.

The 80% improvement over same-horizon MPC is equally striking. Standard MPC with a one-hour horizon is myopic; it sees only the immediate costs and doesn't know that a heating decision today affects fruit weight six weeks from now. The RL-derived terminal ingredients give MPC the economic perspective it lacks. The researchers effectively gave a short-sighted optimizer a glimpse of the future through learned proxies.

The simulation setup has limitations worth acknowledging. The closed-loop experiments evaluated controllers over one-day periods rather than full production cycles. The GreenLight model was used both for simulation and as the MPC prediction model, meaning any model mismatch that might exist in real deployment wasn't captured. And the weather trajectories, while diverse, represent a finite sample of possible conditions.

Even so, the results demonstrate that the framework can incorporate the delayed benefit of fruit yield into short-horizon optimization. Whether that incorporation translates to full-season performance remains to be tested, but the mechanism is sound.

What's Next

The immediate next step is longer simulation horizons. The researchers acknowledge that their one-day evaluation periods can't fully validate whether the framework delivers sustained performance over the full 40-to-60-day fruit development period. Running closed-loop simulations that long would be computationally demanding—each day of simulation requires hundreds of time steps, each involving model integration, RL rollout generation, and MPC optimization—but it's a necessary validation for practical deployment.

Model mismatch is the elephant in the room for any control system designed in simulation. Real greenhouses don't behave exactly like GreenLight; the model is a simplification of complex biological and physical processes. A robust deployment would need to handle discrepancies between predicted and actual behavior—either through explicit robustness margins in the MPC formulation or through adaptive techniques that update the model over time.

The RL training procedure also deserves scrutiny. The specialist policy achieved excellent performance on its training trajectory but would likely fail under different weather conditions. The generalist policy was more robust but presumably performs less well on any single trajectory. Finding the right training distribution—the sweet spot between specialization and generalization—may require domain expertise about which weather variations are most relevant for economic performance.

On the hardware side, deploying this framework in a real greenhouse would require not just the control algorithm but a sensing infrastructure to estimate the 27 state variables in real time. Temperature, humidity, and CO₂ are straightforward to measure. Crop states like dry weight and development stage are harder to observe directly and might require inference from proxy measurements or periodic destructive sampling.

The broader implications extend beyond tomatoes. The framework addresses a general problem: how to incorporate long-horizon economic information into controllers that must run in real time on complex nonlinear systems. Greenhouses are one application, but similar challenges arise in building climate control, industrial process control, and supply chain management. The trajectory-selection mechanism—comparing MPC and RL trajectories and choosing the better—might generalize to these domains.

For greenhouse growers, the promise is twofold: better economic performance and reduced reliance on specialized expertise. As experienced horticulturists retire and the industry struggles to train replacements, automated control systems that capture and encode that expertise become increasingly valuable. A controller that can match or exceed specialist performance while adapting to unseen conditions would be commercially transformative.

The numbers from this study—54% and 80%—are simulations, not field results. They're a proof of concept, not a product. But they demonstrate that the approach is worth pursuing, that the marriage of RL and MPC can yield something greater than either alone. For a problem as economically important as sustainable food production, that's a result worth watching.