Volume 95, Issue 1 e13992
RESEARCH ARTICLE
Full Access

Path planning optimization for swine manure-cleaning robots through enhanced slime mold algorithm with cellular automata

Yong Peng Duan

Yong Peng Duan

School of Information Science and Engineering, Shanxi Agricultural University, Taigu, China

Search for more papers by this author
Ya Zhi Yang

Ya Zhi Yang

College of Agricultural Engineering, Shanxi Agricultural University, Taigu, China

Search for more papers by this author
Yue Cao

Yue Cao

School of Information Science and Engineering, Shanxi Agricultural University, Taigu, China

Search for more papers by this author
Hao Ming Li

Hao Ming Li

School of Information Science and Engineering, Shanxi Agricultural University, Taigu, China

Search for more papers by this author
Ze Wei Hu

Ze Wei Hu

College of Agricultural Engineering, Shanxi Agricultural University, Taigu, China

Search for more papers by this author
Ri Liang Cao

Ri Liang Cao

College of Animal Science, Shanxi Agricultural University, Taigu, China

Search for more papers by this author
Zhen Yu Liu

Corresponding Author

Zhen Yu Liu

College of Agricultural Engineering, Shanxi Agricultural University, Taigu, China

Dryland Farm Machinery Key Technology and Equipment Key Laboratory of Shanxi Province, Taigu, China

Correspondence

Zhen Yu Liu, College of Agricultural Engineering, Shanxi Agricultural University, Taigu, Shanxi 030801, China, and Dryland Farm Machinery Key Technology and Equipment Key Laboratory of Shanxi Province, Taigu 030801, China.

Email: [email protected]

Search for more papers by this author
First published: 22 September 2024
Citations: 3

Funding information: This work was supported by the Research Project Supported by Shanxi Scholarship Council of China (grant number: 2023-092) and the key R&D program of Shanxi Province (grant number: 202302010101002).

Abstract

One of the primary challenges for robotic manure cleaners in pig farming is to plan the shortest path to designated cleaning points under specified conditions with minimal processing cost and time, while avoiding collisions. However, pigs are randomly distributed in actual pig farms, which obstructs the robots' movement and complicates the rapid determination of optimal solutions. To address these issues, this study introduces the concept of interaction among cellular automaton cell neighborhoods and proposes the Cellular Automata Slime Mold Algorithm (CASMA). This enhanced slime mold algorithm accelerates convergence speed and improves search accuracy. To validate its effectiveness, CASMA was compared with four metaheuristic algorithms (ACO, FA, PSO, and WPA) through performance tests and simulated experiments. Results demonstrate that in complex pigsty environments with varying numbers of pigs, CASMA reduces average step consumption by 8.03%, 1.61%, 0.99%, and 4.26% compared with these algorithms and saves processing time by averages of 13.20%, 20.11%, 10.86%, and 6.4%, respectively. In addition, in dynamic obstacle experiments, CASMA achieved average time savings of 48.27% and 56.28% compared with A* and TS, respectively, while reducing step consumption. Overall, CASMA enhances the efficiency of manure-cleaning robots in pig farms, thereby improving animal welfare.

1 INTRODUCTION

Over the past few decades, global pork production has seen significant growth, leading to increased fecal output in certain regions (Liu, Zeng, et al., 2020). The accumulation of large volumes of feces and wastewater exacerbates environmental hazards such as land acidification, water eutrophication, and global warming (Praveen et al., 2021). Given that feces and urine serve as primary shelters for bacteria, viruses, ticks, and fleas, maintaining cleanliness in swine barns and promptly removing excrement helps reduce the occurrence of infectious diseases among pigs (Varma et al., 2021). Furthermore, recycling feces as organic fertilizer can provide additional economic benefits to swine operations. Traditional methods of fecal management involve manual cleaning, which is labor-intensive and time-consuming and poses health risks to workers exposed to the foul environments of swine barns over extended periods. Robotic feces-cleaning systems offer an automated alternative to manual labor in swine facilities. Compared with non-robotic solutions, these robots are generally recognized for their cost-effectiveness in managing fecal waste and reducing disease transmission (Sagkob et al., 2011). In the realm of feces-cleaning robots, Ilja Stasewitsch et al. (2020) and Berry Gerrits et al. (2022) have developed a robotic system for cleaning liquid and fecal matter in dairy barns, demonstrating through experiments and simulations the effectiveness of automated cleaning methods. P. Ebertz et al. (2019) explored the feasibility of adapting robotic fecal scrapers from dairy farming for use in cleaning sow pens. Despite narrower troughs and the denser consistency of excrement in sow rearing, the robotic scrapers exhibited robust cleaning performance.

In the realm of autonomous mobile robots (AMRs), one critical challenge during the design of pig farm cleaning robots is path planning and obstacle avoidance (PPOA). Traditional algorithms such as Dijkstra and Bellman-Ford face significant limitations in addressing these issues because of nonlinear, continuous, and uncertain constraints (Liu et al., 2012). For instance, Xi et al. (Junpeng et al., 2020) previously proposed a simulated annealing (SA)-based hybrid algorithm for material distribution path planning, but SA's drawback lies in its slow convergence rate. Li et al. (2014) and Hassani et al. (2018) introduced the A* algorithm to tackle optimal path problems in composite web service selection and robot path planning, yet A* algorithms often demand substantial computational memory in complex environments, leading to sudden increases in computational workload. Developing an algorithm that is flexible, implementable, robust, and capable of swiftly generating collision-free paths is thus of paramount importance. Metaheuristic algorithms, a category of optimization algorithms based on heuristic methods, possess the ability to automatically learn and adapt features specific to the problem at hand, enabling them to search for optimal solutions within the search space. Widely applied in robot path planning (Song et al., 2021), optimization of wireless sensor networks (Sahoo et al., 2021), logistics distribution, and optimal route selection for peak-hour vehicles (Hou et al., 2023), metaheuristic algorithms exhibit strong global search capabilities, robustness, and adaptability. Compared with traditional methods, metaheuristic algorithms are particularly suited for addressing PPOA problems in large-scale and complex search spaces (Ab Wahab et al., 2020). Common metaheuristic algorithms include particle swarm optimization (PSO) (Wang et al., 2024), artificial bee colony algorithm (ABC) (Zhao et al., 2023), and genetic algorithm (GA) (Zheng et al., 2023). For instance, He Du et al. (2022) proposed the short and safe Q-learning algorithm (SSQL) for collision-free shortest path planning, demonstrating its advantages through simulation experiments. Lei Wu et al. (2023) addressed the slow convergence and low-efficiency issues of ant colony optimization (ACO) by proposing the Modified Adaptive Ant Colony Optimization (MAACO) for mobile robot path planning, showing MAACO's superiority in reducing path length and improving convergence speed. Kiani, Seyyedabbasi, Aliyev, Shah, and Gulle (2021) introduced two enhanced variants of grey wolf optimization (GWO), namely, I-GWO and Ex-GWO, for unmanned aerial vehicle PPOA, with simulation results across different maps highlighting I-GWO's optimal performance in terms of path cost and response time. They further applied I-GWO and Ex-GWO in sustainable smart agriculture (Kiani et al., 2022), where robots equipped with these algorithms efficiently plan collision-free optimal paths between points in fields, thereby maximizing crop yields in minimal time. Additionally, another variant of GWO proposed by the same team (Kiani, Seyyedabbasi, Aliyev, Gulle, et al., 2021) demonstrated advantages in terms of path cost, execution time, and convergence rate.

