In-network data aggregation is one of the popular optimization methodologies in the realm of wireless sensor networks (WSNs). To enable effective implementation, a routing tree is formed and the node transmissions are carefully scheduled to meet flow constraints. Minimizing the data delivery latency has been the most common objective of the data aggregation scheduling optimization. Prior work on this optimization problem pursued heuristics to overcome the complexity of the problem and used an upper bound on latency as a metric to assess the quality of the solution. In this paper we argue that for small and medium sized networks it is computationally feasible to obtain the optimal solution. We formulate the data aggregation scheduling problem as a linear integer program. Two variants of the problem are considered. The first assumes that the routing tree is predefined, e.g., through a network layer protocol, and node transmissions are to be scheduled to minimize delay. For the second variant, the routing topology formation and node schedule are to be optimized in an integrated manner. The proposed solutions are compared to the existing heuristics via extensive simulation experiments.