Author - Richard Wang

Mentor - Dr. Kevin Blagrave

This is one of the first studies of the application of quantum computing in agriculture. Due to factors like topsoil erosion, pests, and pathogens, farmers are not always able to produce the optimal amount of crops. In addition, farmers may not apply water and nutrients to their crops most efficiently, leading to many potential crops being lost. I have used quantum annealers to prescribe water and nutrients to sections of fields (cells) depending on: each cell’s yield efficiency, a maximum amount of water and nutrients available to the system, and waterzones restricting differences in water prescription amongst each waterzone. This was done for both a nine-cell field problem and a three-input problem. Promising results were found as both problems were successfully solved when run on D-Wave’s Leap Hybrid Sampler. Furthermore, the crop network in the United States is extremely connected. This level of connectivity helps pests and pathogens easily spread from field to field and destroy crops. As a result, fields are losing efficiency in a time when around 800 million people around the world face hunger. I created a maximum-cut (MaxCut) graph where the vertices represent fields and the edges represent the landscape resistance to transmission (LRT) values. Using the quantum approximate optimization algorithm (QAOA) on IBM’s Quantum Experience platform, I partitioned the fields into two groups where the LRT values are maximized, leading to more resistance to transmission of pests and disease. The next phase will be field testing results. As the global agricultural system becomes increasingly connected, I believe that this model could be elevated to a global scale to increase the efficiency of fields around the world.

The Food and Agriculture Organization of the United Nations (FAO) reported that in 2020, 700 to 800 million people around the world faced hunger. Of this number, around 418 million live in Asia, 282 million live in Africa, and 60 million live in Latin America [1].

To feed the world, we need to increase global crop production. However, current agriculture is affecting the health of our soil, in many cases harming the overall environment and decreasing future crop yields [2]. Soil erosion occurs when soil does not have plant cover and is exposed to rain, surface runoff, or wind. When the healthy topsoil is eroded, the less healthy soil beneath is used to grow crops, decreasing crop yields [3]. Soil takes time to become productive, and current agriculture has increased the rate of soil erosion beyond the average soil production per year [3]. Extensive land use has led to the desertification of many lands which threatens crop production around the world [2].

When the health of the soil is low, it sequesters less carbon from the air, increasing the amount of greenhouse gases trapped on Earth, causing global warming [3]. As the temperature increases, sea levels will rise and more droughts will occur. According to the National Integrated Drought Information System, 89% of land in the western United States was affected by drought, and 25% of land in the western United States was affected by severe drought in July 2021 [4]. Droughts caused around 1.84 billion dollars in damages, a loss of around 10,000 seasonal jobs, and surface water shortages in California [5]. The WHO reports that globally, 50 million people are impacted by drought annually, 40% of the world population are affected by water scarcity, and up to 700 million people are at risk of being displaced from their homes by 2030 due to drought [6].

Another factor impacting crop production is the transmission of pests and pathogens. The connectivity between fields across the world is extremely high, allowing pests and pathogens to easily transmit from field to field [7]. The four major crops in the United States, soybean, maize, wheat, and cotton, are extremely connected and all have limited genetic diversity [7]. Each of these crops has developed the same resistances and is extremely vulnerable to diseases and pests they have not developed resistances to. These pests and pathogens then destroy and eat up crops, decreasing crop yields [7], [8]. The FAO estimates that around 40% of crops are lost to pests and pathogens worldwide each year, making this a problem affecting not just the United States but also the rest of the world [9].

The quick development of quantum computing across the last decade has shown promising results towards the applications of the technology in drug development, finance, logistics, cryptography, and optimization. In 2019, Google achieved quantum supremacy, using their 54 qubit quantum computer, Sycamore, to solve a complex math problem in three minutes and 20 seconds. It was estimated that the problem would take a classical computer 10,000 years to solve [10]. One of the specialties of quantum computing is optimization. The Knapsack Problem (KP) is an example of the problems that quantum annealers can solve. In the KP problem, a combination of goods with a weight limitation must be put into a “knapsack” to maximize the value of the goods inside the knapsack while making sure that the knapsack can still hold the weight of the goods. A binary quadratic model (BQM) can be used to solve the KP. The MaxCut optimization problem is an example of the problems that quantum computers can solve [11]. The MaxCut problem involves partitioning a graph of vertices and weighted edges into two sets to yield the highest cut (i.e., maximize total weight of edges). The quantum approximate optimization algorithm (QAOA) is one of the algorithms that can solve the MaxCut problem [12]. Because the algorithm can be run on qubits with limited connectivity, it appears to be a major algorithm for near-term quantum computers [13]. It is used to solve an agriculture-based MaxCut problem in this paper.

