  This paper describes an application of dynamic programming to determine the
optimal strategy for assigning grapes to pressing tanks in one of the largest
Portuguese wineries. To date, linear programming has been employed to generate
proposed solutions to analogous problems, but this approach lacks robustness
and may, in fact, result in severe losses in cases of sudden changes, which
frequently occur in weather-dependent wine factories. Hence, we endowed our
model with stochasticity, thereby rendering it less vulnerable to such changes.
Our analysis, which is based on real-world data, demonstrates that the proposed
algorithm is highly efficient and, after calibration, can be used to support
winery's decision-making. The solution proposed herein could also be applied in
numerous other contexts where production processes rely on outside supplies.
