*Article* **A Smart and Mechanized Agricultural Application: From Cultivation to Harvest**

**Farzad Kiani 1,†, Giovanni Randazzo 2, Ilkay Yelmen 3,\*, Amir Seyyedabbasi 1, Sajjad Nematzadeh 4, Fateme Aysin Anka 5,‡, Fahri Erenel 5, Metin Zontul 6, Stefania Lanza <sup>7</sup> and Anselme Muzirafuti 2,\***


**Abstract:** Food needs are increasing day by day, and traditional agricultural methods are not responding efficiently. Moreover, considering other important global challenges such as energy sufficiency and migration crises, the need for sustainable agriculture has become essential. For this, an integrated smart and mechanism-application-based model is proposed in this study. This model consists of three stages. In the first phase (cultivation), the proposed model tried to plant crops in the most optimized way by using an automized algorithmic approach (Sand Cat Swarm Optimization algorithm). In the second stage (control and monitoring), the growing processes of the planted crops was tracked and monitored using Internet of Things (IoT) devices. In the third phase (harvesting), a new method (Reverse Ant Colony Optimization), inspired by the ACO algorithm, was proposed for harvesting by autonomous robots. In the proposed model, the most optimal path was analyzed. This model includes maximum profit, maximum quality, efficient use of resources such as human labor and water, the accurate location for planting each crop, the optimal path for autonomous robots, finding the best time to harvest, and consuming the least power. According to the results, the proposed model performs well compared to many well-known methods in the literature.

**Keywords:** autonomous robots; remote sensing; smart agriculture; climate change; environmental protection; drone; metaheuristic; Internet of Things

#### **1. Introduction**

Population growth in the world naturally causes an increase in food needs, and with the prediction that the world population will reach nine billion people by 2050, agricultural production should be increased by 70% [1]. Therefore, growing crops becomes very important. However, agricultural practices using traditional methods to meet people's food consumption needs can have quite inefficient results. Therefore, it becomes essential to manage agricultural activities using different advanced methods. Additionally, environmental protection and sustainability have also become basic needs [2]. In this regard, smart

**Citation:** Kiani, F.; Randazzo, G.; Yelmen, I.; Seyyedabbasi, A.; Nematzadeh, S.; Anka, F.A.; Erenel, F.; Zontul, M.; Lanza, S.; Muzirafuti, A. A Smart and Mechanized Agricultural Application: From Cultivation to Harvest. *Appl. Sci.* **2022**, *12*, 6021. https://doi.org/ 10.3390/app12126021

Academic Editor: José Miguel Molina Martínez

Received: 19 May 2022 Accepted: 11 June 2022 Published: 14 June 2022

**Publisher's Note:** MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

**Copyright:** © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/).

farming mechanisms using new technologies have become very popular [3]. It should not be forgotten that not only modern agriculture methods but also sustainable solutions should be proposed. With the creation of efficient solutions to meet identified needs, it may be possible to provide the next generation with a lifestyle at least equal to that of the current generation [4] and to use existing natural resources efficiently in this direction. Otherwise, we may face not only the problem of hunger but also challenges such as energy and migration crises. In summary, problems such as global climate change, increasing conflicts around the world, migration crises, improper use of existing agricultural lands, decrease in precipitation levels, and incorrect use of water all have made the use of modern agriculture systems mandatory.

Technologies such as remote sensing, the Internet of Things (IoT), intelligent agents, autonomous robots, unmanned aerial vehicles (UAVs) [5], Internet of Vehicles (IoVs), wireless ad-hoc networks, big data analytics, and deep learning (DL) have shed light on promising visions for a breakthrough in agricultural applications [6–9]. Smart farming can be applied to improve crop quality and profit and reduce costs by optimizing various processes such as environmental conditions, growth status, soil status, irrigation water, pest control, fertilizers, weed management, and greenhouse production environments [10]. For example, questions such as which product should be planted in a given region, how efficient the use of water resources should be, and accurate estimation of the harvest time all can be answered and monitored in smart agriculture. Thus, smart agriculture ensures green technology by eliminating the inefficient and faulty methods of traditional agriculture, and it can also further reduce problems such as leakage and emissions and their impact of climate change [11].

Since the role of smart systems in sustainable agriculture is increasing day by day, many technological methods have been used and recommended in recent years. Smart farming optimizes complex farming systems by applying new and modern technologies in agriculture. It aims to produce and collect more quality crops with less investment, irrigation, and human labor. In general, plant growth and harvest processes are critical issues in smart farming. Therefore, intelligent mechanism models will be very useful in solving identified problems and achieving specified goals. However, an approach that covers the whole process, not a single or specific goal(s), is important. In this regard, in this study an application model is proposed that covers this process from cultivation to harvesting. This model can be used to grow a variety of crops on any farmland. For this, software and hardware approaches are used together, making it possible to use them in the real world. Previous studies have been focused on certain perspectives and/or reaching a limited number of goals.

The main aim of this study is to be able to solve the problems with green and sustainable agricultural practices from the field to the table, and to ensure that people can access agricultural products, which are their basic needs, without interruption. In addition, it is aimed at reducing product losses, preventing waste, increasing productivity, and even reducing to zero waste due to faulty planting and similar causes at every stage of the food chain. Part of these efforts should be the aim of ensuring the full physical, mental, and social well-being of agricultural workers, by minimizing recently increasing work accidents and occupational diseases of those working in the agricultural sector with preventive and protective measures. All these concerns can be resolved in a sustainable way by providing a single mechanism system from planting to harvesting.