Many agriculture problems like crop planning, annual crop planning, and geodesign optimization are non-deterministic polynomial-time hard (NP-Hard) [14], [15], [16]. Crop planning and annual crop planning involve the optimization of soil, irrigation, land, fertilizers and pesticides, weed management, and transportation where about 25% of agriculture products are wasted due to inefficiency [14]. Geodesign optimization aims to optimize land management practices in watersheds, maximize water quality, improve water cleanliness and increase food sustainability [16]. It is difficult for classical computers to solve NP-Hard problems like the ones mentioned but quantum computers provide a polynomial speed-up, allowing them to solve the problems faster than classical computers. As the complexity of the NP-Hard problem increases, the time required to solve NP-Hard problems on classical computers increases exponentially faster than on quantum computers.

In this paper, I explore how quantum computing can be used to improve and optimize agriculture by optimizing water and nutrient prescriptions, and by minimizing crop connectivity between fields.

I constructed and solved a two-input, nine-cell problem. A cell is a subdivision or section of a field. In the model, a quadratic equation was used to calculate crop yields based on water and nutrients applied [17]. There were four different prescriptions of water (4, 5, 6, or 7 units) and six different prescriptions of nutrients (5, 6, 7, 8, 9, or 10 units). This problem is based on the knapsack problem as water and nitrogen (goods) must be put into cells (a knapsack) to maximize the value of crop yields (goods). Each cell had different yield efficiencies. For example, compared to a field with 100% yield efficiency, a field with 60% yield efficiency would only produce 60% of the crops as the field with 100% yield efficiency. Yield efficiencies are needed to parallel how farms have certain areas that produce lower yields due to various reasons like being closer to roads or having less healthy soil [2]. Yield efficiencies for the two-input, nine-cell problem can be viewed in figure 1. Constraints were used to make the problem more realistic. Each cell was only allowed to contain one prescription of water and one prescription of nutrients. There was a maximum amount of nutrients and water that the total of all the cells was not allowed to exceed. Waterzones were created where each waterzone had to contain the same amount of water, emulating a sprinkler or irrigation system. When a prescription violated any of these constraints, a penalty value was added. This ensured that prescription values with high penalty values would not be selected.

**Figure 1. **Yield efficiencies for each cell of the two-input, nine-cell problem. 1.0*100 is the yield efficiency for cell 0, 0.7*100 for cell 1, etc.

I constructed and solved a three-input, four-cell problem. The problem was set up the same as the two-input, nine-cell problem. A third resource, phosphorus, was added into the quadratic equation which calculates yield. A separate maximum phosphorus constraint was added. Penalty values were slightly modified to make sure all constraints were satisfied. Yield efficiencies for the three-input, four-cell problem can be viewed in figure 2.

**Figure 2. **Yield efficiencies for each cell of the three-input, four-cell problem. 1.0*100 is the yield efficiency for cell 0, 0.7*100 for cell 1, etc.

In both problems, a binary quadratic model (BQM) was compiled. The BQM was run on both D-Wave’s simulated quantum annealer and the Leap Hybrid Sampler.

In the IBM Quantum Experience platform, a MaxCut optimization problem based on fields and landscape resistance to transmission values (LRT values) was run. LRT values are calculated using the formula in figure 11. The formula considers the length of edge ab, the length of the edge in both fields a and b, and the crop densities of both fields a and b. The higher the LRT value between two fields, the more resistance one field has to the transmission of pests and pathogens from the other [7].

**Figure 11. **Formula used to calculate LRT values.

On the graph, each vertex represents a field while the weights of the edges represent the LRT values. Six fields numbered 0 to 5, were graphed (figures 5 & 6). The goal of this MaxCut problem is to divide the fields into two groups so that each group’s LRT values are maximized. When the LRT values are maximized, it will be harder for the fields in each group to transmit pests and pathogens amongst the other fields of that group. These two groups should then be placed far away from each other so that pests and pathogens cannot be transmitted from one group to another. For example, one group could be to the west of the Appalachian Mountains, which are a natural barrier to pests and pathogens, while the other group could be to the east [7]. This way, it will be difficult for pests and pathogens to be transmitted amongst the fields of each group and from group to group.