Cellular automaton (CA) is a discrete computational model composed of discrete space, time, and simple rules (Song & Yang, 2023), evolving based on local interactions and simple rules, yet capable of generating complex global behaviors. Because of its simplicity, parallelism, self-organization, and ability for multiscale modeling, CA has been widely applied in simulating behaviors such as disease prediction (Valentim et al., 2023), pedestrian evacuation (Zhou et al., 2023), and forest fires (Efstathiou et al., 2023). Furthermore, CA holds significant potential for addressing PPOA issues (Akbarimajd & Hassanzadeh, 2012; Marchese, 1996). To demonstrate CA's performance in path planning, C. Behring et al. (2001) proposed a CA method for robot path planning, with simulation results indicating its ability to quickly plan optimal paths to destination points in dynamic environments. H.J.M. Lopes and Lima (2020) introduced an optimized A* algorithm for path planning, incorporating CA rules for obstacle expansion to avoid collision issues during pathfinding, demonstrating an effective reduction in robot inspection time through simulation results. Additionally, B. Li et al. (2022) developed a CA-based shortest path optimization algorithm for addressing path planning issues in extreme flood events, showing that the algorithm can rapidly compute the shortest pedestrian evacuation path as floods approach. G.M.B. Oliveira et al. (2019) and K. Ioannidis et al. (2011) both proposed CA models to address PPOA in robot team cooperation tasks, utilizing E-pucks AMRs for testing. Results indicated that integrating CA into the model enhances overall team efficiency and robustness across different scenarios.

Slime molds are eukaryotic organisms similar to fungi, belonging to a branch of the kingdom Protista (Meena et al., 2019). They exhibit collective intelligence and self-organized complex behaviors such as distribution, foraging, and path planning when searching for food. The slime mold algorithm, introduced by Li et al. (2020), simulates a series of morphological changes during slime mold foraging (Tiachacht et al., 2021). As a metaheuristic algorithm, it has demonstrated advantages in pathfinding and optimization (Hassan et al., 2021). However, the original slime mold algorithm suffers from issues such as susceptibility to local optima, slow convergence speed, and low solution accuracy. To address these challenges, Qiu et al. (2023) proposed the Multi-Strategy Integrated Slime Mold Algorithm (MSISMA), which achieved the best average values across 19 out of 23 test functions. Agarwal and Bharti (2021) presented an improved slime mold algorithm (SMOA) for machine shortest path planning, showing superior performance in both path planning and processing time based on MATLAB simulations. Building upon SMOA, Ghannadi and Kourehli (2022) introduced an Artificial Malaria Parasite Algorithm for solving maze-based path planning problems, demonstrating enhanced search accuracy and speed compared with the original slime mold algorithm.

This study addresses the slow convergence and low solution accuracy issues of the slime mold algorithm by incorporating ideas from cellular automata, proposing a Cellular Automaton-enhanced Slime Mold Algorithm (termed CASMA). Detailed performance comparisons and simulated experiments were conducted with four other metaheuristic algorithms: ACO, firefly algorithm (FA), wolf pack algorithm (WPA), and PSO. Additionally, dynamic obstacle experiments were designed to simulate the path planning performance of the algorithms under the continuous random movement of pigs in practical scenarios, comparing them with two commonly used heuristic algorithms, A* and Tabu search (TS). The main contributions of this study are as follows:
  1. Proposal of an improved slime mold algorithm enhanced with cellular automata for path planning of pig waste-cleaning robots, incorporating a nonlinear weight Cω in the SMA update process to accelerate algorithm convergence and enhance search accuracy.
  2. Comparison of the performance of CASMA, ACO, FA, PSO, and WPA on the Rosenbrock function to evaluate their testing capabilities.
  3. Conducting PPOA simulation experiments in Python to evaluate CASMA, ACO, FA, PSO, and WPA metaheuristic algorithms.
  4. Designing dynamic obstacle simulation experiments to demonstrate CASMA's applicability in real-world pig waste cleaning scenarios where pig positions move randomly, and comparing its performance with A* and TS heuristic algorithms.

2 MATERIALS AND METHODS

2.1 Cellular automata and slime mold algorithms

2.1.1 Cellular automata

Cellular automata are capable of simulating complex phenomena and processes. The fundamental elements constituting a CA include space, state, neighbors, and update rules. Operating within a discrete space, typically a multi-dimensional grid, each cell within the grid acts as a “cell.” The state represents the properties, status, or features of the cell. At each time step, a cell updates its state based on its current state and the states of its neighboring cells. The update of a cell's state depends on the states of its surrounding neighbor cells. Common spatial connections between cells are defined by neighbor relationships, typically categorized into three types as illustrated in Figure 1. The evolution rules of a CA define how the state of a cell is updated; these rules are usually formulated as functions that compute the next state based on the current state of the cell and its neighbors. In elementary cellular automata (ECA), the state set S comprises only two elements: S1 (commonly denoted as 0) and S2 (commonly denoted as 1). With a neighbor radius of 1, meaning only left and right neighbors, the update rule for ECA cells is depicted as Equation (1).
S i t + 1 = f S i 1 t S i t S i + 1 t $$ {S}_i^{\mathrm{t}+1}=f\left({S}_{i-1}^t,{S}_i^t,{S}_{i+1}^t\right) $$ (1)
Details are in the caption following the image
Three common neighborhoods of cellular automata. Neighborhoods of a tuple automaton define how tuples are spatially connected to each other, and there are three common neighborhoods: the Von Neumann type, the Moore type, and the Extended Moore type. The black cell represents the central point, and the gray cells denote the neighbors of the central point. The white cells represent the background.

2.1.2 Slime mold algorithm

The behavior of slime molds during prey capture can be abstracted into three rules: approaching food, surrounding food, and capturing food (Rizk-Allah et al., 2020). Each iteration process can be divided into three steps: sorting, updating weights, and updating positions. The pseudocode for the SMA is shown in Table 1.

TABLE 1. Pseudocode of Slime Mold Algorithm.

Initialize each parameter: including weights W, maximum number of iterations, etc;

Initialize the slime mold population Xi (i = 1, 2, 3 .... , n);