This study focuses on tracking and harvesting crops on large-scale farmlands in three stages. In the first phase (*cultivation*), planting the crops in the most optimized way is sought by using an algorithmic approach (Swarm Sand Cat Optimization (SCSO) algorithm) during the planting phase. In this way, the location of the crops that need to be planted (without the need for human or manual intervention) is determined in accordance with the specific requirements of any crops. An optimization approach can be a good solution since it is a nondeterministic polynomial-time hardness (NP-Hard) problem to meet this need with analytical and similar solutions. The SCSO algorithm could be a successful solution in

determining the correct places of the products in accordance with its working mechanism. In this way, optimized results can be obtained without human intervention, with the lowest error rate and lower operation cost.

In the second stage (*control and monitoring*), the growing processes of the planted crops are tracked and monitored thanks to IoT devices. With the IoT devices, the status of the planted products is constantly checked, and the results are transferred to the next stage as an input for instant processing. The third phase (*harvesting*) is the product collection stage. At this stage, a metaheuristic method (Reverse Ant Colony Optimization) is proposed. The results from the third stage are presented as the optimum path for autonomous robots (IoVs) to harvest crops. In this third phase, a new fitness function is also defined. Since the second and third stages are carried out simultaneously, it is ensured that there will be a sustainable model. The Reverse ACO (RACO) is proposed as a new improvement to the ACO algorithm. Thanks to this algorithm, the results from the second stage can consistently and regularly provide the input for the third stage correctly. The performance of the proposed method was evaluated in different scenarios and situations and compared with similar studies in the literature. The following benefits were also obtained with the application developed in this study:


In Section 2 of this paper, the literature review is discussed. The proposed model and application are explained in Section 3. In Section 4, the simulation results are evaluated. The last section of the study includes the conclusions and possible further studies.

#### **2. Literature Review**

This study focuses on the most efficient crop-harvesting methods in farmlands (tomato assumed as a case study). In this regard, studies and general perspectives about the new generation of agriculture in the literature are presented. As is known, there are many types of sowing, monitoring, and harvesting in agriculture. Although traditional methods are successful in growing crops, they have many disadvantages.

In traditional agriculture, farmers cannot prepare the soil properly because they only use hoes after burning the bush and clearing the field. In addition, they cannot get fertile results as they can only scratch the earth and mix the ashes into the soil [12]. The burning method damages the soil, and as a result, erosion is exacerbated as this burnt soil is left bare. Furthermore, roots cannot go deep enough to absorb water and mineral salts from the soil, and thus water (the most important and critical resource) is used inefficiently. The soil can become very poor in a short time due to the usual techniques applied incorrectly and inefficiently, and to solve this problem (i.e., the soil becomes fertile again), the field must be left fallow for two or three years [13]. Since the farmers cannot stay idle during this period, they move to another field, which is called alternating cultivation. As a result, large-scale lands will not be used, and bountiful crops will not be produced. Mechanism systems blended with new technologies can be the solution to these problems. On the other hand, it is also very important to harvest the crops efficiently, on time, with the maximum amount and quality and least use of energy and resources. However, traditional methods consume resources excessively, the rate of poorer-quality crops is higher, the profit rates are not fully maximized, and most importantly, they cannot offer sustainability [14]. These problems can be resolved with the transition to modern agriculture. In this regard, the IoT and mobile robots provide great contributions. In the solution to these complex situations, software techniques and methods are needed together with new technologies. According to this, artificial-intelligence-based smart methods are becoming more important day by day. In solving this type of complex problem, learning or heuristic-based solutions may be especially useful—we should not forget that some problems in this area may not have a deterministic solution. Finally, taking into account increasing human population and food demand, these problems will have dire consequences. For the reasons stated, we can conclude that intelligent agriculture is an essential requirement.

The IoT and similar technologies such as wireless sensor networks (WSNs) [15], which have become popular in recent years, are used to meet the needs in this field. The IoT in agriculture means using sensors and other devices to turn every element and action involved in farming into data [16]. Scientists believe that the IoT will lead the agriculture sector to agriculture 4.0 and even agriculture 5.0 in the future [17,18]. This new philosophy, data-driven agriculture, is also expressed in the literature with several different names: Agriculture 4.0, digital farming, or smart farming [19]. This smart farming can be combined with the precision agriculture concept in data management, leading to more accurate and efficient results [20]. In traditional methods, farmers had to go to the farmland and check the condition of their crops, and they would decide based on their experience whether it was time to harvest. New technologies such as the IoT are very useful in solving these problems, and more, to achieve greater efficiency, sustainability, and availability rates. Additionally, in traditional methods, the experienced farmer had a higher success rate, so younger farmers had a lower chance at succeeding. However, thanks to these new technologies, this problem can now be eliminated. On the other hand, savvy farmers can also adapt to new methods. IoT technologies are predicted to play a major role in the generation of large amounts of valuable information in all types of agriculture and the advancement of this sector [21]. In addition, the IoT is thought to be a potential solution to increasing agricultural productivity by 70% by 2050 [22]. In [23], the authors designed an IoT-based system to monitor air and soil parameters and develop mobile and web-based applications. They tried to monitor crop and yield forecasts in real time. In [24], the authors focused on farm management information systems to automate data acquisition and processing, monitoring, planning, decision-making, documenting, and managing farm operations. For this, they proposed architecture and implemented it in two different regions in Turkey. In another proposed example to monitor various components of the farmland with an IoT-based mechanism, an agro-meteorological system was developed using an Arduino [25]. Another study based on sensors, IoT, ZigBee, and Arduino focused on rural agriculture [26]. The authors tried to guide farmers in estimating crop suitability and other relevant factors by using various types of sensors. Another study explored how accurate analysis of agro-meteorological and weather parameters can help farmers improve crop production [27]. However, their proposed system is not portable, and may only be suitable for small-scale farms. Other IoT-based studies in modern agriculture in recent years have also been explored in [28–30].