**Figure 5. **edges and their respective weights.

**Figure 6. **Six field MaxCut graph.

This problem was solved using a parameterized Quantum Approximate Optimization Algorithm (QAOA). A quantum circuit for the algorithm was created for this parameterized QAOA using Qiskit in IBM’s Quantum Experience platform. In the parameterized circuit, the parameters, gamma, and beta are used to determine the rotation of each gate to get to the optimal quantum state in the QAOA circuit. To determine the most optimal values of gamma and beta, both a standard QAOA and a Conditional Value at Risk (CVaR) variation of QAOA were used [18]. While QAOA calculates the mean value of all cuts, the CVaR variation calculates the mean value for the cuts that yield the highest value. This is done because only the most optimal cut matters, and it helps speed up the optimization process and make it more accurate. In my code of the CVaR variation, the mean value of the top 20% of cuts was calculated and used. Energy landscape graphs were plotted for both the standard QAOA and the CVaR variation. Both were run on the QASM simulator from Qiskit Aer [19].

The 9 cell problem was first run on D-Wave’s simulated quantum annealer. It was also run on D-Wave’s Leap Hybrid Sampler. Each time the model was run, the results were slightly different but the total yield was similar amongst all runs. The amount of water and nutrients used are under their respective maximums. Each cell has only one prescription of water and nutrients. The cells in each waterzone all had the same amount of water (in figure 3, cells in zone A all had 6 units of water, and cells in zones B and C all had 5 units of water). A sample result from running on D-Wave’s Leap Hybrid Sampler can be viewed in figure 3.

**Figure 3. **Sample 9 cell results from D-Wave’s LeapHybridSampler.

The third nutrient problem was first run on D-Wave’s simulated quantum annealer. The problem was also run on D-Wave’s Leap Hybrid Sampler. Similar to the 9 cell problem, each time the third nutrient problem was run, slightly different results were returned. However, all of the results were similar. The amount of water, nutrients, and phosphorus used are under their respective maximums. Each cell has only one prescription of water, nutrients, and phosphorus. The cells in each waterzone all had the same amount of water (in figure 4, cells in zone A all had 5 units of water, and cells in zone B all had 7 units of water). Sample results from D-Wave’s Leap Hybrid Sampler can be viewed in figure 4.

**Figure 4. **Sample 3rd nutrient results from D-Wave’s Leap Hybrid Sampler.

I was able to determine the optimal cut to optimize the LRT values in each group for the set of edges and weights in figure 5. The optimal cut was determined to be a value of 587 using the cuts 010011 or 101100. These two cuts are equivalent. They can be seen in the rightmost yellow bars in figure 7. This means that for the optimal LRT values, fields 0, 2, and 3 should be placed in one group while fields 1, 4, and 5 should be placed in another group. These two groups should maintain their LRT values and be placed far away from each other so that pests and pathogens cannot be transmitted from one group to another.

**Figure 7. **Bar graph displaying which cut maximizes LRT values.

The circuit created for QAOA can be viewed in figure 8. This circuit is the same for both standard QAOA and the CVaR variation of QAOA. This circuit was created using a series of Hadamard (H), Pauli Z Gate (RZ), RZZ, and Pauli X Gate (RX) gates. The rotation of each gate depends on the values of the parameters, gamma, and beta.

**Figure 8. **QAOA circuit.

It was found that the optimal parameters for beta and gamma for the standard QAOA were 0.5129 and 1.7952 respectively, while the optimal parameters for the CVaR variation were 0.8976 and 1.7952. Energy landscape graphs for both were created (figures 9 & 10). The energy value of the CVaR variation is higher than the energy value of the standard QAOA so the gamma and beta values from the CVaR variation should be used in the QAOA circuit.

**Figure 9. **Energy landscape of the standard QAOA circuit.

**Figure 10. **Energy landscape of the CVaR variation of the QAOA circuit.

The results show that quantum annealers are in theory effective at optimizing water and nutrients when given an equation and discrete parameters. This opens up the possibility to use quantum annealers to solve complex agriculture problems that classical computers cannot. In this case, quantum annealers can provide agromanagement prescriptions for optimal crop yields. Future research could include scaling up the complexity of the problem through increasing the number of cells, increasing the number of nutrients, or increasing the number of prescriptions of water and nutrients.

