Vertical farming (VF) has been proposed as an approach to decrease the land required for growing agricultural products. This technique consists of growing produce in vertical orientation within a controlled environment. However, one of the most significant barriers for its implementation is the uncertain economic feasibility, derived from the elevated consumption of energy and the high investment costs. A strategy to enhance VF efficiency proposes its integration with municipal infrastructure, thus establishing closed-loop systems where VF seizes organic waste, manure, CO2, and excess energy from productive plants and local power stations. Because of the economic uncertainty of its development, the optimal synthesis of such a closed-loop system (i.e., the selection and specification of its components, and their connections) is of utmost importance for the implementation of this strategy. The difficulty of the synthesis task arises from the combinatorial nature of the problem and the variability of the resources and market conditions in time. This work employs a graph-theoretic approach for the synthesis of a closed-loop system of VF considering the variability of the resources during multiple periods of operation. The proposed method relies on the P-graph framework which permits the identification of the n-best alternatives for the system’s design, employing the properties of the problem’s structure to enhance the effectiveness of the solution procedure. Consequently, the most cost-effective systems are identified together with their policy of operation for the different periods. This method constitutes a powerful tool for the assessment of systems for VF integration that enhance the sustainability of agricultural activity.