Along with the IoT, the widespread use of autonomous robots such as UAVs increases productivity in agriculture. Recently, studies related to this subject have accelerated [31–35]. One of several studies in the literature is presented in [36]. The authors used UAVs to detect possible drainage pipes. Often, farmers need to repair or construct drain lines to efficiently remove water from the soil. Therefore, in this study, they wanted to decrease resource consumption and increase productivity in agriculture by focusing on this issue. In [37], the authors offered a combined application of UAVs and unmanned ground vehicles (UGVs) to

monitor and manage crops. The authors proposed a system that can periodically monitor the condition of crops, capture multiple images of them, and determine the state of the crops. In addition to many UAV-based studies and products, recently the concepts of the IoT and autonomous robots have begun to be presented together. In this way, the data detected by the UAVs reaches the place where it needs to be sent instantly, the necessary actions can be taken on this data, and it can quickly provide a decision mechanism to the farmer or other technological devices. For example, in [33], the authors present a farmmonitoring system using UAV, IoT, and Long-Range Wide Area Network (LoRAWAN) technologies for efficient resource management and data delivery. In this study, they were monitoring water quality.

In general, most of the studies were aimed at increasing efficiency in the field with technological approaches. It is also very important to efficiently analyze and evaluate the data generated from new technologies such as IoT and UAV using recent technologies such as WebGIS [38]. At the same time, we may sometimes encounter complex situations for a service expected to be provided in smart agriculture. These problems become more difficult to solve as the dimension and number of uncertain parameters increase. Metaheuristic algorithms can be an appropriate mechanism for solving similar problems. Indeed, in recent years in the literature, metaheuristic-based approaches have been proposed for different purposes related to agriculture [39]. For example, in [40], three local search metaheuristic algorithms, which were simulated by annealing and Tabu search references, were used to calculate annual crop planning with a new irrigation mechanism. The objective function of this study was to maximize the gross benefits associated with the allocation of crops. The authors claim that the Tabu search method gave the best results in comparisons. In [41], an evolutionary algorithm was used for a complex strategic land-use problem based on the management of a farming system. This study pursued a multi-purpose strategy that fulfilled spatial constraints in the 50-year planning management of the farm. Although the study is comprehensive, the metaheuristic method used and proposed may not be a very high-performing and efficient solution. In [42], a bi-objective optimization model was proposed that minimizes cost and maximizes geographic diversity. In the test of the proposed method, a case was considered that showed new types of relationships in the food logistics chain. Although the proposed mechanism is interesting, the number of parameters it deals with is not complex enough. In [43], the authors introduced a smart-engine-based decision system focusing on the type of crop, time/month of harvest, type of plant required for the crop, type of harvest, and authorized rental budget. According to the results from this system, the best way to rent and share agricultural equipment was provided. The other metaheuristic-based method focused on economic crop planning at the tactical level or agricultural policy planning at the national level [44]. The supposed crop products could be for home consumption, export (cash crops), or to feed milk cows. The proposed method focused on optimal farm reconstructions that met four objectives (maximize profit and balance of soil structure, and minimize the soil nitrogen and human labor), and a set of stringent constraints. In [45], the authors tried to optimize the deployment of their sensor nodes to best monitor potato and wheat crops. In this regard, they proposed a Genetic Algorithm-based method. Other studies based on metaheuristic algorithms have been presented in the literature in the last few years [46–48].

In summary, many studies have been carried out in the field of smart and sustainable agriculture, which has become a trend in recent years. Some of these studies, along with their characteristics, are summarized in Table 1. This paper focuses on optimal solutions from cultivation to harvesting benefiting from the IoT, autonomous robots, and a metaheuristic approach in three stages.


**Table 1.** Characterization of current studies in the literature.

#### **3. Materials and Methods**

In this study, the technological and algorithmic aspects of sustainable agriculture are discussed. Towards this end, an intelligent and mechanized agricultural application is proposed which includes three phases: (1) cultivation, (2) control and monitoring, (3) harvesting. These stages affect each other like a lifecycle. The results from the first stage are used in the second stage, and the results from the second phase are constantly used as the input of the third stage. The working mechanism of the proposed method is described in Figure 1 with all its phases.

#### *3.1. Cultivation Phase*

As stated before, with the increase in the world population, the need for agricultural and food products is also increasing. Therefore, the importance of smart farming systems and methods has increased. In this context, the first step in the mechanism and a sustainable model is the planting (cultivation) phase. Here, it is very important to place each product in the correct location in order to minimize or remove manpower and manual interventions. The metaheuristic approach is useful because the solution to this problem is a type of NP-Hard problem to be solved systematically. Therefore, the SCSO algorithm was used in the first phase of this study. Due to its nature, this algorithm can provide good performance both locally and globally, as its transitions are balanced in the exploration and exploitation phases, and therefore this new algorithm was used to solve the first problem case in this study.

**Figure 1.** General scheme of all operations of the proposed model.

#### 3.1.1. SCSO Algorithm

The Sand Cat Herding Optimization (SCSO) algorithm is inspired by the sand cat's foraging and hunting behavior [50]. In this algorithm, a low-frequency noise detection behavior mechanism is used to find the prey of sand cats. Since these cats can detect low frequencies below 2 kHz, they can find even the furthest prey in the shortest possible time and with very little movement. These cats also have an incredible ability to dig for prey. This algorithm has a successful performance in searching and hunting using these two great features. With an adaptive mechanism, SCSO can be good at solving many problems, as they are balanced in the exploration and exploitation phases. In addition to these features, this algorithm is preferred specifically for this problem, since it uses few parameters and is a simple implementation. The mathematical equations of this algorithm are given below (Equations (1)–(5)):