One limitation of the current research is the prescriptions of water and nutrients. Currently, each can only be a discrete value and cannot be an arbitrary value between two endpoints. This limits the optimization because unspecified prescriptions of water and nutrients are not considered during the optimization process. One method to solve this limitation is to offer more exact water and nutrient prescriptions to be considered during the optimization process. For example, instead of only considering water prescriptions of 4, 5, or 6 units, the algorithm could consider water prescriptions of 4, 4.25, 4.5, 4.75, 5, etc.

Another limitation of the current research is that it does not consider the health of the soil of each cell. Soil health is a major factor of plant growth, and the healthier the soil, the more efficiently a crop will grow. The health of soil is determined by many factors including pH, color, microorganisms, water retention, and levels of the 17 essential nutrients (carbon, hydrogen, oxygen, nitrogen, phosphorus, potassium, calcium, magnesium, sulfur, iron, manganese, zinc, copper, boron, molybdenum, chlorine, and nickel) [2]. The model used for both the 9-cell problem and the 3-nutrient problem does not consider soil health when calculating crop yield. One solution to this limitation is incorporating soil health more directly into the yield efficiency values.

The results show that quantum computing is in theory effective at maximizing LRT values within a group, minimizing pest and pathogen spread. Some of the problems that quantum computers can solve, like MaxCut, can be applied to agricultural problems. Future research includes the application of other agricultural problems using MaxCut, the investigation of how to maintain LRT values amongst fields, and the optimization of other connectivity methods.

One limitation of the current research is that it may be difficult to maintain LRT values between each field. When the fields are shifted into two groups, fields will move around, and as a result, LRT values will change.

Another limitation of the current research is that the groups are not resistant to outlier LRT values. If one LRT value of two fields is extremely high, cuts involving that LRT value would be significantly higher than other cuts while the group as a whole may not be very resistant to pests and pathogens. One solution is to make sure there are no outlier LRT values within the MaxCut graph before running the QAOA algorithm on the MaxCut graph.

A third limitation of the current research is that groups of many fields cannot be optimized using quantum computers. Quantum computers have a limited amount of qubits, and each of these qubits corresponds to a field. When there are too many fields, there will not be enough interconnected qubits to run QAOA. One way to work around this technological limitation is to use simulated quantum computers that can emulate the behavior of quantum computers while being able to simulate more qubits than current quantum computers have.

This paper investigates the usage of quantum computers and quantum annealers in agriculture. The results show that quantum annealers can be used to optimize agromanagement prescriptions of water and nutrients while quantum gate computers can solve other agricultural problems, once they are translated to the type of problem solvable by the current generation of quantum hardware. This is one of the first studies applying quantum computing to agriculture. Future research in optimizing water and nutrient prescriptions could consider more parameters, make water and nutrient prescriptions more continuous even though the algorithm cannot output a value when given a range of two numbers, or increase the number of cells in the problem. These methods would increase the complexity of the problem. Future research in optimizing field placement to decrease pest and pathogen spread could investigate the applications of quantum computing in other agricultural optimization problems, use data to calculate LRT values, and optimize certain values in the LRT equation, like distance or crop density.

[1] FAO, IFAD, UNICEF, WFP and WHO. 2021. *
The State of Food Security and Nutrition in the
World 2021. Transforming food systems for food security, improved nutrition and
affordable healthy diets for all.
* Rome, FAO. Accessed August 21, 2021. [Online].
Available: http://www.fao.org/publications/sofi/2021/en/

[2] Parikh, S. J. & James, B. R. (2012) Soil: The Foundation of Agriculture. *
Nature Education
Knowledge
* 3(10):2

[3] Ontl, T. A. & Schulte, L. A. (2012) Soil Carbon Storage. Nature Education Knowledge 3(10):35

[4] NOAA/NIDIS, “Western Drought Status Update: July 15, 2021,” National Integrated Drought Information System, United States of America, July 15, 2021. Accessed September 3, 2021. [Online] Available: https://www.drought.gov/documents/western-drought-status-update-july-15-2021

[5] Richard E. Howitt, Duncan MacEwan, Josué Medellín-Azuara, Jay R. Lund, Daniel A. Sumner (2015). “Economic Analysis of the 2015 Drought for California Agriculture”. Center for Watershed Sciences, University of California – Davis, Davis, CA, 16 pp

[6] “Drought,” World Health Organization. Accessed August 31. [Online] Available: https://www.who.int/health-topics/drought#tab=tab_1