For(i=0, Max_Iteration, i++):

   Determining whether a slime mold individual has exceeded the search space;

   The starvation value of each slime mold was calculated and ranked to update bestFitness, Xb;

   Update the weights W by using the following equation:

          W new , i d = 1 + r × log bF S i bF wF + 1 if individual adaptation 1 , 1.3 1 r × log bF S i bF wF + 1 else individual adaptation 0.7 , 1 $$ {W}_{new,i}^d=\left\{\begin{array}{l}1+\mathrm{r}\times \log \left(\frac{bF-S(i)}{bF- wF}+1\right)\kern1.00em \mathrm{if}\ \mathrm{individual}\ \mathrm{adaptation}\kern1em \in \left[1,1.3\right]\\ {}1-r\times \log \left(\frac{bF-S(i)}{bF- wF}+1\right)\begin{array}{ccc}& & \end{array}\mathrm{else}\ \mathrm{individual}\ \mathrm{adaptation}\in \left[0.7,1\right]\end{array}\right. $$

   For each search portion:

   Update p, vb, vc;

   Update the position of the slime mold by the following formula:

          X t + 1 = r × ub lb + lb , r < z X b t + vb W × X A t X B t , r < p vc × X t , p r $$ \mathrm{X}\left(\mathrm{t}+1\right)=\left\{\begin{array}{ll}r\times \left( ub- lb\right)+ lb,& r<z\\ {}{X}_b(t)+ vb\left(W\times {X}_A(t)-{X}_B(t)\right),& r<p\\ {} vc\times X(t),& p\le r\end{array}\right. $$

   End for

End for

Return bestFitness, Xb;

The process of updating the weights is shown in Equation (2):
W new , i d = 1 + r × log bF S i bF wF + 1 if individual adaptation 1 , 1.3 1 r × log bF S i bF wF + 1 els e individual adaptation 0.7 , 1 $$ {W}_{new,i}^d=\left\{\begin{array}{ll}1+r\times \log \left(\frac{bF-S(i)}{bF- wF}+1\right)& \mathrm{if}\ \mathrm{individual}\ \mathrm{adaptation}\in \left[1,1.3\right]\\ {}1-r\times \log \left(\frac{bF-S(i)}{bF- wF}+1\right)& els\mathrm{e}\ \mathrm{individual}\kern0.5em \mathrm{adaptation}\in \left[0.7,1\right]\end{array}\right. $$ (2)
The process of updating the position of an individual is shown in Equation (3):
X t + 1 = r × ub lb + lb , r < z X b t + vb W × X A t X B t , r < p vc × X t , p r $$ X\left(t+1\right)=\left\{\begin{array}{ll}r\times \left( ub- lb\right)+ lb,& r<z\\ {}{X}_b(t)+ vb\left(W\times {X}_A(t)-{X}_B(t)\right),& r<p\\ {} vc\times X(t),& p\le r\end{array}\right. $$ (3)
The calculation process of the control parameter p is shown in Equation (4):
p = tanh S i DF , i = 1 , 2 , 3 , n $$ p=\tanh \mid S(i)- DF\mid, \left(\mathrm{i}=1,2,3\dots, \mathrm{n}\right) $$ (4)
Parameters vb and vc take values in Equation (5):
vb = a , a vc = b , b $$ vb=\mid -\mathrm{a},\mathrm{a}\mid \kern1.00em vc=\mid -\mathrm{b},\mathrm{b}\mid $$ (5)

2.1.3 Algorithmic improvement process

In order to address the issues of slow convergence speed and low solution accuracy in the original slime mold algorithm, we propose improvements based on the original algorithm. Specifically, we introduce a nonlinear weight parameter Cω into the position update equation of the slime mold algorithm. The update process for Cω is described in Equation (6), and the improved update formula is given in Equation (7). The characteristic of Cω is that its value exhibits a nonlinear decreasing trend as the algorithm iterates. This improvement accelerates the convergence speed of the algorithm in the early iterations and enhances its local search capability in the later iterations. During each position update process, we employ the concept of neighborhood interaction in cellular automata to define the propagation of information between neighboring cells. Each cell can release and receive information from adjacent cells, and the distance and connectivity determine the strength and direction of propagation. When updating positions, we combine the movement of the slime mold with the update of cell positions in the CA. The evaluation process of fitness in the improved slime mold algorithm is illustrated in Figure 2a, whereas the three states during prey capture are depicted in Figure 2b. The meanings of the parameters involved in the formulas are provided in Table 2. In the simulation section of this study, we set up a 45*45 size map to simulate the pig farm environment, dividing it into 2025 equally sized grids. Each grid can be viewed as a cell, with the “Von Neumann neighborhood” serving as the neighbor distribution for each cell, meaning that during each position update, only the four directions of up, down, left, and right can be chosen for position movement.
C ω = C initcnp C curcnp 1 exp T t t 2 $$ {C}_{\omega }=\left({C}_{\mathrm{initcnp}}-{C}_{\mathrm{curcnp}}\right)\cdot \left(1-{\exp}^{-{\left(\frac{T-\mathrm{t}}{t}\right)}^2}\right) $$ (6)
Details are in the caption following the image
CASMA-inspired schematic. (a) Demonstrations of the process of evaluating the improved mucilage algorithm for fitness and (b) demonstration of the three states (approaching, searching, and capturing) of change in slime mold predation.
TABLE 2. Parameters involved in the equation and their meanings.
Serial number Symbolic Hidden meaning
1 r Random number, taking values [0, 1]
2 W Weight of the Slime mold
3 bF Current iteration optimal fitness value
4 wF Worst fitness value of current iteration
5 Xb(t) Optimal position of slime mold at tth iteration
6 ub Explore space previous session
7 lb Explore space next session
8 vb Random number taking values [a, −a]
9 t Current iteration number
10 S(i) Fitness value of the ith individual slime mold
11 vc Random number taking values [b, −b]
12 XA(T), XB(T) Two randomly selected slime mold individuals in the T iteration
13 X(t) Location of the slime mold at the tth iteration
14 Nonlinear weights, taking values [0, 1]
15 Cinitcnp Initial metacellular neighborhood pheromone
16 Ccurcnp Current metacellular neighborhood pheromone
In the proposed approach, Cω represents a nonlinear weight with a range of [0, 1]. Cinitcnp denotes the initial concentration of information pheromones in the cellular neighborhood. Its initial value is set to 3 × 10−4, and the concentration increases by 1 × 10−4 for each additional neighbor. Ccurcnp represents the current concentration of information pheromones in the cellular neighborhood. T corresponds to the total number of iterations, whereas t represents the current iteration number.
X t + 1 = C ω × ub lb + lb , C ω < z X b t + vb W × X A t X B t z r < p vc × X t , p r $$ X\left(t+1\right)=\left\{\begin{array}{ll}{C}_{\omega}\times \left( ub- lb\right)+ lb,& {\mathrm{C}}_{\omega }<z\\ {}{X}_b(t)+ vb\left(W\times {X}_A(t)-{X}_B(t)\right)& z\le \mathrm{r}<p\\ {} vc\times X(t),& p\le \mathrm{r}\end{array}\right. $$ (7)
CASMA employs parameters vb, vc, W, and Cω to simulate changes in vein width, oscillator frequency, and cytoplasmic flow during the food-seeking behavior of slime molds. When food concentration is low (indicating a greater distance from the food), global random position updates are performed to approach the food. These parameter settings allow individuals to form search vectors at arbitrary angles, thereby enhancing global search capability. Additionally, the inclusion of Cω accelerates the algorithm's approach speed toward food sources. Once high-quality food is found, the algorithm determines the optimal path based on the concentration of pheromones among cellular neighborhoods (the path from the starting point to the neighborhood with the highest pheromone concentration is considered optimal), swiftly approaching the food. In Equation (7), the first sub-formula acquires global random positions, the second performs local searches near the current optimal position, and the third facilitates individual convergence to zero. The CASMA algorithm proceeds as follows:
  1. Initialization: Create a two-dimensional CA grid where each grid unit represents a cell. Initialize cell states, positions, and algorithm parameters.
  2. Update weights W, nonlinear weight Cω, and cellular pheromones: Update W, Cω, and cellular pheromones according to Formulas (2) and (6).
  3. Position update: Use Equation (7) to update the slime mold state to continuously approach the food (endpoint).
  4. Compute fitness value, and update the global optimal solution based on cellular pheromone concentration.
  5. Iterate repeatedly to check if termination conditions are met; if not, return to step (2).
  6. Upon finding food, extract the shortest path information based on the highest cellular pheromone concentration, which represents the shortest path.

2.2 Introduction to comparison algorithms and metrics

2.2.1 Introduction to contrast algorithms

The ACO algorithm draws inspiration from the information exchange and collective cooperation observed in the foraging behavior of ants (Dorigo et al., 2006). Figure 3 illustrates the path selection process of ants searching for food. ACO, and its variants are widely applied in combinatorial optimization problems, path planning, and other fields. For instance, a novel hybrid multi-objective improved ACO algorithm, SMO-ACO, is employed to solve cloud server scheduling issues (Amer et al., 2024), and an enhanced ACO-GA algorithm combining ACO with GAs is used in flood evacuation models (Dong et al., 2024). The core pathway construction process of ACO is illustrated by Equation (8), where i and j represent the starting and ending points, τ ij t $$ {\tau}_{\mathrm{ij}}(t) $$ denotes the intensity of pheromones from i to j at time t, allowedk signifies the set of nodes that have not been visited yet, and α and β are two constants denoting the pheromone visibility and weighting values, respectively.
P k ij t = τ ij t α × η ij t β k allowed k τ ik t α × η ik t β if j allowed k 0 others $$ P\frac{\mathrm{k}}{ij}(t)=\left\{\begin{array}{ll}\frac{{\left[{\tau}_{ij}(t)\right]}^{\alpha}\times {\left[{\eta}_{ij}(t)\right]}^{\beta }}{\sum_{k\in {allowed}_k}{\left[{\tau}_{ik}(t)\right]}^{\alpha}\times {\left[{\eta}_{ik}(t)\right]}^{\beta }}& ifj\in {allowed}_k\\ {}\hfill 0\hfill & \mathrm{others}\end{array}\right. $$ (8)
Details are in the caption following the image
Schematic of ant colony algorithm pathfinding. In figure (a), points A and F respectively denote the current position of the ant colony and the location of food, where the colony must pass through points B and E to ultimately reach food source F. Figure (b) illustrates the state of the ant colony at time T = 0, where the pheromone concentration on all paths leading to the destination is uniformly 15 units. Figure (c) depicts the state of the ant colony at time T = 1 after updating the pheromone concentrations. Following the update, the concentration of pheromones on the shortest path is increased.
The WPA, proposed by Wu Husheng et al. (2013), simulates the hunting and prey allocation behavior within a wolf pack. WPA has demonstrated effective performance in solving various optimization problems (Liu, Sun, & Liu, 2020). Numerous variants have been developed, including an enhanced version known as the enhanced wolf pack algorithm (EWPA) applied in X-ray diagnostics (Alhassan, 2024). The core formula for updating positions in WPA (surrounding behavior) is given by Equation (9), where G d k $$ {G}_d^k $$ represents the position of prey in d-dimensional space within the kth generation population, step c d $$ {step}_c^d $$ is the attack step size, and λ $$ \lambda $$ is a uniformly distributed random number between −1 and 1.
χ id k + 1 = χ id k + λ step c d G d k χ id k $$ {\chi}_{\mathrm{id}}^{k+1}={\chi}_{id}^k+\lambda \cdot {step}_{\mathrm{c}}^d\cdot \mid {G}_d^k-{\chi}_{id}^k\mid $$ (9)
The PSO algorithm draws inspiration from the foraging behavior of bird flocks (Kennedy & Eberhart, 1995), as illustrated in Figure 4. Variants of PSO are frequently applied to solve various engineering problems, such as the Gazelle Optimization Algorithm and the MPSOGOA algorithm combining PSO for engineering optimization tasks (Qin et al., 2024) and PSO-BPNN used for aircraft noise assessment (Feng et al., 2024). The core position update formula of PSO is shown in Equation (10), where w represents the inertia weight factor (typically initialized to 0.9 and linearly decreased to 0.4 during evolution); k denotes the current iteration count; Vid is the velocity of the particle; c1 and c2 are non-negative constants known as acceleration coefficients, with c1 weighting the particle's historical best position and c2 weighting the swarm's best position; r1 and r2 are constraint factors ranging between 0 and 1, aimed at preventing exhaustive searching by particles.
V id k + 1 = wV id k + c 1 r 1 P id k X id k + c 2 r 2 P id k X id k $$ {V}_{\mathrm{id}}^{k+1}={wV}_{id}^k+{c}_1{r}_1\left({P}_{id}^k-{X}_{id}^k\right)+{c}_2{r}_2\left({P}_{id}^k-{X}_{id}^k\right) $$ (10)
Details are in the caption following the image
Schematic diagram of bird foraging mode to PSO-inspired relationships. The image on the left represents the way the flock forages for food, with the birds approaching the food in the center. The right image represents a schematic of the inspired relationship, the black dots represent the flock of birds, gray indicates food, and white dots denote the path.
The FA is inspired by the behavior of fireflies (Jain et al., 2021), simulating their mutual attraction and flashing behavior during the predation process to solve optimization problems. FA and its variants are commonly employed to tackle numerous practical issues. For instance, an improved variant of FA, termed the improved firefly algorithm (IFA), has been applied to optimize photovoltaic systems (Yang et al., 2024). Furthermore, FA enhanced for global search and convergence speed has found applications in engineering optimization problems (Ghasemi et al., 2022). The core position updating process of FA is depicted in Equation (11), where α represents a randomization parameter and rand is a random value in the range [0, 1].
x i = x i + β 0 e γ r ij 2 x i x j + α rand 1 2 $$ {x}_i={x}_i+{\beta}_0{e}^{-\gamma {r}_{ij}^2}\left({x}_i-{x}_j\right)+\alpha \left(\mathit{\operatorname{rand}}-\frac{1}{2}\right) $$ (11)

2.2.2 Assessment of indicators

There are three common distance metrics, namely, Euclidean distance (Cheng et al., 2023), Manhattan distance (Tasena, 2022), and Minkowski distance (Zhai et al., 2014). Euclidean distance is the commonly used distance definition, which measures the distance between two points in Euclidean space. It represents the true distance between the two points in an n-dimensional space. Manhattan distance, also known as the city block distance, calculates the sum of the absolute differences between the coordinates of two points in a standard coordinate system. Minkowski distance is not a specific distance itself but rather a general representation of a group of distance metrics. It extends the concepts of Euclidean and Manhattan distances. In this study, the distance metric used in the simulation is Manhattan distance.

The Euclidean distance is shown in Equation (12):
L χ i χ j = m = 1 n χ i m χ j m 2 1 2 $$ L\left({\chi}_i,{\chi}_j\right)={\left(\sum \limits_{m=1}^n{\left|{\chi}_i^{(m)}-{\chi}_j^{(m)}\right|}^2\right)}^{\frac{1}{2}} $$ (12)
The Manhattan distance is shown in Equation (13):
L χ i χ j = m = 1 n χ i m χ j m $$ L\left({\chi}_i,{\chi}_j\right)=\sum \limits_{m=1}^n\mid {\chi}_i^{(m)}-{\chi}_j^{(m)}\mid $$ (13)
The Minkowski distance is shown in Equation (14):
L χ i χ j = m = 1 n χ i m χ j m p 1 p $$ L\left({\chi}_i,{\chi}_j\right)={\left(\sum \limits_{m=1}^n{\left|{\chi}_i^{(m)}-{\chi}_j^{(m)}\right|}^p\right)}^{\frac{1}{p}} $$ (14)

3 RESULTS AND ANALYSIS

3.1 Performance test

The Rosenbrock function, also known as the Valley or Banana function, is a non-convex function commonly used to evaluate the performance of optimization algorithms in mathematical optimization problems (Bouvry et al., 2000). In this study, we tested five algorithms, namely, CASMA, ACO, FA, PSO, and WPA, on the Rosenbrock test function. The test results after 500 iterations are presented in Figure 5, whereas Figure 6 illustrates the convergence curves of each algorithm during iteration. Additionally, Table 3 displays the results obtained from 10 tests of the five algorithms on this function (with values taken after convergence at 500 iterations in each test). The Rosenbrock function is defined as follows, according to Equation 15:
f x = i = 1 d 1 100 x i + 1 x i 2 2 + x i 1 2 $$ f(x)=\sum \limits_{i=1}^{d-1}100{\left({x}_{i+1}-{x}_i^2\right)}^2+{\left({x}_i-1\right)}^2 $$ (15)
Details are in the caption following the image
Minimum values taken by each algorithm were obtained with 500 iterations on the Rosenbrock test function. (a), (b), (c), (d), and (e) show the performance of the five algorithms, namely, ACO, FA, PSO, CASMA, and WPA, on the Rosenbrock test function for the minimum values taken by the five algorithms. F(x) value indicates the range for the heatmap, and (f) shows the distribution of the results for the five algorithms. The point (1, 1) is the minimum value obtained by the function.
Details are in the caption following the image
Convergence curve of the iterative process of each algorithm. (a), (b), (c), (d), and (e) show the convergence curves of the iterative process of ACO, FA, PSO, CASMA, and WPA on the Rosenbrock test function, respectively, with the horizontal coordinates representing the number of iterations and the vertical coordinates representing the results of the optimal values. Figure (f) focuses on these five convergence curves, and each algorithm gradually converges with the increase of the number of iterations.
TABLE 3. Taking results of each algorithm tested 10 times on the Rosenbrock test function.
No. ACO FA PSO CASMA WPA
1 0.84676876242 0.84880630669 0.87447750238 0.93142489054 0.85716971296
0.86395687683 0.89806980602 0.95500762799 0.94379972422 0.8813300155
2 0.8369587535 0.85615864053 1.08005364033 0.88936464709 0.8320238446
0.77461749315 0.75648058412 1.12501340197 0.7910996943 0.77790956349
3 0.89729124948 0.92598109902 0.93930852507 1.0161456115 0.8948083031
0.90893335673 0.9493707060 0.9453305244 1.16111569333 0.92595419910
4 0.89460482343 0.8858373428 0.91889646192 0.88703115601 0.88199031587
0.84562691568 0.89200659686 0.8940011153 0.89937321436 0.88843414192
5 1.17539253655 0.81023276680 1.16046827770 0.87140644011 1.18094921816
1.29465120566 0.78503715564 1.33285545883 0.79056021797 0.73149240970
6 0.83753634488 1.11123468306 0.90272264253 0.97165820929 0.89378208311
0.89611001387 1.15966105279 0.87733772010 0.96314770539 0.87980555494
7 0.65694620526 0.821243674 0.69971115407 0.78420463012 0.70385439276
0.68312916450 0.6512678263 0.66110500827 0.79659943133 0.71431500129
8 0.94943194466 0.96057169014 0.9629665491 0.98764099224 0.96645008869
0.89777682379 0.96891076039 0.97799054029 0.96986277490 0.91551616124
9 0.88188950731 0.88059598142 0.8437905036 1.03997546824 0.88263647376
0.80720280508 0.75897106029 0.90676500247 1.29388133884 0.77633867026
10 1.35940645753 1.06866189224 1.06364366798 1.09870001903 1.07633846745
1.39581394123 1.117416925336 1.14508501980 1.29602459490 1.29846148467

As shown in Figure 5, panels (a), (b), (c), (d), and (e) represent the minimum value results obtained after 500 iterations of the ACO, FA, PSO, CASMA, and WPA algorithms, respectively, on the Rosenbrock test function. Figure 5f illustrates the distribution of the minimum values obtained by the five algorithms. The optimal value for the objective function is (1, 1). From the graph, it can be observed that after 500 iterations, the solution obtained by CASMA is closest to (1, 1), indicating that CASMA outperforms the other four algorithms in terms of value accuracy.

From Table 3, it can be seen that CASMA has smaller fluctuations compared with the other four algorithms in the 10 value results and the overall results are closer to the optimal value.

As depicted in Figure 6, panels (a), (b), (c), (d), and (e) represent the convergence curves of ACO, FA, PSO, CASMA, and WPA, respectively, during the iterative process on the Rosenbrock test function. Panel (f) provides a comparative analysis of the convergence curves for the five algorithms. From the graph, it is evident that CASMA exhibits a rapid descent in the convergence curve before approximately 50 iterations, reaching convergence around the 200th iteration. The convergence speed of CASMA is observed to be faster than the other four algorithms, and it achieves higher precision in the obtained values.

3.2 Simulation and result analysis

In order to simulate the obstacle avoidance and path planning performance of the manure-cleaning robot in a realistic environment, three maps with varying complexities were designed for simulation experiments. The simulations were implemented using Python3 on a Windows laptop equipped with an Intel Core i5-12450H and NVIDIA GeForce 3060 Laptop, and the simulation setup details can be found in Table 4. To ensure fairness, parameters such as start and end points, iteration count, and initial population size were consistent across each map. The specific simulated pig farm environments are outlined as follows: Map 1, depicted in Figure 7, simulates the path planning performance of the manure-cleaning robot in a pigpen with three randomly distributed pigs; Map 2, illustrated in Figure 8, simulates the scenario with seven randomly distributed pigs; and Map 3, shown in Figure 9, simulates the situation with 12 randomly distributed pigs. Each algorithm was run 500 times in each environment (three maps) to obtain simulation results, demonstrating the repeatability of the CASMA method. Table 5 presents the percentage of steps saved by CASMA compared with the four contrasting algorithms, whereas Table 6 provides the percentage of processing time saved by CASMA compared with the four contrasting algorithms.

TABLE 4. Basic environment for simulation.
Basic hardware information Version
Processor Intel Core i5-12450H
Graphics card NVIDIA GeForce 3060 Laptop
Memory 16G
Hard disk 512G SSD
Basic software information Version
Anaconda Anaconda3 2019.10(64-bit)
Python 3.7
Numpy 1.21.6
Matplotlib 3.5.3
Operating system Windows11
Details are in the caption following the image
Simulation results for the case of three pigs randomly distributed on the map. (a), (b), (c), (d), and (e) respectively demonstrate the performance of ACO, FA, PSO, CASMA, and WPA in path planning when faced with three randomly distributed pigs on the map (in a simple environment). The blue and green dots represent the starting and ending points, respectively. The blue patterns represent the pigs, and the red lines depict the optimal paths planned by the algorithms.
Details are in the caption following the image
Simulation results for the case of seven pigs randomly distributed on the map.
Details are in the caption following the image
Simulation results for the case of 12 pigs randomly distributed on the map.
TABLE 5. Percentage savings in step consumption for CASMA compared with other algorithms.
Map number CASMA-ACO CASMA-FA CASMA-PSO CASMA-WPA
Percentage reduction in step consumption (%) Percentage reduction in step consumption (%) Percentage reduction in step consumption (%) Percentage reduction in step consumption (%)
1 5.97 1.56 0.0 3.07
2 8.45 1.51 2.98 9.72
3 9.67 1.75 0.0 0.0
TABLE 6. Percentage savings in processing time consumption for CASMA compared with other algorithms.
Map number CASMA-ACO CASMA-FA CASMA-PSO CASMA-WPA
Percentage savings in processing time (%) Percentage savings in processing time (%) Percentage savings in processing time (%) Percentage savings in processing time (%)
1 16.28 23.01 9.15 4.94
2 9.30 13.10 4.00 5.60
3 14.03 24.22 19.45 8.66

In Map 1, where three pigs are randomly distributed, the performance of the manure-cleaning robot in a map of simple complexity was simulated using five metaheuristic algorithms. All algorithms utilized the same starting point for the robot (coordinates x, y = 9, 9, indicated by a blue dot) and the destination point for waste cleaning (coordinates x, y = 40, 40, indicated by a green dot). CASMA ultimately found an optimal path with a step count of 63, taking a total of 61.227 ms. In comparison with ACO, FA, and WPA, CASMA demonstrated step savings of 5.97%, 1.56%, and 3.07%, respectively, and time savings of 16.28%, 23.01%, and 4.94%, respectively. Compared with PSO, although the step count remained the same, CASMA achieved a time saving of 9.15%.

In Map 2, simulating a map of higher complexity with seven randomly distributed pigs, the path planning performance of five metaheuristic algorithms was evaluated. The robot's initial position in the map was set at x, y = 12, 40, and the waste cleaning point was located at x, y = 42, 6. CASMA ultimately devised a path with a step count of 65, taking 83.441 ms. In comparison with ACO, FA, PSO, and WPA, CASMA demonstrated step savings of 8.45%, 1.51%, 2.98%, and 9.72%, respectively. Time savings were observed at 9.30%, 13.10%, 4.00%, and 5.60%.

In Map 3, where 12 pigs are randomly distributed, the performance of the manure-cleaning robot in a complex environment was simulated using five metaheuristic algorithms. The robot's initial position in the map was set at x, y = 5, 10, and the waste cleaning point was located at x, y = 40, 30. CASMA ultimately devised a path with a step count of 56, taking 83.441 ms. Compared with ACO and FA, CASMA demonstrated step savings of 9.67% and 1.75%, respectively. Time savings were observed at 14.03% and 24.22%, respectively. Although the step count remained the same as PSO and WPA, CASMA maintained an advantage in time consumption, with time savings of 19.45% and 8.66%, respectively.

In summary, the simulation results demonstrate that CASMA holds an advantage over the other four metaheuristic algorithms in both step count and processing time during the path planning process. Detailed data obtained from the aforementioned simulations are presented in Table 7. Figure 10a,b,c depicts the step count and time consumption of each algorithm under the three different maps, whereas Figure 11a,b provides a consolidated comparison of step count and time consumption. Some parameters set during the simulation of the five metaheuristic algorithms are listed in Table 8.

TABLE 7. Detailed data of simulation.
Arithmetic Number of pigs Position of each pig (X, Y-coordinate, size of pig) Coordinates of the robot's location Coordinates of feces Number of steps consumed Processing time (ms) Path (X-axis coordinates) Path (Y-axis coordinates)
CASMA

3

[33,31,9]

[13,14,3]

[25,11,5]

(9,9)

(40,40)

63 61.2278 [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40] [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40]
PSO 63 67.3993 [9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 22, 22, 22, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40] [9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 11, 12, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40]
FA 64 79.5265 [9, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40] [9, 9, 9, 9, 9, 9, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40]
WPA 65 64.4125 [9, 9, 9, 10, 10, 11, 11, 12, 12, 13, 14, 15, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 25, 25, 25, 26, 26, 27, 28, 28, 28, 28, 28, 28, 28, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40] [9, 10, 11, 11, 12, 12, 11, 11, 12, 12, 12, 12, 13, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 26, 27, 28, 28, 29, 29, 29, 30, 31, 32, 33, 34, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 37, 37, 38, 38, 39, 39, 40, 41]
ACO 67 73.1416 [9, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 16, 17, 18, 19, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 29, 29, 29, 29, 29, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 41, 41, 41, 41, 41, 41, 41, 40, 40, 40, 40, 40, 40, 40] [9, 9, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 17, 17, 17, 17, 17, 17, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, 38, 39, 40]
CASMA

7

[11,33,9]

[26,16,5]

[17,9,5]

[17, 22,3]

[25,7,3]

[38,21,5]

[26,35,5]

(12,40)

(42,6)

65 83.4416 [12, 12, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 27, 27, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42] [40, 39, 38, 38, 38, 38, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 24, 24, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 12, 11, 10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]
PSO 67 86.9187 [12, 12, 12, 13, 14, 14, 15, 16, 17, 18, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 27, 27, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42] [40, 39, 38, 38, 38, 39, 39, 39, 39, 39, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 12, 11, 10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,6]
FA 66 96.0231 [12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 27, 27, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 42] [40, 40, 40, 40, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 24, 24, 24, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 9, 9, 9, 9, 9, 9, 9, 8, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6]
WPA 72 88.3926 [12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42] [40, 39, 38, 37, 36, 35, 35, 36, 37, 38, 39, 39, 39, 39, 38, 37, 36, 35, 34, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6]
ACO 71 92.0016 [12, 12, 13, 14, 15, 16, 16, 17, 18, 18, 19, 20, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 29, 30, 31, 31, 32, 32, 32, 33, 34, 35, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 36, 37, 38, 39, 40, 41, 42] [40, 41, 41, 41, 41, 41, 40, 40, 40, 41, 41, 41, 40, 39, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 37, 37, 37, 36, 36, 35, 34, 34, 34, 34, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 6, 6, 6, 6, 6, 6, 6]
CASMA

12

[20,28,9]

[7,5,5]

[16,12,3]

[6,18,3]

[25,7,3]

[26,19,3]

[40,18,3]

[39, 9,7]

[33,29,5]

[9,38,5]

[28,38,3]

[40,40,3]

(5,10)

(40,30)

56 97.4216 [5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 8, 8, 8, 8, 9, 10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25, 26, 27, 28, 29, 30, 31, 31, 32, 33, 34, 35, 36, 36, 36, 36, 36, 37, 38, 39, 40] [10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 17, 18, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 27, 28, 29, 30, 30, 30, 30, 30]
PSO 56 116.8793 [5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 37, 37, 38, 38, 38, 38, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40,40] [10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 17, 17, 18, 19, 20, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,30]
FA 57 128.5698 [5, 5, 5, 5, 5, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, 39, 40, 40] [10, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 30, 30, 30]
WPA 57 106.6587 [5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 13, 13, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 40, 40, 40, 40, 40, 40, 40] [10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 12, 13, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 24, 25, 26, 27, 28, 29, 30]
ACO

62

113.3314

[5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 15, 15, 16, 17, 17, 18, 18, 19, 19, 20, 21, 22, 23, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 30, 30, 30, 31, 32, 33, 33, 34, 34, 35, 36, 36, 36, 37, 38, 39, 40] [10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 19, 20, 20, 20, 21, 21, 22, 22, 23, 23, 23, 23, 23, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 30, 31, 32, 32, 32, 32, 31, 31, 32, 32, 32, 31, 30, 30, 30, 30, 30]
Details are in the caption following the image
Performance statistics of each algorithm under different maps. (a), (b), and (c) respectively illustrate the step count and time consumption of each algorithm under the scenario of three, seven, and 12 randomly distributed pigs on the map. The bar charts represent the number of steps taken for the planned optimal paths, and the line graphs depict the time consumption during the planning process.
Details are in the caption following the image
Statistics on the number of steps and time consumption of each algorithm. (a) and (b) display the optimal path step counts and planning time consumption of the five algorithms under the scenarios of three, seven, and 12 randomly distributed pigs on the map. Specifically, (a) focuses on step counts, and (b) illustrates time consumption.
TABLE 8. Some control parameters.
No. Parameter name Specific parameter value
WPA ACO PSO FA CASMA
1 Number of iterations 500 500 500 500 500
2 Wolf pack size 100 - - - -
3 Contraction factor (walpha) 0.5 - - - -
4 Explore the parameters (wbeta) 0.3 - - - -
5 Number of Ants - 100 - - -
6 Pheromone concentration - 1 - - -
7 Pheromone evaporation rate - 0.5 - - -
8 Number of particles - - 100 - -
9 Inertia weight - - 5 - -
10 Cognitive rate - - 1.5 - -
11 Social rate - 1.6 - -
12 Number of fireflies - - - 100 -
13 Light intensity decay factor (gamma) - - - 1 -
14 Attraction factor (falpha) - - - 0.2 -
15 Number of slime mold populations - - - - 100
16 The proportion of individuals with random number distribution to the total (Z) - - - - 0.3
17 Dimensions - - - - 2

In practical pig farming scenarios, pigs move randomly, necessitating continual adjustment and replanning of the remaining path for the cleaning robot as it navigates the environment. This dynamic process involves responding to changes in pig positions on the map. To evaluate CASMA's performance in real-world settings, a dynamic obstacle experiment was designed and compared against commonly used heuristic algorithms for path planning, namely, A* and TS. TS incorporates neighborhood interaction concepts similar to CA's best neighborhood movement rules and tabu list updates. In the dynamic obstacle experiment, each pig's position within the map changes randomly over time (with random direction and distance of movement). Consequently, the cleaning robot must replan its optimal path with each step it takes, continuing until it reaches the cleaning point (where reaching the point marks one trial). After reaching the cleaning point, the path length covered and the total time consumed for multiple path planning instances are measured for performance comparison. Simulation experiments were conducted on the three maps described in Table 7, each simulating 12 pigs randomly distributed as in Figure 9. The experimental setup and CASMA parameters remained consistent with the previous sections, conducting 500 repeated trials on each map (a total of 1500 trials across the three maps) to ensure the reliability of the results. Figure 12 illustrates the pathfinding process of the robot during the dynamic obstacle experiment. Table 9 presents selected experimental data and the average path planning time and step consumption of CASMA after 1500 trials across the three maps. Figure 13 provides a statistical summary of the results from 500 repeated trials of the three algorithms on map one.

Details are in the caption following the image
Schematic diagram of the path-finding process of the dynamic obstacle experiment robot. In figure (a), the robot plans an optimal path based on its own position, the location of the feces, and the position of the pig using CASMA and moves, in figure (b), the position of the pig changes; at this point, the robot re-adjusts the remaining optimal path information and moves again and repeats it again and again to finally get to the feces location (figure d).
TABLE 9. Partial experimental data and average path planning time and average step consumption statistics for 1500 experimental CASMAs.
CASMA A* TS
Total time consumed for route planning (ms) Total steps consumed (step) Total time consumed for route planning (ms) Total steps consumed (step) Total time consumed for route planning (ms) Total steps consumed (step)

Map 1

Robot location (9,9);

Fecal location (40,40)

18 262.65 256 39 947.33 289 42 379.12 277
17 359.60 238 37 918.58 271 44 308.00 288
20 015.72 269 34 959.95 260 36 910.66 239

Map 2

Robot location (12,40); Fecal location (42,6)

19 550.50 269 36 520.82 268 43 786.29 281
21 551.94 285 39 101.74 287 40 233.78 255
19 978.07 276 41 449.76 301 39 663.90 250

Map 3

Robot position (5, 10); Fecal position (40, 30)

12 385.94 165 21 150.85 173 29 516.10 171
15 569.01 186 29 980.76 208 33 792.86 203
10 816.42 137 19 058.04 171 30 668.22 178
Average consumption over 1500 iterations 16 919.29 237.70 32 710.59 241.92 38 706.78 239.66
Details are in the caption following the image
Statistics on the results of 500 repetitions of the three algorithms in Map 1. Figure (a) counts the total number of steps consumed for each repetition of the experiment, and figure (b) counts the total time consumed, with the x-axis of both images representing the number of repetitions of the experiment.

The experimental results above demonstrate that after 1500 repeated trials, CASMA exhibited an average total time consumption of 16,919.29 ms. Compared with A* and TS, CASMA achieved average time savings of 48.27% and 56.28%, respectively. Regarding total step consumption, CASMA also saved 1.74% and 0.81% compared with A* and TS. These findings indicate that CASMA significantly reduces algorithm response time while ensuring sufficiently short movement paths for the robot. This makes CASMA well-suited for applications in pig farming environments characterized by complexity, variable obstacles, and the need for prompt responses to pig movements.

4 DISCUSSION

4.1 Real-world applicability

To ensure the reliability and accuracy of the data, this study conducted PPOA tests using a robot equipped with the CASMA pathfinding algorithm at a pig farm located in Duan Village, Sengnian Town, Fensixian County, Shanxi Province, China (longitude 111.578407, latitude 36.607231), as a pilot site. The structure of the pilot pig farm is depicted in Figure 14a. The farm is divided into eight distinct areas, each measuring 5 m by 3 m, totaling an area of 120 m2. The testing period spanned from 8:00 a.m. to 8:00 p.m. The 5 m by 3 m pig pens were subdivided into a grid of 25 cm by 25 cm squares, resulting in a total of 20 rows and 12 columns, totaling 240 cells (each cell treated as a unit cell) used for step count statistics. Each time the robot passed through a cell, it was counted as one step. Figure 14b illustrates how cells occupied by pigs on the map are treated as obstacles. All experimental results were calculated using the top-left corner of the pig pen as the origin point O. The workflow of the manure-cleaning robot is depicted in Figure 15, and the final outcomes are presented in Table 10.
  1. Every 3 h, the system initiates a manure-cleaning operation: Cameras positioned above the pigsty automatically record the locations of pig waste and pigs. The position data are then transmitted to the robot, utilizing Xiaomi CW500 devices (model MJSXJ07HL).
  2. Based on positional information, the robot utilizes its onboard cameras and laser rangefinder sensor (model DST700) in conjunction with environmental cameras to collect data, employing the SLAM algorithm for mapping and map building.
  3. Environmental cameras continuously monitor changes in pig positions, facilitating real-time data exchange between the robot's own sensors and its operations, thereby updating pig locations on the map in real time.
  4. Leveraging the current location, positions of pig waste, and pig locations, the robot utilizes CASMA (Cellular Automaton-based Spatial Multi-Agent system) for path planning.
  5. Following the planned path and assisted by laser rangefinders for obstacle detection, the robot iteratively executes steps (3) and (4), adjusting the optimal route to ultimately reach the designated cleaning points.
Details are in the caption following the image
Pilot pig farm structure and map mapping schematic. Figure (a) shows the overall structure of the pilot piggery; the left figure is a perspective view of the structure of the pilot piggery, showing information such as the floor area of the piggery and the installation location of the image acquisition equipment. The right figure is a zoomed-in view of a single pig house extracted from the left figure; figure (b) demonstrates the construction process of the map, in which the single pig house in figure (a) is uniformly partitioned into multiple metacellular lattices, and the metacellular lattices occupied by the pigs in the map are regarded as barriers, that is, grey areas in the figure.
Details are in the caption following the image
Workflow of the manure removal robot. The first two images depict an overhead view of the pilot pig farm and the corresponding captured images, followed by the operational workflow of the robot. Environmental cameras positioned above the pig pens capture and record the positions of pigs and excrement. The robot utilizes its onboard sensors in conjunction with the SLAM algorithm for mapping. Subsequently, the robot initiates movement after invoking CASMA for path planning. The environmental cameras continuously capture and share real-time positional data of identified pigs with the robot. The waste removal robot repeats the CASMA invocation and employs its radar sensors and other supplementary obstacle avoidance measures for precise movement until reaching the excrement location.
TABLE 10. Comparison of actual consumption and simulation results.
8:00 a.m. 11:00 a.m. 14:00 p.m. 17:00 p.m. 20:00 p.m.
Start(2,11)End(19,2) Start(1,1)End(10,5) Start(4,5)End(20,12) Start(3,10)End(18,1) Start(5,5)End(10,9)
Simulated experiment Actual consumption Simulated experiment Actual consumption Simulated experiment Actual consumption Simulated experiment Actual consumption Simulated experiment Actual consumption
Processing time (ms) 106.31 111.58 76.62 81.24 95.55 105.18 99.91 110.56 61.13 69.46
Number of steps consumed 26 31 13 14 23 27 24 27 9 13
  • Note: The results in the table are the first path information planned by the robot after it starts working based on the location of the manure and the location of the pigs in the barn recorded by the environmental camera.

The above test results demonstrate a close correlation between the actual path planning performance of the robot equipped with CASMA and the algorithm's simulated experimental outcomes. This confirms the feasibility and effectiveness of applying CASMA to achieve efficient waste removal operations through shortest path planning for pig excrement-cleaning robots.

4.2 Analysis of economic benefits

Traditional pigsty manure cleaning relies on manual labor, demanding a significant workforce, a challenge exacerbated by urbanization in many countries leading to a sharp decline in agricultural labor. Aging rural labor further compounds this issue. In developed nations, high labor costs render employing large human resources for manure cleaning impractical. For a large pig farm measuring 60–80 m long and 20–30 m wide, employing two to three workers daily for cleaning at $30 USD per person per day totals monthly labor costs of $1800–2700 USD. With the potential application of this research, labor costs become negligible. Regarding equipment expenses, a laser obstacle avoidance radar costs about $280 USD, a camera approximately $40 USD, and networking equipment and workstations totaling about $2485 USD, plus miscellaneous consumables, summing up to around $3452 USD, roughly equivalent to 45 days of labor costs. Overall, although initial investment in adopting a manure-cleaning robot may be higher compared with labor costs, long-term operational expenses are significantly lower.

Furthermore, research indicates significant economic benefits, with a profit of 48.5 RMB per ton of managed pig manure (Shi et al., 2023). For instance, in a medium-sized pig farm with 1000 pigs, each finishing pig produces 2–3 kg of manure daily, resulting in 2–3 tons of manure per day. This translates to daily profits from manure management amounting to 98–145.5 RMB, approximately $13–20 USD. Therefore, this study underscores substantial economic implications.

4.3 Analysis of model limitations

CASMA demonstrates rapid capability in identifying optimal paths to manure-cleaning points within complex real-world pig farm environments. However, applying it to achieve precise feces cleaning with pig farm robots presents a formidable challenge. This challenge primarily arises from CASMA's dependence on the accuracy of the environmental model; deviations or incompleteness in the model can significantly impact algorithm performance. In this study, pigs' presence on the map is represented as obstacle grid cells, without accurately extracting the contours of the pigs themselves. The routes planned by CASMA are contingent upon the partitioning of the map into grid cells of varying sizes and quantities, necessitating further experimental validation of their practical implications. Moreover, despite substantial improvements in convergence speed and search accuracy, the algorithm may still encounter a balance issue between local and global search in environments of unexpected complexity. Additionally, as a metaheuristic algorithm, CASMA involves initial parameter settings, and different parameter configurations can affect the model's actual performance. Optimal parameter selection requires extensive experimental verification. Lastly, there are concerns regarding the algorithm's general applicability. CASMA is designed specifically for the path planning of pig farm cleaning robots, and its suitability for other domains or different problems remains to be further validated.

5 CONCLUSIONS

The presented work introduces an improved slime mold algorithm CASMA, applied to path planning for a robotic swine manure-cleaning system. This algorithm efficiently generates a collision-free optimal path to reach manure-cleaning points in a relatively short time. Three pig group densities, ranging from low to high, are set to simulate the distribution of pigs in real scenarios, using Python for simulation. The simulation results demonstrate that CASMA reduces average step consumption by 8.03%, 1.61%, 0.99%, and 4.26% compared with four metaheuristic algorithms (ACO, FA, PSO, and WPA, respectively) and average processing time by 13.20%, 20.11%, 10.86%, and 6.4%, respectively. Experimental validation with dynamic obstacles confirms that CASMA effectively navigates around moving pigs during actual waste-cleaning tasks, reaching cleaning sites with minimal steps. Furthermore, compared with A* and TS heuristic algorithms, CASMA achieves an average reduction of 48.27% and 56.28% in total path planning time, significantly enhancing the response speed of waste-cleaning robots. In summary, CASMA not only optimizes the optimal path to waste cleaning points but also outperforms other algorithms in terms of minimal cost and computational requirements, establishing a foundation for collision-free path planning of waste cleaning robots in pig farms. This approach effectively reduces or prevents collisions between robots and pigs, maintaining clean pig pens, improving the living environment and welfare of pigs, and enhancing productivity in the meat production industry. Additionally, this study demonstrates the effectiveness of using cellular automata as an enhancement method, combined with metaheuristic algorithms to improve algorithm convergence speed and precision. Future research will further validate CASMA's performance in practical waste cleaning operations, investigate the effects of cell size in map partitioning and different algorithm parameter settings on performance, and explore multimodal fusion methods such as image and infrared integration for environmental recognition, obstacle avoidance, and map establishment in highly complex pigsty environments. Integration of CASMA aims to facilitate rapid and accurate waste cleaning operations by robotic systems in such challenging environments.

CONFLICT OF INTEREST STATEMENT

The authors declare no conflicts of interest for this article.

    The full text of this article hosted at iucr.org is unavailable due to technical difficulties.