$$\stackrel{\rightarrow}{r\_G} = s\_M - \left(\frac{2 \times S\_M \times iter\_c}{iter\_{Max} + iter\_{max}}\right) \tag{1}$$

$$
\stackrel{\rightarrow}{R} = 2 \times \stackrel{\rightarrow}{r\_G} \times rand \ (0, 1) - \stackrel{\rightarrow}{r\_G} \tag{2}
$$

$$
\overrightarrow{r'} = \overrightarrow{r\_G} \times rand(0, 1) \tag{3}
$$

where '*rG*' is a constant inspired by the listening ability of sand cats. It will linearly decrease from two to zero as the iterations progress to approach the prey (solution) it is looking for and not to lose or pass it (not to move away). The "*SM*" value is inspired by the hearing characteristics of the sand cats, its value is assumed to be 2. The '*r*' demonstrates sensitivity range of each cat. The '*r*' is used for operations in exploration or exploitation phases while '*rG*' guides the '*R*' parameter for transition control in these phases. '*R*' is the main parameter

in controlling the transition between exploration and exploitation phases. If '*R*' is lower than one, the sand cats are directed to attack their prey, otherwise, the cats are tasked with finding a new possible solution in the global area. The *'iterc*' is the current iteration and '*itermax*' indicates the maximum iterations. The '*t*' is the current time.

$$\stackrel{\rightarrow}{X}(t+1) = \begin{cases} \stackrel{\rightarrow}{Pos\_b(t)} - \stackrel{\rightarrow}{Pos\_{rnd}} \cdot \stackrel{\rightarrow}{\cos(\theta)} \stackrel{\rightarrow}{r} \\ \stackrel{\rightarrow}{r} \cdot \left( \stackrel{\rightarrow}{Pos\_{bc}(t)} - \stackrel{\rightarrow}{r} \text{rand}(0,1) \cdot \stackrel{\rightarrow}{Pos\_c(t)} \right) \end{cases} \begin{array}{ll} |\mathbb{R}| \le 1 ; \text{exploration } (a) \\ |\mathbb{R}| > 1 ; \text{exploration } (b) \end{array} \tag{4}$$

Equation (4) is proposed to determine the next move of each cat. The '*Posb*' indicates the best position and '*Posc*' represents the current position. The '*Posrnd*' indicates the random position and ensures that the cats involved can be close to prey. '*Posrnd*' is obtained from Equation (5). In addition, SCSO also performs well in convergence behavior. The pseudocode of the relevant algorithm is shown in Algorithm 1.

$$\stackrel{\rightarrow}{Pos\_{rnd}} = \left| rand(0, 1) \stackrel{\rightarrow}{Pos\_b}(t) - \stackrel{\rightarrow}{Pos\_c(t)} \right| \tag{5}$$

**Algorithm 1.** Sand cat swarm optimization algorithm pseudocode.

```
Initialize the population
Calculate the fitness function based on the objective function
Initialize the r, rG, R
While (t <= maximum iteration)
    For each search agent
      Get a random angle based on the Roulette Wheel Selection (0◦ ≤ θ ≤ 360◦)
      If (abs® <= 1)
           Update the search agent position; Equation (4a)
      Else
           Update the search agent position; Equation (4b)
      End
    End
  t = t++
End
```
#### 3.1.2. Planting Crops Based on SCSO Algorithm

The SCSO is used for economical product planning and efficient resource consumption. Hereby, crops can be planted in the most optimized places in a mechanized way without human intervention during the cultivation (planting) phase. In this regard, the SCSO algorithm is used instead of an analytical solution to plant each crop with an optimized method. As mentioned earlier, since this action is an NP-Hard problem type, metaheuristicbased approaches can lead to fruitful results. In addition, restrictions and requirements were taken into account so that it can be applied in real farmlands. These criteria are, for example, biodiversity indices based on landscape ecology measures, diversity of land uses, and soil erosion. The criteria to be optimized here will mostly have a positive effect on the farmer's income from the harvest and the type and amount of employment. In addition, efficient land use will lead to optimum allocation of water resources. An optimized planting stage will also be useful for an autonomous robot to accurately position itself in crop fields to perform precision farming tasks effectively.

In this study, tomato (*Lycopersicon esculentum* Mill.) is taken as a case study. In this arrangement, the row spacing can be selected as 80 cm, and the seedling spacing as 40 cm ((3.1 m2/unit)), 60 cm (2.1 m2/unit), and 80 cm (1 m2/unit) in tomato planting. It is recommended to choose 40 cm seedling spacing for pollination, temperature preservation, and to grow more product [51,52]. In addition, it is recommended that the soil's pH level be 6.0–6.5 when planting tomato seeds [53]. Single-row arrangement and the hanging method are preferred in tomato cultivation [51,52]. In line with the reasons and objectives mentioned

above, the places of the products relative to each other are determined algorithmically, considering the distance and other requirements. Here, the process will be the planting of the products with the least error rate. The crops planted at the end of this phase were equipped with IoT devices in the next phase. The places where the products should be placed was given to the autonomous robots as a map with this algorithm. They would perform the mechanized planting work (saving manpower and other natural resources). This was the first mission of the autonomous robots. Their second and final task was in collecting (harvesting) items.

#### *3.2. Control and Monitoring Phase*

The second phase plans the timely determination of whether the planted crops are grown, their water and similar needs, and the realization of other purposes. At this stage, it is expected that the products will be monitored to increase productivity. This process can be a very costly and error-prone structure when performed by the farmer. However, being able to manage this whole process with technological solutions, and, in this context, offering farmers a user-friendly integrated application increases efficiency in every aspect.

In this phase, IoT devices were used to easily track each product and obtain query or in-demand-based data flow. The features of these devices may vary according to the purpose and expectations in the field. In this study, the tomato case study is focused on as an example. Tomatoes have commercial importance as one of the most-grown vegetables in the world [51]. Today, tomatoes are grown in open fields and greenhouses. The method of growing tomatoes in the open field is considered one of the traditional methods and we did not consider it. The growing period of tomatoes may be different depending on the parameters of light, water, minerals, and temperature [53]. In greenhouses, parameters such as temperature, humidity, amount of light, amount of CO2, and amount of water can be controlled more easily, and therefore tomato cultivation in a greenhouse can be preferred [52,54].

For this purpose, KIANI-WSN kit nodes were used as IoT nodes [55] as shown in Figure 2. These nodes consist of sensing, communication, processing, and power units. Since the communication unit is equipped with a Wi-Fi card, it also fully meets the need for an IoT. These nodes are generally of two types. One of them is the CC1101 transmitter chip and the other is the nodes equipped with both CC1101 and CC1190 chips. The first node types were used in this study. The CC1101 is a low-cost sub-1GHz transceiver that can be used in very-low-power wireless-based applications [56]. It also supports packet processing, data buffering, burst transmissions, clear channel evaluation, link quality indication, and wake-on-radio. The CC1101's main operating parameters and 64-byte send/receive FIFOs can be controlled via the serial peripheral interface (SPI). These nodes are equipped with sensors such as humidity, temperature, and light. The ad-hoc feature of this device provided another advantage because it could transfer the required data to our system even when there was no internet. Thanks to this system, productivity in harvesting increased and resources such as water and manpower were used efficiently.

**Figure 2.** The device used as an IoT node in the field [5,55].

#### *3.3. Harvesting Phase*

The purpose of this phase is to come up with a road map for each autonomous robot. At this stage, the SCSO and similar algorithms may be not very successful in their rationality, as it is our goal to generate paths and find a good route. Therefore, a new method was proposed by utilizing the one of the best metaheuristic algorithms (ACO) for this concept. Based on this path, each robot will begin its task of picking (harvesting) crops in the most efficient manner. In other words, with this route, each robot collects the crops efficiently, making the most profit. Moreover, this goal is achieved in as short a time as possible and with the least power consumption. This new algorithm is proposed to achieve these three intermediate targets (*max-profit*, *min-energy*, *min-time*) together in a balanced way. In summary, the output (goal) of the harvest phase is finding the optimal path for each autonomous robot.

The ACO [57] algorithm is inspired by the real-life behavior of ants. Although ants are not insects that live in a swarm model, they help and guide each other by using chemical deposits called pheromones, and as a result, they act like a smart colony. In the classical ACO, each ant starts from a point, goes hunting, and returns to its home (start). That is, each ant starts eating from the nest and then returns to the nest. However, in RACO, each ant starts from a point and only tries to reach the prey, and the concept of returning to the nest is not in question in this algorithm. It is worth remembering that this algorithm is not a new ACO variant. This algorithm is inspired by the concept of ACO for solving just this problem and similar problems.

The second main difference between the proposed algorithm and ACO is based on the concept of pheromones. In the classic ACO, in each iteration each ant releases pheromones on each path it prefers, so the pheromone values of the chosen paths are constantly updated. Since the pheromone density is high in the most preferred route, the relevant route is chosen as the best route. Additionally, as the number of iterations increases, some pheromone evaporates from the amount present on each path. This prevents it from facing problems such as local optima. For this, a matrix is defined. However, the concept of pheromones is not fully similar in RACO, and instead, a similar matrix is defined, reflecting the increase in growth rates of the crops planted in each iteration. In addition, when each product is selected by the ant, it defines it as the product that has been collected, and the value of that product in the relevant matrix is decreased. In fact, the matrix defined in RACO shows the growth rates of crops. Items that are not collected increase in value as the iteration goes on (contrary to evaporation), and items that are collected are devalued (a very small number close to zero). In short:

(1) In classical ACO, pheromones evaporate as time progresses, in RACO the crops grow as time passes.

(2) In classical ACO, the pheromone ratio of the most preferred routes increases, in RACO, the product is collected and its value decreases in the current table of the product, while on the other hand, the value of the profit parameter increases.

Since this model is applied on a continuous field, the same process continues as the harvested crops begin to grow and mature again, and therefore the algorithm works smoothly. This presents a sustainable farming mechanism for all three phases described in our study. The main idea of this proposed algorithm is to model the problem as a search for the best path by constructing a path graph representing the states of the problem. Therefore, it can also be used to solve other problems similar to the product aggregation problem. In the classical ACO algorithm, the ants make the path selections according to Equation (6),

$$P\_{i,j}^k(t) = \frac{[\pi\_{i,j}(t)]^a [\![\![\!q\_{i,j}(t)]\!]^\beta}{\sum\_{k \ge 1 \, \text{lowed}\_k} [\pi\_{i,k}(t)]^a [\![\![\!q\_{i,k}(t)]\!]^\beta} } ; j \varepsilon all \,\text{lowed}\_k \tag{6}$$

where '*k*' represents the number of ants used in the algorithm. The '*i*' and '*j*' denote the source and destination station, respectively, which indicate the points of each autonomous robot. τ*i*,*<sup>j</sup>* is represented as a matrix and shows the instantaneous states of the crops. The ϕ*i*,*<sup>j</sup>* is the heuristic cost between the edges '*i*' and '*j*'. The '*α*' and '*β*' are related to the importance of trail and heuristic cost. In the proposed RACO, the related mathematical equations are defined as follows (Equations (7)–(12)), based on the problem in this study:

$$Profit^K \left( MaxProfit \right) = \sum\_{1}^{D} SelectedComp^K \tag{7}$$

*Power<sup>K</sup>* <sup>=</sup> (*BatteryCapacity* <sup>∗</sup> *DeliverCapacityPercentage*) <sup>−</sup> ∑*<sup>j</sup> i* (*distance* ∗ *BatteryConsumed*) (8)

$$Time^K(MinTime) = \sum\_{i}^{j} (distance \ast TimeConsumed) \tag{9}$$

where '*SelectedStatus*' shows the drop collected by each ant. The goal here is to get the most profit. '*BatteryCapacity*' indicates the maximum power capacity of the autonomous robots, generally related to *Ah* and *V*. '*DeliverCapacityPercentage*' represents the maximum amount of power each robot can use. The '*distance*' is the distance between two points in meters. '*BatteryConsumed*' is the amount of energy used between both points. In this study, battery capacity is assumed 8 *Wh* and the maximum battery usage rate is accepted as 90%. The amount of '*Power*' obtained here indicates the amount of energy that each robot will use, and this is desired to be minimum. It is worth mentioning that at the end of the algorithm, a route will be assigned for each of the robots. Since the concept of power is meaningful to them, autonomous robot is expressed here, but it actually means ant. The '*D*' represents the total number of crops in the field. The '*Time*' and '*TimeConsumed*' parameters represent the total time used by each ant and the elapsed time between both points, respectively.

$$\text{CostFunction}^{K} = \frac{\mathbb{C}\_{2} \ast Power^{K} + \mathbb{C}\_{3} \ast Time^{K}}{\mathbb{C}\_{1} \ast Profit^{K}};\\\mathbb{C}\_{1} + \mathbb{C}\_{2} + \mathbb{C}\_{3} = 1, \quad \mathbb{C}\_{1} > \mathbb{C}\_{2} \geq \mathbb{C}\_{3} \qquad \text{(10)}$$

$$BestCost = Min(CostFunction)\tag{11}$$

where *C*<sup>i</sup> are coefficients that can be adjusted according to the requirements of the problem. Optimal values for these constants can also be found by a metaheuristic method. In this study, the method in [58] is used to tune the values of these coefficients. Since these weights (coefficients) are not defined in the classical ACO, they are assumed to be of equal value. The relationship to *C*<sup>i</sup> may differ depending on the purpose of the problem. For example, *C*<sup>1</sup> should be bigger than the others if we want the minimum answer, and vice versa if we are looking for the maximum. This proves the flexibility of the relevant cost function. At

the end of each iteration, '*CostFunction*' is calculated for each ant and the minimum among them is accepted as the best solution.

$$
\Delta \pi\_{i,j} = \frac{\text{CropStattus} - \text{Seletted} \text{Crop}}{\sum\_{1}^{D} \text{Crops}} \tag{12}
$$

$$
\pi\_{i,j} = (1+\rho) \ast \pi\_{i,j} + \Delta \pi\_{i,j} \tag{13}
$$

where *ρ* is a coefficient that affects and controls the rate of the crops' status. *'CropStatus'* shows the latest status of each crop. '*Crops*' indicates the total number of crops in the field. The working mechanism of the proposed algorithm for finding the optimal path for each autonomous robot is shown in Figure 3. It is worth remembering that the starting and ending points of each ant do not have to be the same. At the end of each iteration the best solution is chosen. When the iterations are over, the best solution is given as a path to the relevant autonomous robot (IoV), and in this way each robot is assigned a task to collect crops in the real field. The pseudocode of the relevant algorithm is shown in Algorithm 2. When complex analysis of the algorithm is performed, it has proven to be O(n2), which means that it is successful compared to other classical and analytical solutions.

**Figure 3.** The working mechanism of the RACO.



#### **4. Results and Discussion**

This section presents the performance of the proposed model. The model results are analyzed and compared with the various methods. Comparison of the results is made in two scenarios. In the first, only the performances in the first phase (cultivation) are considered. Here, several algorithms that have been used have been successful in solving the refinement problem: Grey Wolf Optimization (GWO) [59,60], Moth-Flame Optimization (MFO) [61], and Particle Swarm Optimization (PSO) [62]. In the other scenario, comparisons were made to cover all phases. Since the second and third phases are integrated, it would not be correct to analyze these phases separately. The methods used for comparison are a variant of Firefly Algorithm (FA) [63], Genetic Algorithm (GA) [64], Cuckoo Search (CS) [65], and Glowworm Swarm Optimization (GSO) [66] algorithms. In addition, the MAP-ACO [67] algorithm, which is based on ACO, was also used for comparison. In summary, a comparison and analysis covering all phases was performed to preserve the integrity of the results. The implantation and analysis presentation were performed in MATLAB. The algorithms proposed in this study were performed on a Core i7-5500 U 2.4 processor with 16 GB of RAM.

#### *4.1. Simulation Setting*

In the simulation, each of the algorithms were simulated under similar conditions, with 15 independent runs consisting of 30 search agents and 200 iteration numbers. These independent runs were performed to manage the effects generated from random parameters in the methods used. The size of the environment was 100 m ∗ 100 m. the simulation parameters are presented in Table 2. Time is assumed to be discrete (*t* = 1, 2, ... ) and at each time step, every ant moves toward a neighbor node at a constant speed (m/s).


**Table 2.** The simulation parameters.

#### *4.2. Tomato Case Study*

In this study, the performance of the proposed algorithms was analyzed, assuming tomato as a case study. It is worth emphasizing that the method proposed in this study can also be used in different agricultural terrain. Table 3 presents an example of the growth cycle of tomatoes through to the harvest process. After the fruit is tough, the fruit ripens over 45–70 days, depending upon the cultivar, climate, and growth conditions. The fruit continues growing until the stage of green ripeness. The stages of the tomatoes ripening are categorized into three steps, as shown in Table 3. These stages are valid from the beginning to the end of the first harvest.


**Table 3.** A typical example of a tomato growth cycle [52,53].

In addition to the information above, also inspired by the information in [68,69], we try to propose a more realistic and accurate metaheuristic-based method by considering the tomato characteristics such as irrigation mechanism, growth pattern, and relations between seedling growth and the prevailing environment. In addition, we used all this information to impact the behavior of autonomous robots.

#### *4.3. Analysis and Evaluation (Scenario 1, Crop Cultivation)*

In this section, the performance of the proposed method at the planting stage of the crops is analyzed. Sowing, which is the first phase of smart and sustainable agriculture, has an important role. Here, the working mechanism and performance of each algorithm are presented in Table 4. The results of the proposed method at the planting stage are analyzed and also compared with other methods in the literature. Due to the nature of the problem type, the methods in the metaheuristic approach were used for comparison. The lower the error rate, the higher the performance of the relevant mechanism. In this study, the places where tomatoes should be planted were based on practical and analytical information (Table 3).

**Table 4.** The overall performance of each algorithm in the cultivation phase.


Note: The best values of algorithms are written in bold.

The least amount of Mean Square Error (MSE) belongs to the SCSO based method. Here, data is presented in meters. According to the results, the method that could complete the placement task with the least error rate was our method based on the SCSO algorithm. It has 5.02 × <sup>10</sup>−<sup>3</sup> error, which is the minimum error rate between the algorithms used. The MSE values gained from various metaheuristics go down, while the iterations increase. The MSE convergence of each method is presented in Figure 4. The SCSO outperforms the other metaheuristic approaches, and its MSE value is 5.02 × <sup>10</sup>−3. In other words, SCSO shows very good results when the MSE value is around 4.17 × 100 in the first iteration and converges at 5.02 × <sup>10</sup>−<sup>3</sup> in the final iteration. Among all the metaheuristic approaches, MFO has the worst performance, starting at 6.78 × 100 in the first iteration and converging at 2.56 × <sup>10</sup>−<sup>2</sup> in the final iteration.

**Figure 4.** The MSE convergence of each method.

#### *4.4. Analysis and Evaluation (Scenario 2)*

At this stage, the performance analysis of the proposed method focused on the expected goals after the harvesting phase, based on all stages. In this study, some of the most important parameters in smart and sustainable agriculture are assumed. One of them is the profit rate. It is preferable that the collected crops offer more profit. In our real world, not only the growth of the crops but also the logistics are important in the collection of agricultural products. Therefore, it is possible to collect the crops before they are fully grown. In addition, the collected products start to grow again as time progresses. These two issues have been taken into account in our performance analyses. The second parameter is the amount of power consumed by each autonomous robot. The third parameter is that the robots perform the product-picking tasks in as short a time as possible. These three parameters will lead us to the main goal. This aim will generate an efficient and optimum roadmap for each robot. According to this map, each robot will be assigned the task of collecting items. The path that provides the maximum profit and consumes the least energy in the shortest time is attempted to be selected by the algorithm.

Here a route for the robot is revealed. At the same time, when the relevant route is selected by the algorithm, it is shown how much profit will be achieved, how long the robots will take to complete their tasks, and how much power they will use during this time. The results obtained from the simulation environment are presented. In this scenario, performances are considered from two dimensions. In Table 5, results including all phases are presented. Since the SCSO-based method gave the best results in the first phase, this approach was used for all the methods used. In the second, the results are obtained based on only the 2nd and 3rd phases, excluding the 1st phase, and are presented in Table 6. In this model, the planting was carried out with an analytical and classical approach. All results were evaluated on five different parameters. When an analysis including all phases is made, improvements are seen in all evaluation parameters (except profit). In other words, phase 1 has an effect on other parameters apart from the profit rate. The profit value does not change. This is because it has nothing to do with the realization of the first phase. According to the results in Tables 5 and 6, it can be seen that the proposed method (RACO) **Algorithm Profit (%) Time Consumed by Robot (m) Traveled Distance (m) Energy Consumed (%) Simulation Time (s) Path List** RACO **83.77 16.57 332.55 12.46 34.82** [15, 16, 17, 24, 30, 36, 34, 33, 32, 31, 25, 26, 27, 28, 29, 35, 23, 22, 21, 20, 14, 19, 13, 7, 1, 8, 2, 3, 9, 4, 5, 6, 12, 18, 11, 10] MAP-ACO 67.82 22.78 371.7 17.09 35.51 [5, 4, 3, 26, 27, 33, 34, 29, 28, 35, 36, 30, 24, 22, 21, 32, 31, 25, 19, 20, 14, 8, 7, 13, 1, 2, 9, 15, 16, 10, 11, 17, 18, 23, 12, 6] CS 72.59 22.5 394.33 16.87 37.6 [14, 21, 22, 28, 33, 34, 23, 29, 35, 36, 30, 24, 17, 16, 10, 9, 8, 7, 1, 13, 19, 20, 26, 27, 32, 31, 25, 2, 3, 5, 4, 6, 11, 18, 12, 15] FA 70.13 23.94 398.71 17.95 36.65 [23, 24, 18, 17, 11, 6, 12, 16, 15, 14, 7, 8, 9, 4, 5, 10, 3, 2, 1, 20, 21, 27, 32, 26, 28, 34, 33, 31, 25, 13, 19, 22, 29, 36, 35, 30] GA 68.99 27.68 443.11 20.76 38.07 [25, 26, 32, 33, 28, 29, 30, 36, 22, 27, 15, 21, 20, 8, 3, 31, 19, 14, 13, 7, 1, 2, 9, 10, 4, 5, 6, 11, 17, 12, 18, 24, 34, 35, 23, 16] GSO 62.88 34.11 598.03 25.58 37.46 [29, 21, 22, 5, 11, 14, 19, 25, 26, 31, 20, 1, 16, 8, 2, 4, 9, 6, 12, 10, 3, 23, 24, 32, 33, 28, 18, 15, 17, 13, 7, 27, 34, 35, 30, 36]

**Table 5.** The simulation results of each algorithm (best) based on all phases.

the evaluation and analysis to include all phases.

performs better than the others. Therefore, it was more realistic and efficient to continue

The best values of algorithms are written in bold.


The best values of algorithms are written in bold.

In Tables 5 and 6, the performances of all algorithms are presented in detail. At this stage, a route with the least cost was chosen for the robot as the optimal path. When electing this, we aimed for the robot to consume the least power in the shortest time and to collect products at a high rate. In this regard, the performance values of the best path chosen by each algorithm are given. Based on the results, all three goals were achieved, with the highest rate on the route chosen by RACO. Finally, the results obtained from this subsection (scenario 2) are ordered comparatively and presented in Table 7. According to Table 7, the RACO method took the first order in the "profit" parameter. The second place is the CS-based method. In the "Time Consumed by Robot" parameter, the results of the RACO method found the best solution according to the results from the first phase of our study. Other ranks have been determined by the numbers written in relevant columns of this table. In the "Traveled Distance" parameter, the RACO-based method found the best result. The minimum amount in this parameter is the best answer. The worst performance was observed to be the GSO method. The amount of energy to be used by the robots, whose task is defined thanks to the operation of each method, is the fourth evaluation parameter. In this analysis, the RACO method performed better. The last parameter is the "Simulation Time", and it is the running time of the simulation. This indicates how efficiently another resource was used. RACO performed the best and the GA method the worst.



In addition, these selected routes are presented visually in Figure 5. The convergence behavior of the methods used at this stage is also presented in Figure 6, and it is observed that the proposed method is also good in this regard. For the abovementioned reasons, the results including all phases have been taken into account. The convergence behavior and local optimum avoidance of the methods used at this stage are also presented in Figure 6, and it is observed that the proposed method is also good in this regard. The proposed algorithm starts from a large sensitivity range to discover more possible solutions and explore the whole search area. As the iterations progress, by decreasing the value of the sensitivity ranges search agents try to exploit and find the global optima.

**Figure 5.** The elected path by each algorithm.

**Figure 6.** Convergence behavior of each method.

#### **5. Conclusions**

In this study, attention is drawn to the importance of smart and mechanical systems for the efficient use of natural resources such as water and nutrients, which are vital in human life. At the same time, it is not enough to just suggest smart systems or methods, it is also important to develop sustainable approaches. Therefore, we focused on an application that can meet many needs in agriculture, from planting to harvesting. Moreover, the health of the farmers can be protected and their heavy workload on the agricultural lands will be reduced. In addition, accident rates will automatically decrease. Therefore, the occupational health and safety rate can be increased. In addition, crop abundance can be experienced due to the mechanized and sustainable nature of the proposed model, and therefore possible forced migration events will also decrease.

The proposed mechanism consisted of three phases. In the first phase, an SCSO-based approach was presented to assign the cultivation task to the relevant autonomous robots, eliminating the human resource factor. It should be noted that in this study, we did not focus on the robotics field, but only on the development of an algorithmic-based model and the architecture of the simulation environment. In the second phase, we used IoT devices to instantly check the status of the crops planted by robots. The result from this phase was taken as the input for the third phase (harvesting). In the third stage, a new method was proposed, inspired by the working mechanism of the ACO algorithm. This method tries to get the maximum profit from the crops to be collected. In addition, it attempts to generate paths for the harvesting robots in a way that would consume the least power and time. According to the results, our proposed algorithms performed better than other methods. In this study, the tomato field was considered as an example, but the suggested mechanism could be used for different purposes in many agricultural lands.

**Author Contributions:** Conceptualization, F.K., A.S., S.N. and F.A.A.; methodology, F.K., A.S., S.N. and I.Y.; software, A.S. and I.Y.; validation, A.S., M.Z., G.R., S.L., A.M. and I.Y.; formal analysis, A.S. and I.Y.; investigation, A.S., F.A.A., F.E., I.Y., S.N. and F.K.; resources, F.K., F.E., I.Y., A.M. and M.Z.; data curation, M.Z. and I.Y.; writing—original draft preparation, F.K., F.E., S.N., F.A.A., G.R., S.L. and A.M.; writing—review and editing, F.K., F.A.A., I.Y., G.R., S.L. and A.M.; visualization, A.S., F.E., G.R., S.L. and A.M.; supervision, F.K., A.M. and I.Y.; project administration, F.K. and I.Y. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research received no external funding.

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Data Availability Statement:** Available on request.

**Conflicts of Interest:** The authors declare no conflict of interest

#### **References**