[7] Margaret L. Margosian, Karen A. Garrett, J. M. Shawn Hutchinson, Kimberly A. With,
Connectivity of the American Agricultural Landscape: Assessing the National Risk of Crop Pest and Disease Spread, *BioScience,* Volume 59, Issue 2, February 2009, Pages 141–151.
https://doi.org/10.1525/bio.2009.59.2.7

[8] Fu, YB. Understanding crop genetic diversity under modern plant breeding. *
Theor Appl
Genet
* 128, 2131–2142 (2015). https://doi.org/10.1007/s00122-015-2585-y

[9] “Protecting Plants, Protecting Life,” Food and Agriculture Organization of the United Nations (FAO). Accessed September 4, 2021. [Online] Available: http://www.fao.org/plant-health-2020/about/en/

[10] E. Gibney, “Hello Quantum World! Google Publishes Landmark Quantum Supremacy
Claim,” *Nature News,* 23-Oct-2019. Accessed September 6, 2021. [Online]. Available: https://www.nature.com/articles/d41586-019-03213-z.

[11] “Solving Combinatorial Optimization problems Using QAOA” in “Qiskit Textbook,” IBM, 2021, chapter 4, section 1.3. Accessed July 20, 2021. [Online]. Available: https://qiskit.org/textbook/ch-applications/qaoa.html

[12] E. Farhi, J. Goldstone, and S. Gutmann, “A Quantum Approximate Optimization Algorithm,” (2014), arXiv:1411.4028.

[13] G. Crooks, “Performance of the Quantum Approximate Optimization Algorithm on the Maximum Cut Problem” (2018). arXiv:1811.08419

[14] S. Saranya and T. Amudha, "Crop planning optimization research — A detailed investigation," 2016 IEEE International Conference on Advances in Computer Applications (ICACA), 2016, pp. 202-208, doi: 10.1109/ICACA.2016.7887951.

[15] Sivashan Chetty, Aderemi Oluyinka Adewumi, "Three New Stochastic Local Search
Metaheuristics for the Annual Crop Planning Problem Based on a New Irrigation
Scheme", *Journal of Applied Mathematics,* vol. 2013, Article ID 158538, 14 pages, 2013. https://doi.org/10.1155/2013/158538

[16] Xie, Y., Yang, K. S., Shekhar, S., Dalzell, B. J., & Mulla, D. J. (2017). Spatially constrained
geodesign optimization (GOP) for improving agricultural watershed sustainability. In
*
WS-17-01: Artificial Intelligence and Operations Research for Social Good; WS-17-02:
Artificial Intelligence, Ethics, and Society; WS-17-03: Artificial Intelligence for
Connected and Automated Vehicles; WS-17-04: Artificial Intelligence for Cyber Security;
WS-17-05: Artificial Intelligence for Smart Grids and Buildings; WS-17-06: Computer
Poker and Imperfect Information Games; WS-17-07: Crowdsourcing, Deep Learning and
Artificial Intelligence Agents; WS-17-08: Distributed Machine Learning; WS-17-09:
Joint Workshop on Health Intelligence; WS-17-10: Human-Aware Artificial Intelligence;
WS-17-11: Human-Machine Collaborative Learning; WS-17-12: Knowledge-Based
Techniques for Problem Solving and Reasoning; WS-17-13: Plan, Activity, and Intent
Recognition; WS-17-14: Symbolic Inference and Optimization; WS-17-15: What's Next
for AI in Games?
* (pp. 57-63). (AAAI Workshop - Technical Report; Vol. WS-17-01 -
WS-17-15). AI Access Foundation.

[17] Liu, X., Li, M., Guo, P., & Zhang, Z. (2019). Optimization of water and fertilizer coupling
system based on rice grain quality. *Agricultural Water Management*, 221, 34-46.

[18] P. Barkoutsos, G. Nannicini, A. Robert, I. Tavernelli and S. Woerner, "Improving Variational Quantum Optimization using CVaR", Quantum, vol. 4, p. 256, 2020. Available: https://quantum-journal.org/papers/q-2020-04-20-256/. [Accessed 18 September 2021].

[19] Wang, R. “QAOA Field optimizer,” (2021), Github Repository. Accessed 2021. [Online] Available: https://github.com/2RichardWang/QAOA-Field-Optimizer

[20] https://docs.microsoft.com/en-us/azure/quantum/overview-quantum-computers-and-simulators