1 Introduction

Meta-heuristic algorithms, when compared to traditional optimization methods, distinguish themselves by their simplicity in terms of both comprehension and implementation. Traditional optimization techniques, such as integer programming (Williams 2009), linear programming (Dantzig 2002), mixed programming (Hooker and Osorio 1999), and various constrained optimization methods (Gautier and Granot 1994), are typically designed for well-structured problems. Such problems possess clear structural information, established parameters, and a uniquely identifiable global optimum. These traditional methods are amenable to rigorous evaluation through computational complexity and convergence theories. They are particularly adept at addressing problems characterized by a single extremum. However, their performance can be less than satisfactory in scenarios dominated by multi-extremum challenges.

Conversely, meta-heuristic algorithms, through their astute design, manage to strike a nuanced balance between evading local optima and ensuring convergence to a viable solution. This design feature significantly augments the likelihood of pinpointing the global optimum in an array of optimization contexts. One of the salient characteristics of meta-heuristics is their relative indifference to initial conditions, which reinforces the consistency of optimization outcomes. Their inherent robustness, coupled with domain independence, renders them indispensable in a myriad of practical applications.

Given the pivotal role of optimization across diverse fields, there has been an upswing in the emphasis on metaheuristic techniques (Spall 2005). Various domains have leveraged these methods (Boussaïd et al. 2013; Parejo et al. 2012; Zhou et al. 2011) that operate by generating and refining random solutions iteratively [9]. In stark contrast to traditional methods that necessitate well-defined mathematical models, metaheuristics optimize by varying inputs and scrutinizing the corresponding outputs to maximize or minimize objective functions. This attribute ensures they are less susceptible to ensnarement in local optima compared to their traditional counterparts. Another distinguishing feature of metaheuristics is their adaptability. In a broader context, metaheuristics are categorized according to the extent of random choices they engender during each optimization iteration. Additionally, they can be classed by their foundational inspiration, which could be grounded in swarm intelligence, evolutionary principles, physics, mathematics, or human concepts (Fig. 1).

Fig. 1
figure 1

Categorization of meta-heuristic methods

Evolutionary algorithms, a subset of meta-heuristic techniques, emulate the evolutionary mechanisms observed in nature. Among these, the genetic algorithm (GA) stands out as one of the most renowned. Introduced by Holland (1992), the GA has since garnered extensive attention across various domains, serving as a go-to method for optimization and search problems. Similarly inspired by natural processes, Simon (2008) unveiled the biogeography-based optimization (BBO). This approach taps into the mathematical principles underlying the habitat distribution of life forms. Simon drew parallels between BBO and the evolution of GA and artificial neural networks, particularly emphasizing its prowess in addressing optimization challenges. Storn and Price (1997) contributed to the field in the form of an innovative approach - differential evolution (DE) that promises efficient minimization of complex, potentially nonlinear, and non-differentiable continuous space functions. Their method stands out not only for its rapid convergence and superior certainty over other prevalent global optimization techniques but also for its inherent simplicity and adaptability to parallel computing. Adding to the tapestry of evolutionary algorithms, Jaderyan and Khotanlou (2016) introduced the virulence optimization algorithm (VOA). Inspired by the intricate infection mechanisms employed by viruses, this method involves identifying the fittest viruses, cloning them to amplify infection rates, and judiciously evading already infected zones. When tested against 11 benchmark functions, the VOA showcased its potential as a formidable resource for handling complex optimization conundrums.

Numerous techniques have drawn inspiration from mathematical concepts and physical phenomena, as evident in recent advancements in optimization methods. Rezaei et al. (2023) presented the geometric mean optimizer (GMO), a parameter-free meta-heuristic method grounded in the geometric mean operator. Their research indicated that the GMO excels at tackling a diverse array of optimization challenges, surpassing other contemporary meta-heuristic algorithms in multiple benchmark tests. Similarly, Abualigah et al. (2021) introduced the arithmetic optimization algorithm (AOA). This innovative meta-heuristic method uses mathematical arithmetic operators to optimize across varying search spaces. Through comprehensive evaluation on test functions and applied engineering design tasks, AOA demonstrated superior performance, convergence behavior, and computational complexity compared to eleven other renowned optimization algorithms. Chickermane and Gea (1996) proposed the generalized convex approximation (GCA), a cutting-edge method for structural optimization. By leveraging design sensitivity data, they constructed a series of convex subproblems, which in turn showcased enhanced convergence rates when assessed against standard test problems.

Shifting focus to algorithms inspired by physical phenomena, Mirjalili et al. (2016) introduced the multi-verse optimizer (MVO). This nature-inspired algorithm derives its concepts from cosmological phenomena such as white holes, black holes, and wormholes. Through mathematical modeling of these cosmic events, MVO effectively employs exploration, exploitation, and local search techniques. Kaveh and Mahdavi (2014) have put forward the colliding bodies optimization (CBO) meta-heuristic algorithm, a method underpinned by the principles of one-dimensional collisions. When applied to truss designs with discrete dimension variables, this approach – devoid of the need for parameter tuning and offering a lucid formulation—demonstrated its efficacy in structural optimization. Another intriguing method is the gravitational search algorithm (GSA) introduced by Rashedi et al. (2009). This strategy, inspired by gravity and mass interactions, adopts masses as searcher agents. The research underscores its formidable performance in solving diverse nonlinear functions, especially when pitted against well-established heuristic search methods.

A Kaveh and Siamak Talatahari (2010) proposed the charged system search (CSS) algorithm, which employs principles from electrostatics and Newtonian mechanics. This algorithm demonstrates superior performance in optimization tasks amidst discontinuous or non-convex territories, circumventing the need for gradient information or the smoothness of the search area. Abedinpourshotorban et al. (2016) presented the electromagnetic field optimization (EFO). This physics-inspired optimization technique integrates the golden ratio to dictate attraction-repulsion forces among electromagnetic particles within a tri-field structure. Remarkably, its superiority concerning precision and speed of convergence was evident on the 30 high-dimensional CEC 2014 benchmark problems, outperforming other leading optimization algorithms. Kashan (2015) introduced optics-inspired optimization (OIO) which models numerical optimization processes on the reflective behaviors of concave and convex mirrors, yielding a competitive and parameter-efficient method for solving complex optimization problems.

Human concepts have increasingly become a source of inspiration for metaheuristic techniques, leading to the development of novel optimization methods that mimic various human activities and thought processes. Reynolds (1994) presented a computational model for cultural evolution, which employs dual inheritance within a population of individuals characterized by specific behavioral traits and a collective “belief space”. This model is accelerated by GA and version spaces, which serve to enhance learning rates within the structure of the cultural algorithm. Rao et al. (2011) introduced the teaching–learning-based optimization (TLBO). This method, which is inspired by the pedagogical effect of a mentor on learners, proves effective for mechanical design problems. In a series of test cases and real-world applications, TLBO showcased performance superiority over other population-based optimization algorithms. Gandomi (2014) unveiled the interior search algorithm (ISA), a unique optimization technique that takes inspiration from the art and craft of interior design. Noteworthy is its simplicity, requiring tuning of just one parameter. The ISA stands out for its capability to solve optimization challenges, surpassing established algorithms in benchmark tests.

In a blend of music, Lee and Geem (2005) presented the harmony search (HS) method. Drawing inspiration from the musical process of seeking harmony, this method sets itself apart by not relying on gradient information. The research evidences the robustness and effectiveness of HS in addressing diverse engineering optimization problems, often delivering solutions that may surpass those derived from traditional algorithms. Sadollah et al. (2013) have proposed the mine blast algorithm (MBA), an innovative population-based optimization method influenced by the explosive dynamics of mine blasts. The results obtained from their research underscore the algorithm’s efficiency and its exceptional performance in addressing both constrained optimization and engineering design tasks, especially when juxtaposed against well-established optimization methods. Kashan (2014) introduced the league championship algorithm (LCA). This method simulates a sporting championship environment, where artificial teams vie for dominance in a league. Teams adapt their strategies or solutions based on game results, while also modeling player transfers at season’s end. Empirical analysis conducted on a variety of benchmark functions showcases its promising performance, hinting at its potential suitability for practical applications in the future.

In recent years, metaheuristic techniques that draw inspiration from animal behavior have garnered significant attention from researchers, as highlighted in Table 1. Kennedy and Eberhart (1995) presented the concept of optimizing nonlinear functions through the particle swarm optimization (PSO) technique. Their research delved into the evolution of different paradigms within this approach, executed one such paradigm, and subjected it to benchmark tests. They further identified potential applications, notably in nonlinear function optimization and neural network training. Gandomi et al. (2013) presented the cuckoo search (CS) metaheuristic optimization algorithm, which is enriched by Lévy flights. Through comprehensive testing on benchmark nonlinear constrained optimization tasks and structural engineering design challenges, CS demonstrated a distinct edge over other cutting-edge techniques. The authors also emphasized its unique search features, positioning it as a valuable subject for future research endeavors. Seyyedabbasi and Kiani (2023) introduced the sand cat swarm optimization (SCSO) algorithm. Drawing inspiration from the survival strategies of sand cats, SCSO proves adept at solving optimization challenges by skillfully balancing exploration and exploitation phases. The algorithm’s exceptional performance, evident in benchmark tests and intricate engineering design problems, places it a notch above other metaheuristic competitors.

Chen et al. (2022) unveiled the egret swarm optimization algorithm (ESOA), an inventive meta-heuristic technique influenced by the hunting behaviors of two egret species. Across an array of benchmark functions and engineering challenges, ESOA showcased its marked effectiveness and robustness, often overshadowing other optimization algorithms. Abualigah et al. (2021) brought to light the Aquila optimizer (AO), a metaheuristic method that mirrors the predatory strategies of Aquila birds. Their work delineates four distinct methods that reflect the bird’s hunting strategies. The AO algorithm underwent rigorous validation, with tests on renowned functions, the intricate CEC2017 and CEC2019 functions, and real-world engineering scenarios. Mirjalili et al. (2017) introduced the salp swarm algorithm (SSA) and its multi-objective counterpart (MSSA), inspired by salps’ swarming patterns, and validated their effectiveness on mathematical and applied engineering design tasks, showcasing their ability to efficiently converge to optimal solutions and approximate Pareto fronts. Bansal et al. (2014) introduced the spider monkey optimization (SMO) method, an innovative approach to numerical optimization inspired by the adaptable hunting behaviors of spider monkeys, animals known for their fission-fusion social dynamics.

The behavior of spiders in addressing optimization challenges has also inspired the development of metaheuristics and is applied in various fields. Cuevas et al. (2013) introduced the social spider optimization (SSO) technique, inspired by the cooperative interactions of social spiders, featuring distinct evolutionary operators for male and female agents, and exhibits high proficiency in locating global optima on various benchmark functions. Ouadfel and Taleb-Ahmed (2016) explored the effectiveness of the flower pollination (FP) and SSO method in image segmentation through multilevel thresholding, demonstrating that while both outperform the PSO and BAT algorithms, SSO maintains superior stability and efficiency across various threshold numbers, making it a compelling choice for complex image thresholding tasks. Ewees et al. (2017) presented an enhanced adaptive neuro-fuzzy inference system (ANFIS) optimized using the SSO algorithm for forecasting biochar yield from manure pyrolysis, showcasing superior performance over classical ANFIS and other methodologies such as artificial bee colony, PSO, and least square-support vector machine. Nguyen and Vo (2020) introduced an improved SSO technique that enhances the solution generation process for optimal reactive power dispatch problems, demonstrating reduced computational steps and parameters, faster simulation times, and consistently superior solution quality when benchmarked against standard SSO and other leading methods.

In an independent study, James and Li (2015) unveiled a novel social spider algorithm (SOSA) for global optimization. This algorithm uniquely harnesses web vibrations, which social spiders use to locate prey, deviating from conventional swarm intelligence strategies and showing superior results in benchmark assessments. SOSA has been applied in a variety of fields. For instance, Elsayed et al. (2016) presented a modified version of SOSA to address the non-convex economic load dispatch task, which includes real-world restrictions like valve point impacts and prohibited operating areas. The enhanced algorithm demonstrates improved performance across four benchmark systems, surpassing the original SOSA and displaying a competitive advantage in the existing literature. El-Bages and Elsayed (2017) presented an SOSA model for static transmission expansion planning that provides cost-effective solutions, validated on benchmark systems with varying degrees of complexity. Baş and Ülker (2020) introduced a binary version of SOSA, augmented with similarity measures and logic gates, and their results indicate superior performance in solving unimodal, multimodal, and uncapacitated facility location problems when compared with traditional algorithms.

Table 1 A summary of swarm-based algorithms

The evolution and enhancement of existing algorithms have become a focal point for researchers in recent years. The thrust to augment existing algorithms for emerging challenges has driven significant academic interest. Kaveh and Talatahari (2010a) brought forth an advanced version of the ant colony optimization (ACO), termed the improved ACO. Crafted for constrained engineering design challenges, this approach deftly manages both continuous and discrete problems. Central to its design is the sub-optimization mechanism (SOM), inspired by finite element principles, which efficiently trims down pheromone matrices, decision vectors, function evaluations, and optimization durations without jeopardizing the likelihood of pinpointing optimal solutions. Chakraborty et al. (2009) embarked on refining the harmony search (HS) algorithm, which finds its muse in musical improvisation. Their method hybridizes HS with the differential evolution (DE) algorithm, aiming to mitigate slow and premature convergence challenges on intricate fitness terrains. Performance metrics of this hybrid were juxtaposed against classical HS, global best HS, and a renowned DE variant. Assessments were made across diverse benchmark functions and practical optimization challenges, based on criteria like precision, computational pace, and consistency in reaching optima.

Son and Nguyen Dang (2023b) showcased a composite model named the hybrid multi-verse optimizer (hDMVO), which integrates MVO and the sine cosine algorithm (SCA). This model is adept at managing discrete time-cost trade-off (TCTO) quandaries in construction project orchestration. Its prowess shines through benchmark evaluations and its knack for devising superior solutions in large-scale TCTO scenarios for intricate projects. Abd Elaziz et al. (2017) unveiled an augmented SCA, enriched with opposition-based learning (OBL). This enhancement broadens the exploration horizon of the search domain, leading to heightened precision and overall performance. Its efficacy is evident from benchmark evaluations and complex engineering tasks, underscoring the value of this synergistic approach. Pham, Trang, et al. (2023) articulated a proficient scheduling optimization technique for ready-mix concrete (RMC) truck dispatches. At its core is a novel hybrid swarm intelligence algorithm fusing the grey wolf optimizer (GWO) with the dragonfly algorithm (DA). The resultant algorithm excels in performance compared to its standalone counterparts and heralds a leap in multi-independent batch plant cooperation for refined RMC deliveries in construction sectors.

In recent years, optimization techniques have found widespread applications across diverse fields. Pham, Nguyen Dang, et al. (2023) introduced an enhanced SCA that integrates roulette wheel selection with OBL, demonstrating superior performance over traditional optimization algorithms in various engineering optimization contexts. Son and Nguyen Dang (2023a) presented the MVO model as an effective tool for addressing time–cost optimization issues in construction project management, surpassing other techniques in small-scale applications. Kumar et al. (2023) unveiled the multi-objective MVO, a dual-archive metaheuristic tailored for complex structural optimization, and illustrated its superior performance in real-world applications over leading algorithms such as MOEA/D and NSGA-II through comprehensive evaluations employing established performance metrics. Aye et al. (2023) introduced an innovative surrogate-aided optimization approach for enhancing airfoil shapes, incorporating both CFD and XFoil simulations. This method demonstrated superior performance in comparison to conventional surrogate-assisted techniques.

Nonut et al. (2022) advocated for the application of metaheuristics in the system identification of fixed-wing UAVs by optimizing aerodynamic and stability derivatives to minimize R-squared errors, with the L-SHADE algorithm proving to be the most effective method through extensive statistical analysis. Singh et al. (2022) unveiled an improved follow-the-leader (iFTL) technique, inspired by the foraging behaviors of sheep. Comprehensive testing within the Comparing Continuous Optimisers framework, alongside a suite of benchmark functions and truss design problems, revealed that iFTL outperforms fourteen well-established optimization algorithms in terms of performance and stability. In another study, Kumar et al. (2022) enhanced the efficacy of discrete meta-heuristics for truss design by incorporating both a random mutation search phase and selection based on simulated annealing into five pre-existing algorithms. The resultant modifications led to improved search diversification and intensification, yielding superior optimization results in complex structural engineering challenges. Kumar, Tejani, Pholdee, Bureerat, et al. (2022) introduced a groundbreaking multi-objective TLBO method. This novel approach incorporates non-dominated sorting and an external archive, adeptly mitigating early convergence and preventing local optima entrapment in multi-objective contexts.

Recent trends in algorithmic research spotlight both the inception of new algorithms and the refinement of pre-existing ones. The burgeoning interest in this area owes much to the No Free Lunch (NFL) theorem (Wolpert and Macready 1997), which posits that no single optimization technique can universally address all optimization challenges.

In light of the NFL theorem, this study introduces the Portia spider algorithm (PSA), inspired by the predatory strategies of the Portia spider. The PSA’s efficacy was rigorously assessed using a suite of benchmarks: 23 classical test cases, 29 CEC2017 benchmark test functions, and five practical engineering optimization tasks. The algorithm’s performance was then benchmarked against a collection of established meta-heuristic algorithms.

The primary attributes and contributions of the PSA include:

  • Absence of any tunable parameters.

  • An agile adjustment of solution positions, grounded in the spider’s stalking and striking hunting behaviors, fostering expansive exploration and ensuring robust population diversity.

  • The updating of solution positions, blending the stalking and striking tactics (exploration phase) with the invading and imitating tactics (exploitation phase), which harmonizes the exploration and exploitation phases.

The subsequent sections of this study are structured as follows: Sect. 2 introduces a comprehensive framework for the PSA. In Sects. 3, 23 classical and 29 CEC2017 test functions were employed to probe the convergence properties of the PSA. Section 4 evaluates the real-world applicability of the PSA through five engineering optimization scenarios. Finally, Sect. 5 summarizes the findings, spotlighting the study’s novel contributions, and signposting avenues for prospective research in this domain.

2 Portia spider algorithm

2.1 Inspiration

Over 48,000 unique spider species coexist on our planet. Much like humans who have evolved to inhabit diverse environments over millennia, spiders have undergone adaptations spanning millions of years. These adaptations have produced species ranging from fishers to desert inhabitants, high-altitude enthusiasts, and astute strategists like the Portia spider. The Portia spider primarily resides in tropical forests, typified by their humid and warm climate. Intriguingly, this spider preys on various other spiders, some of which possess the ability to turn the tables on the predator-prey relationship (Robson 2020).

On an average hunting day, a Portia spider might discreetly stalk another jumping spider or cautiously venture into the web of an orb-weaving spider. Both pursuits come with risks, as the spiders Portia targets can invert the prey-predator dynamic, posing a threat to Portia. The necessity to confront such hazardous scenarios for sustenance has likely sculpted Portia into a master strategist.

Fig. 2
figure 2

Portia spider

One of the most notable strategies employed by the Portia spider (Fig. 2) becomes apparent when it detects chemical signals from a fellow jumping spider. Even devoid of direct visual cues, the Portia ascertains the presence of its quarry through these chemical indicators. In response to this chemical intelligence, the Portia adjusts its customary movement, initiating an abrupt leap to momentarily divert the attention of the observant jumping spider. This fleeting action momentarily breaks the latter’s camouflage, betraying its location. With calculated patience, the Portia waits for its target to divert its attention before drawing nearer, primed for its climactic strike (Jackson and Wilcox 1998).

Additionally, Portia spiders employ another strategy: invading the webs of other spiders. To lure their prey, they imitate the vibrations of an ensnared insect by disturbing the web (Cross and Jackson 2005) (Fig. 3a). Yet, many web-spinning spiders seem to have decoded this tactic, making discreet stalking frequently a more successful approach. Observations have revealed that Portia spiders occasionally capitalize on natural web vibrations caused by ambient breezes. If circumstances necessitate, they can even produce these vibrations independently. Researchers documented higher prey capture success rates for Portias in environments where webs were intermittently perturbed, compared to scenarios with static webs. At times, when the direct vibratory mimicry falls short in attracting prey, the Portia spider opts for an alternate approach, positioning a silk dragline directly above the web, and then pouncing once in close proximity to its target (Fig. 3b).

Fig. 3
figure 3

Portia spiders’ hunting behavior when invading the webs of other spiders

Distinctly, while many predators employ natural elements for camouflage or utilize environmental facets for stealth, Portia spiders display a novel behavior, serving as the first documented instance where an organism effectively creates its own diversion. The ingenuity of Portia spiders extends to adaptive learning during hunts. They engage in intricate signaling on their prey’s web, dynamically adjusting their methods based on observed responses. This indicates a trial-and-error approach in their hunting style. Occasionally, upon detecting prey from afar, Portia spiders adopt an indirect route, often embarking on journeys lasting up to two hours, showcasing their aptitude for strategic anticipation.

This particular species appears to determine its approach or web signal for a specific target spider through a sophisticated process of trial and error, enhanced by cues from the prey or its web. The signaling tactics of Portia continuously evolve until the targeted prey inadvertently responds, often sealing its fate. Such behaviors exemplify a problem-solving acumen seldom seen among spiders. It is this unparalleled hunting aptitude that inspired the development of the Portia spider algorithm (PSA).

2.2 Mathematical model

In the PSA framework, the behaviours and strategies of the Portia spider are abstracted and transformed into a computational model. Here, each individual Portia spider is treated as a unique solution to a given problem. The specific location or position of each spider (or solution) is defined by a set of variables, potentially representing different parameters or attributes of the solution.

To visualize and manage these solutions, they are organized within a matrix. In this matrix, every row could represent an individual Portia spider (or a solution) while every column could correspond to a specific variable or parameter of the solution:

$$\varvec{S}=\left[\begin{array}{ccc}\begin{array}{cc}{s}_{1}^{1}& {s}_{1}^{2}\end{array}& \dots & {s}_{1}^{d}\\ \begin{array}{cc}{s}_{2}^{1}& {s}_{2}^{2}\end{array}& \dots & {s}_{2}^{d}\\ \begin{array}{cc}\begin{array}{c}\dots \\ {s}_{N}^{1}\end{array}& \begin{array}{c}\dots \\ {s}_{N}^{2}\end{array}\end{array}& \begin{array}{c}\dots \\ \dots \end{array}& \begin{array}{c}\dots \\ {s}_{N}^{d}\end{array}\end{array}\right]$$
(1)

In Eq. (1), the variable N stands for the number of Portia spiders, equating to the population size, while d denotes the parameters associated with the optimization issue. This matrix provides a holistic representation of all possible solutions along with their specific attributes. Over the course of the algorithm, the positions of the Portia spiders (which represent solutions) may alter, indicating the optimization or evolution of the solution toward the problem’s objective. The fitness scores of these spiders are then ranked and compiled into a vector according to the following expression:

$$\varvec{S}=\left[\begin{array}{c}F\left({S}_{1}\right)\\ F\left({S}_{2}\right)\\ \dots \\ F\left({S}_{N}\right)\end{array}\right]$$
(2)

Besides the Portia spiders, the prey is pivotal to the PSA framework. As outlined in Eq. (2), the prey vector represents the optimal solution identified up to that point. All Portia spiders orient their movement relative to this prey. The position of the prey is detailed in Eq. (3).

$$\varvec{T}=\left[{t}_{1} {t}_{2}\dots {t}_{d}\right]$$
(3)

The movement of the Portia spiders, oriented relative to their prey, is crucial for obtaining optimal results. By emulating the hunting strategies of the Portia spider, the PSA can adaptively explore the solution space. This approach enables the algorithm to use trial-and-error and adjust strategies based on feedback, mirroring how Portia spiders modify their hunting techniques in response to their prey’s behaviors. In subsequent sections, the mechanism for updating positions in the PSA is detailed, encompassing both the stalking and striking actions (during the exploration phase) as well as the invading and imitating actions (during the exploitation phase).

2.2.1 Stalking and striking (exploration phase)

This stage is inspired by the hunting strategies of the Portia spider, especially its reaction to chemical signals from another jumping spider (Fig. 2). When these signals are detected, the Portia spider momentarily deviates from its typical waddling gait, executing what can be described as a spontaneous jump. This sudden move induces the prey to break its camouflage, inadvertently revealing its position to the Portia spider. This observed behavior is then translated into the following mathematical formulation:

$${s}_{ij}^{t+1}=\left\{\begin{array}{c}{t}_{j} { if \alpha }_{1}<SF\left({S}_{i}\right)\\ {s}_{ij}^{t} {if \alpha }_{1}\ge SF\left({S}_{i}\right)\end{array}\right.$$
(4)

subject to:

$$SF\left({S}_{i}\right)=\frac{F\left({S}_{i}\right)}{\sqrt[2]{\sum _{1}^{N}{F\left({S}_{i}\right)}^{2}}}$$
(5)

where tj symbolizes the jth parameter of the prey (which is the best solution identified up to this point); sij denotes the jth parameter of the ith solution; α1 is a random value that falls between 0 and 1; NF(Si) and F(Si) correspond to the standardized fitness score and the actual fitness score of solution Si, respectively.

This mechanism triggers sudden variations, promoting a more extensive search or exploration and ensuring population diversity. In optimization techniques, striking a balance between exploration and exploitation is crucial. While exploitation focuses on refining solutions within a localized region, exploration delves into uncharted areas of the solution landscape in search of superior alternatives. This concept parallels the crossover technique in GA, which emphasizes thorough traversal of the search domains.

Fig. 4
figure 4

PSA exploration and exploitation concept

2.2.2 Invading and imitating (exploitation phase)

This phase is inspired by a unique hunting strategy displayed by the Portia spider: the act of encroaching upon the webs of other spiders. In this behavior, the Portia spider sneaks into the webs of other spiders and lures its prey by producing web vibrations. These vibrations mimic the movements of a trapped insect (Fig. 3a). While the Portia spider sometimes takes advantage of naturally occurring vibrations in the web, like those caused by a gentle breeze, it is also skilled at producing these vibrations on its own when necessary. This intriguing natural behavior is translated into the subsequent mathematical model, which draws inspiration from the vibration function that incorporates damping:

$${s}_{ij}^{t+1}={t}_{j}^{t}+\left|{{\alpha }_{2}t}_{j}^{t}-{s}_{ij}^{t}\right|\times {e}^{{\alpha }_{3}}\times \text{cos}\left({2\pi \alpha }_{4}\right)$$
(6)

However, many web-weaving spiders seem to have caught on to these tricks. When simple vibrational mimicry fails to attract the prey, the Portia spider employs an alternative strategy. It attaches a silk dragline just above the web and descends cautiously, stopping only when it’s within striking distance of its intended prey (Fig. 3b). With this hunting method, Portia spiders engage in direct pursuit of their prey, foregoing the mimicry of movements characteristic of trapped insects. This observed behavior is captured in Eq. (7), wherein the current solution position is adjusted directly based on the optimal solution identified up to that point, a strategy that differs from the solution position modification presented in Eq. (6).

$${s}_{ij}^{t+1}={t}_{j}^{t}+{\alpha }_{2}\times \left({t}_{j}^{t}-{s}_{ij}^{t}\right)$$
(7)

These two equations Eq. (6) and Eq. (7) are combined to be used as follows:

$${s}_{ij}^{t+1}=\left\{\begin{array}{c}{t}_{j}^{t}+\left|{{\alpha }_{2}t}_{j}^{t}-{s}_{ij}^{t}\right|\times {e}^{{\alpha }_{3}}\times \text{cos}\left({2\pi \alpha }_{4}\right) {\alpha }_{5}<0.5\\ {t}_{j}^{t}+{\alpha }_{2}\times \left({t}_{j}^{t}-{s}_{ij}^{t}\right) {\alpha }_{5}\ge 0.5\end{array}\right.$$
(8)

subject to:

$${\alpha }_{3}=1-{\left(\frac{{I}_{cur}}{{I}_{max}}\right)}^{2}$$
(9)

where tj represents the jth parameter of the prey (the best solution identified thus far); sij denotes the jth parameter of the ith solution; α2, α4 and α5 are random values within the range [0,1]; α3 is determined by Eq. (9) ensuring a harmony between the exploration and exploitation phases. Icur and Imax denote the current and the maximum iteration number, respectively.

Table 2 Pseudocode of the PSA

Specifically, Table 2 presents the PSA algorithm in the form of pseudocode. This structured breakdown elucidates the algorithm’s step-by-step progression, allowing readers to intuitively understand its logic and sequence of operations. Furthermore, Fig. 4 depicts the exploration and exploitation mechanisms of the PSA. A mathematical model inspired by the stalking and striking behavior of the Portia spider, as expressed in Eq. (5), induces abrupt changes in the solution position to enhance exploration (see Fig. 4a). In contrast, a model derived from the invading and imitating behavior typical of the Portia spider, detailed in Eq. (8), refines the solution position to foster exploitation (refer to Fig. 4b). Complementing these models, Fig. 5 presents a flowchart that succinctly outlines the PSA framework.

Fig. 5
figure 5

Flowchart of the PSA

2.3 Differences between PSA and other spider-inspired algorithms

In recent years, the field has seen the emergence of numerous swarm intelligence algorithms, inspired by the collective behavior observed in nature. Prominent among these are social spider optimization (SSO) (Cuevas et al. 2013) and social spider algorithm (SOSA) (James and Li 2015), which are metaheuristic algorithms that mimic spider behavior. While PSA also draws inspiration from spider behavior, it diverges significantly from SSO and SOSA in various aspects of its operational methodology and design principles.

The divergence between PSA and SSO originates from their respective sources of inspiration and intricacies of design. SSO takes cues from the sophisticated mating behavior of social spiders, incorporating a system of gender distinction into its search strategy. This model allows male and female agents within the algorithm to undertake unique roles and engage in distinct search behaviors. In contrast, PSA takes a cue from the isolated foraging patterns of the Portia spider. By discarding gender distinctions, all agents in PSA adhere to a uniform search approach, which simplifies the algorithm’s application.

The strategies to ensure diversity in solutions also show significant differences. SSO employs a mating algorithm, simulating mate selection to generate a range of solutions akin to the genetic diversity found in spider populations. Conversely, PSA uses mathematical models to abstract the predatory behavior of Portia spiders, such as stalking and striking, to introduce significant and strategic variations in the search patterns of the algorithm, as detailed in Eq. (5). This approach bolsters the exploratory capabilities of the algorithm, allowing for more effective navigation through complex search spaces.

While PSA and SOSA both emulate spider predatory behavior, they diverge in operational mechanisms. SOSA is based on the social behavior of spiders, using web vibrations to pinpoint the location of prey. In contrast, PSA takes cues from the Portia spider hunting strategy, which involves simulating the vibrations of trapped insects to attract other spiders, with the mathematical model for this behavior expressed in Eq. (6). Additionally, the solution position adjustment mechanism in PSA is more varied. When vibrational mimicry fails in attracting prey, the Portia spider employs an alternative strategy: it attaches a silk dragline above the web and descends cautiously, stopping when it is within striking distance of its prey, as modeled in Eq. (7).

Furthermore, PSA also introduces abrupt changes in the solution position to enhance exploration, like the crossover technique in GA which greatly expands exploration of the search space. This exploratory mechanism, inspired by the Portia spider’s stalking and striking behavior, is expressed mathematically in Eq. (5). In terms of algorithm parameters, PSA operates without the need for tunable parameters, which simplifies its implementation. On the other hand, SOSA uses three user-controlled parameters, named ra, pc, and pm, to steer the search process.

3 Convergence analysis

In the context of optimization, especially when considering evolutionary algorithms and metaheuristics, demonstrating algorithmic efficiency relies on the application of predefined test cases. Given the intrinsically stochastic attributes of these methodologies, the attainment of optimal outcomes mandates the deployment of a meticulously curated test function suite. It remains quintessential to ascertain that any discerned enhancements are not merely manifestations of stochastic variance. Presently, the field is devoid of a universally endorsed benchmarking paradigm, thus driving scholars to delve into an extensive assortment of test instances. Considering this, the present investigation encompasses an eclectic compilation of test functions, integrating 23 classical test cases and the CEC2017 test functions, with diverse traits, to facilitate an exhaustive appraisal of algorithmic prowess.

3.1 Classical test functions

The efficacy of PSA was thoroughly evaluated using a diverse set of twenty-three test functions (Yao et al. 1999), segmented into three unique categories: unimodal, multimodal, and composite functions, as detailed in Table 3. The unimodal functions, which are defined by a singular global optimum devoid of local optima, serve to gauge the algorithm’s proficiency in rapid convergence and effective exploitation. In contrast, the multimodal functions encompass several local optima alongside a global optimum. They present an opportunity to assess the algorithm’s capability to navigate beyond local optima and explore the search terrain comprehensively. Lastly, the fixed functions are derived by strategically modifying certain unimodal and multimodal functions through methods such as rotation, shifting, and the introduction of bias. These functions play a crucial role in dissecting PSA’s performance under intricate optimization circumstances.

Table 3 23 classical benchmark test function data

To evaluate the optimization capability of PSA, a cohort of 25 search agents was deployed across 500 iterations, with the aim of identifying the optimal solution that PSA could determine from the group of 23 test functions. The efficacy of PSA was contrasted with several other prominent population-based optimization algorithms, namely SSA, GOA, MFO, and ALO. Given the stochastic nature of these methodologies, each technique was executed 30 times to affirm the reliability and consistency of outcomes. Central statistical metrics, particularly mean values (avg) and standard deviations (std) were calculated and presented in Table 4. This table offers a comprehensive analysis of the performance metrics for each algorithm.

Table 4 Results of different algorithms on classical benchmark test functions

From the data presented in Table 4, PSA surpasses other metaheuristic techniques when evaluated on unimodal test functions. Specifically, PSA demonstrates a remarkable aptitude for exploitation, consistently surpassing benchmark techniques such as SSA, GOA, MFO, and ALO. This underscores the prowess of PSA in tackling unimodal optimization tasks. Further, within the realm of multimodal functions, the performance of PSA is exemplary, often besting other competing techniques. This is indicative of its superior ability to comprehensively explore the search terrain, thereby avoiding premature convergence to local optima. Upon delving into the fixed function tests, the performance of PSA aligns closely with the average achievements of other algorithms. It is noteworthy that, in the context of functions f14 to f21, PSA remains competitive with SSA, GOA, MFO, and ALO. However, its superiority becomes more pronounced for functions f22, and f23, where PSA emerges as the leader. Collectively, these results underscore the commendable expertise of PSA when juxtaposed against other contemporary optimization methods.

Table 5 T-test results on 23 classical test functions

To assess the statistical significance of performance disparities between the PSA and other well-established algorithms on classical test functions, a t-test was conducted with a 95% confidence level. The outcomes of this t-test are detailed in Table 5. In this table, a “+” symbol indicates that the PSA holds a statistically significant advantage over the comparison method at the 95% confidence level, a “-” symbol shows that the PSA performs significantly worse, and “≈” denotes no significant difference in performance between the techniques. It is revealed by the data in Table 5 that superior performance is exhibited by the PSA across most of the classical test cases when compared to other techniques such as GOA, SSA, MFO, and ALO.

Fig. 6
figure 6

Search history, convergence curve, average fitness of all solutions and trajectory of the first solution

Additional evaluation measures, such as the convergence curve, mean fitness across all solutions, trajectory of the first solution, and search history, were employed to assess the effectiveness of PSA. For this analysis, 250 iterations with 20 search agents were used across three categories of test functions: unimodal (f1, f4, f7), multimodal (f9, f12), and specific functions (f15, f17, f23), as presented in Fig. 6. Upon examining the convergence graph and average fitness value, a discernible decline in the quality of search agents emerges as the iterations advance. This trend highlights the capacity of PSA to improve the quality of initially randomized solutions tailored to specific optimization challenges. The trajectory of the first solution underscores the adeptness of PSA in ensuring convergence during a localized search. This proficiency is further illuminated by marked variations in mean fitness value during the discovery phase, followed by minor adjustments in the refinement phase (Van den Bergh and Engelbrecht 2006). Furthermore, the search history associated with these functions underscores the robust efficiency of PSA in navigating the exploration domain and pinpointing areas of promise. Figure 7 subsequently delves into the convergence patterns observed in the 23 classical test functions, analysed over a span of 150 iterations with the assistance of 20 search agents. From this data, the superiority of PSA becomes clear, especially when benchmarked against other techniques such as SSA, GOA, MFO, and ALO. PSA consistently demonstrates superior convergence performance primarily in the considered test functions.

Fig. 7
figure 7figure 7

Convergence behavior of PSA, GOA, SSA, MFO, and ALO for classical test functions

3.2 CEC2017 benchmark test functions

The CEC2017 test functions comprise a set of benchmark functions introduced during the 2017 IEEE Congress on Evolutionary Computation (CEC) competition, with a primary focus on real-parameter optimization. Held in high regard within the evolutionary computation community and associated domains, these benchmarks serve as instrumental tools for gauging and contrasting the effectiveness of optimization techniques. Building upon the benchmark suites from preceding years, the CEC2017 collection has been meticulously tailored to offer a diverse range of challenges to optimization techniques. Notably, these functions are perceived as more realistic compared to the 23 traditional benchmark functions. Their comprehensive scope includes both unimodal and multi-modal domains, embracing both separable and non-separable functions. Furthermore, they incorporate shifted and rotated variations, providing a thorough testbed for algorithms. Such a diverse set of test cases allows researchers to discern the merits and demerits of various optimization techniques across different settings.

Table 6 CEC2017 benchmark function data

In line with this discussion, the effectiveness of PSA is validated using the IEEE CEC2017 (Wu et al. 2017) test suites. These suites are primarily classified into four different classifications: unimodal, multimodal, hybrid, and composition. Table 6 delineates the detailed definitions of the CEC2017 benchmark problems. To rigorously evaluate the capability of the PSA in handling complex optimization problems, all functions within the CEC2017 suite were configured to have 30 dimensions. This increase in dimensionality presents a more challenging scenario, aimed at thoroughly testing the algorithm’s proficiency in navigating and optimizing within a high-dimensional search space.

Table 7 Results of different algorithms on classical benchmark test functions

Table 7 presents comprehensive statistical results comparing the PSA with other swarm-based methods, including GOA, SSA, MFO, and ALO. To guarantee a thorough and unbiased assessment, each technique was subjected to 30 runs for every benchmark function. Following these simulations, statistical evaluations were conducted to ascertain both the mean values (avg) and the standard deviations (std) from these trials. For this study’s framework, 50 search agents were employed, with each confined to a limit of 400 iterations. An examination of the data in Table 7 clearly demonstrates the outstanding effectiveness of PSA over other techniques like GOA, SSA, MFO, and ALO, particularly in the multimodal, hybrid, and composition benchmark domains.

Table 8 T-test results on CEC2017 test functions

A t-test, conducted with a 95% confidence level, was employed to evaluate the statistical significance of performance disparities between the PSA and other established algorithms on the CEC2017 test functions, similar to the methodology applied to classical test cases. The results of this t-test are detailed in Table 8. The data in Table 8 reveal that the PSA exhibits superior performance across most of the CEC2017 test cases when compared to other techniques such as GOA, SSA, and ALO. Notably, the PSA outperformed the MFO in all CEC2017 test cases.

4 Engineering optimization problems

The objective of this section is to thoroughly evaluate the effectiveness of the PSA by applying it to five practical engineering optimization challenges, each distinguished by multiple inequality constraints. The overarching goal is to ascertain the algorithm’s adeptness in handling these constraints throughout the entire optimization process.

4.1 Tension string design task

The primary objective of this task is to minimize the weight of the tension string. Key variables in this pursuit include the wire diameter (d), the mean coil diameter (D), and the number of active coils (n), each clearly illustrated in Fig. 8. A detailed mathematical representation of this challenge is provided as:

Fig. 8
figure 8

Tension string design task

Consider:

$$\overrightarrow{\varvec{x}}=\left[{x}_{1}{ x}_{2} {x}_{3}\right]=\left[d D N\right]$$

Minimize:

$$f\left(\overrightarrow{x}\right)=\left({x}_{3}+2\right){x}_{2}{x}_{1}^{2}$$

Subject to:

$${g}_{1}\left(\overrightarrow{x}\right)=1-\frac{{x}_{2}^{3}{x}_{3}}{71,785{x}_{1}^{4}}\le 0$$
$${g}_{2}\left(\overrightarrow{x}\right)=\frac{4{x}_{2}^{2}-{x}_{1}{x}_{2}}{12,566({x}_{2}{x}_{1}^{3}-{x}_{1}^{4})}+\frac{1}{5108{x}_{1}^{2}}\le 0$$
$${g}_{3}\left(\overrightarrow{x}\right)=1-\frac{140.45{x}_{1}}{{x}_{2}^{2}{x}_{3}}\le 0$$
$${g}_{4}\left(\overrightarrow{x}\right)=\frac{{x}_{1}+{x}_{2}}{1.5}-1\le 0$$

Variable range:

$$0.05\le {x}_{1}\le 2.00$$
$$0.25\le {x}_{2}\le 1.30$$
$$2.00\le {x}_{3}\le 15.0$$

Results from the comparative analysis of PSA with established algorithms, in the context of the best outcome, are presented in Table 9. Examination of this data suggests that PSA exhibits enhanced performance relative to various methods, including ES (Mezura-Montes and Coello 2008), HS (Chakraborty et al. 2009), RO (Kaveh and Khayatazad 2012), WOA (Mirjalili and Lewis 2016), RFO (Połap and Woźniak 2021), SCSO (Seyyedabbasi and Kiani 2023), SSA (Mirjalili et al. 2017), and MVO (Mirjalili et al. 2016). This finding reinforces the notion that the newly introduced PSA, in conjunction with OBSCA (Abd Elaziz et al. 2017), and GMO (Rezaei et al. 2023), holds considerable practical significance in engineering applications. Figure 9 illustrates the best solutions attainable by different algorithms. Based on this figure, it is evident that PSA demonstrates notable efficacy, positioning it competitively when compared to other cutting-edge algorithms.

Fig. 9
figure 9

Comparison of optimal outcomes in tension string design task

Table 9 The best design of tension string design task obtained by different algorithms

4.2 Cantilever beam design task

Fig. 10
figure 10

Cantilever beam design task

This task examines a cantilever beam composed of five hollow square blocks. The first block is firmly anchored, while the fifth block is subjected to a vertical load. The primary goal is to minimize the beam’s weight. Figure 10 depicts the five parameters that define the cross-sectional shape of the blocks. Detailed formulations for this problem are provided as:

Consider:

$$\overrightarrow{\varvec{x}}=\left[{x}_{1}{ x}_{2} {x}_{3} {x}_{4}\right]=\left[{T}_{s} {T}_{h} R L\right]$$

Minimize:

$$f\left(\overrightarrow{x}\right)=0.6224{x}_{1}{x}_{3}{x}_{4}+1.7781{x}_{2}{x}_{3}^{2}+3.1661{x}_{1}^{2}{x}_{4}+19.84{x}_{1}^{2}{x}_{3}$$

Subject to:

$${g}_{1}\left(\overrightarrow{x}\right)=-{x}_{1}+0.0193{x}_{3}\le 0$$
$${g}_{2}\left(\overrightarrow{x}\right)=-{x}_{2}+0.00954{x}_{3}\le 0$$
$${g}_{3}\left(\overrightarrow{x}\right)=-\pi {x}_{3}^{2}{x}_{4}-\frac{4}{3}\pi {x}_{3}^{3}+1,296,000\le 0$$
$${g}_{4}\left(\overrightarrow{x}\right)={x}_{4}-240\le 0$$

Variable range:

$$0\le {x}_{1}, {x}_{2}\le 99$$
$$10\le {x}_{3}, {x}_{4}\le 200$$

The results from this study have been rigorously analyzed and are presented in Table 10. Upon detailed examination of the data, it is evident that PSA consistently delivers results commensurate with, if not superior to, cutting-edge optimization methods such as COA (Jia et al. 2023), RFO (Połap and Woźniak 2021), GOA (Saremi et al. 2017), MVO (Mirjalili et al. 2016), ALO (Mirjalili 2015a), MMA (Chickermane and Gea 1996), GCA_I (Chickermane and Gea 1996), GCA_II (Chickermane and Gea 1996), CS (Gandomi et al. 2013), and SOS (Cheng and Prayogo 2014). Figure 11 offers a comprehensive visualization of the optimal solutions derived from various algorithms. The data underscores PSA’s distinct edge over its contemporaries. These findings underscore the unparalleled efficacy of PSA in addressing and refining complex, constraint-laden challenges. Furthermore, this analysis accentuates the relevance of PSA in engineering and allied fields, demonstrating its adeptness at tackling sophisticated problem structures.

Fig. 11
figure 11

Comparison of optimal outcomes in cantilever beam design task

Table 10 The best design of cantilever beam design task obtained by different algorithms

4.3 Gear train design task

The objective of the gear train design task, as depicted in Fig. 12, is to secure the minimal gear ratio by optimizing four discrete parameters: the total of teeth on each gear, denoted as nA, nB, nC, and nD. The gear ratio establishes the correlation between the angular velocities of the output and input shafts. Each parameter, being intrinsically discrete, increments by one unit. Central to the problem formulation is the task of constraining the feasible domains of these variables. A detailed mathematical representation of this task is provided as follows:

Fig. 12
figure 12

Gear train design task

Consider:

$$\overrightarrow{\varvec{x}}=\left[{x}_{1}{ x}_{2} {x}_{3} {x}_{4}\right]=\left[{n}_{A} {n}_{B} {n}_{C} {n}_{D}\right]$$

Minimize:

$$f\left(\overrightarrow{x}\right)={\left(\frac{1}{6.931}-\frac{{x}_{2}{x}_{3}}{{x}_{1}{x}_{4}}\right)}^{2}$$

Variable range:

$$12\le {x}_{1}, {x}_{2}, {x}_{3}, {x}_{4}\le 60$$

Table 11 offers a detailed comparison of PSA with several esteemed optimization techniques. A thorough analysis of the data underscores the congruence between solutions obtained through PSA and those from leading optimization methodologies, including MVO (Mirjalili et al. 2016), ABC (Sadollah et al. 2013), MBA (Sadollah et al. 2013), CS (Gandomi et al. 2013), ISA (Gandomi 2014), as well as frameworks proposed by Kannan and Kramer (1994), as well as Deb and Goyal (1996). These results compellingly validate the proposition that PSA can not only match but potentially surpass contemporary optimization strategies, particularly in scenarios rife with discrete parameters. PSA’s adeptness in handling discrete parameters accentuates its versatility, further cementing its position as an essential tool for handling diverse optimization tasks across various domains.

Table 11 The best design of gear train design task obtained by different algorithms

4.4 Welded beam design task

In the design task presented in Fig. 13, the system is defined by several crucial structural parameters. The design specifically pivots around four primary variables: the length of the attached bar (l), weld thickness (h), bar thickness (b), and bar height (t). The predominant objective of this engineering pursuit is to minimize the fabrication costs inherent to the design of this apparatus. For the design to maintain both its practicality and structural integrity, adherence to seven essential constraints is vital, particularly when a load is applied to the bar. These constraints encompass a variety of considerations, including lateral constraints, end deflection of the beam (δ), shear stress (τ), bending stress exhibited in the beam (θ), and the buckling load sustained by the bar (Pc). A comprehensive mathematical exposition of this complex challenge is provided as:

Fig. 13
figure 13

Welded beam design task

Consider:

$$\overrightarrow{\varvec{x}}=\left[{x}_{1}{ x}_{2} {x}_{3} {x}_{4}\right]=\left[h l t b\right]$$

Minimize:

$$f\left(\overrightarrow{x}\right)=1.10471{x}_{1}^{2}{x}_{2}+0.04811{x}_{3}{x}_{4}(14.0+{x}_{2})$$

Subject to:

$${g}_{1}\left(\overrightarrow{x}\right)=\tau \left(\overrightarrow{x}\right)-{\tau }_{max}\le 0$$
$${g}_{2}\left(\overrightarrow{x}\right)=\sigma \left(\overrightarrow{x}\right)-{\sigma }_{max}\le 0$$
$${g}_{3}\left(\overrightarrow{x}\right)=\delta \left(\overrightarrow{x}\right)-{\delta }_{max}\le 0$$
$${g}_{4}\left(\overrightarrow{x}\right)={x}_{1}-{x}_{4}\le 0$$
$${g}_{5}\left(\overrightarrow{x}\right)=P-{P}_{c}\left(\overrightarrow{x}\right)\le 0$$
$${g}_{6}\left(\overrightarrow{x}\right)=0.125-{x}_{1}\le 0$$
$${g}_{7}\left(\overrightarrow{x}\right)=1.10471{x}_{1}^{2}+0.04811{x}_{3}{x}_{4}\left(14+{x}_{2}\right)-5.0\le 0$$

Variable range:

$$0.1\le {x}_{1}, {x}_{4}\le 2$$
$$0.1\le {x}_{2}, {x}_{3}\le 10$$

where:

$$\tau \left(\overrightarrow{x}\right)=\sqrt{{\left({\tau }^{{\prime }}\right)}^{2}+\frac{2{\tau }^{{\prime }}{\tau }^{{\prime }{\prime }}{x}_{2}}{2R}+{\left({\tau }^{{\prime }{\prime }}\right)}^{2}}, {\tau }^{{\prime }}=\frac{P}{\sqrt{2}{x}_{1}{x}_{2}}, {\tau }^{{\prime }{\prime }}=\frac{MR}{J}$$
$$M=P\left(L+\frac{{x}_{2}}{2}\right), R=\sqrt{\frac{{x}_{2}^{2}}{4}+{\left(\frac{{x}_{1}+{x}_{3}}{2}\right)}^{2}}, J=2\left\{\sqrt{2}{x}_{1}{x}_{2}\left[\frac{{x}_{2}^{2}}{4}+{\left(\frac{{x}_{1}+{x}_{3}}{2}\right)}^{2}\right]\right\}$$
$$\sigma \left(\overrightarrow{x}\right)=\frac{6PL}{{x}_{4}{x}_{3}^{2}} , \delta \left(\overrightarrow{x}\right)=\frac{6P{L}^{3}}{E{x}_{3}^{2}{x}_{4}} , {P}_{c}\left(\overrightarrow{x}\right)=\frac{4.013E\sqrt{\frac{{x}_{3}^{2}{x}_{4}^{6}}{36}}}{{L}^{2}}\left(1-\frac{{x}_{3}}{2 L}\sqrt{\frac{E}{4G}}\right)$$
$$P=6000 lb, L=14 in., {\delta }_{max}=0.25 in. , E=30\times {10}^{6} psi, G=12\times {10}^{6} psi,$$
$${\tau }_{max}=13,600 psi, {\sigma }_{max}=30,000 psi$$
Fig. 14
figure 14

Comparison of optimal outcomes in welded beam design task

Table 12 conducts a detailed comparative analysis of PSA against a range of contemporary optimization methods. The data within this table unequivocally showcases PSA’s prowess in consistently outperforming results derived from renowned algorithms such as RFO (Połap and Woźniak 2021), COA (Jia et al. 2023), SO (Hashim and Hussien 2022), MVO (Mirjalili et al. 2016), GSA (Mirjalili et al. 2016), CPSO (Mirjalili et al. 2016), GA (Coello Coello 2000), GA1 (Deb 1991), GA2 (Deb 1991) and HS (Lee and Geem 2005). Figure 37 visually delineates the optimal solutions attained by each algorithm. From this illustration, it’s clear that PSA not only aligns with but often surpasses the performance of other cutting-edge methods. Furthermore, the insights gleaned from Table 12; Fig. 14 unequivocally indicate that PSA demonstrates exceptional capability in pinpointing optimal solutions, even within the intricate matrix of multi-dimensional constraints.

Table 12 The best design of welded beam design task obtained by different algorithms

4.5 Pressure vessel design task

The primary objective of this task is to minimize the fabrication costs related to the design of a pressure vessel. As depicted in Fig. 15, the vessel embodies a distinctive geometric configuration, juxtaposing a flat section with a hemispherical profile. Central to the optimization process are parameters such as the inner radius (R), shell thickness (Ts), the length of the cylindrical segment excluding the head (L), and the head thickness (Th). These parameters, representing pivotal structural aspects, significantly influence the vessel’s optimal design. To comprehensively formulate the problem, precise mathematical delineations and constraints have been devised to both encapsulate the aim of cost reduction and adhere to the stipulated design benchmarks. The ensuing equations provide a rigorous mathematical exposition of this sophisticated endeavor.

Fig. 15
figure 15

Pressure vessel design task

Consider:

$$\overrightarrow{\varvec{x}}=\left[{x}_{1}{ x}_{2} {x}_{3} {x}_{4}\right]=\left[{T}_{s} {T}_{h} R L\right]$$

Minimize:

$$f\left(\overrightarrow{x}\right)=0.6224{x}_{1}{x}_{3}{x}_{4}+1.7781{x}_{2}{x}_{3}^{2}+3.1661{x}_{1}^{2}{x}_{4}+19.84{x}_{1}^{2}{x}_{3}$$

Subject to:

$${g}_{1}\left(\overrightarrow{x}\right)=-{x}_{1}+0.0193{x}_{3}\le 0$$
$${g}_{2}\left(\overrightarrow{x}\right)=-{x}_{2}+0.00954{x}_{3}\le 0$$
$${g}_{3}\left(\overrightarrow{x}\right)=-\pi {x}_{3}^{2}{x}_{4}-\frac{4}{3}\pi {x}_{3}^{3}+1,296,000\le 0$$
$${g}_{4}\left(\overrightarrow{x}\right)={x}_{4}-240\le 0$$

Variable range:

$$0\le {x}_{1}, {x}_{2}\le 99$$
$$10\le {x}_{3}, {x}_{4}\le 200$$

Table 13 presents a comprehensive analytical review of the challenge, meticulously evaluating the existing data. The furnished evidence robustly attests to the enduring efficacy of the proposed PSA. Figure 16 elucidates the elevated performance benchmarks achieved by distinct algorithms. This depiction underscores PSA’s capability to yield outcomes surpassing other avant-garde techniques. Impressively, it provides solutions aligning with, or in some cases, surpassing the benchmarks established by recognized optimization strategies such as ACO (Kaveh and Talatahari 2010a), RFO (Połap and Woźniak 2021), SCSO (Seyyedabbasi and Kiani 2023), MVO (Mirjalili et al. 2016), GSA (Mirjalili et al. 2016), PSO (Lee and Geem 2005), multiple variants of GA (Coello Coello 2000), (Coello and Montes 2002), (Deb 1997), ES (Mezura-Montes and Coello 2008), DE (Li et al. 2007), ACO (Kaveh and Talatahari 2010a) and AOA (Abualigah et al. 2021). Beyond the primary insights, this scrutiny emphasizes the relevance of PSA in practical engineering design tasks, especially in scenarios where the characteristics of the investigatory domain are nebulous or indeterminate.

Fig. 16
figure 16

Comparison of optimal outcomes in pressure vessel design task

Table 13 The best design of pressure vessel design task obtained by different algorithms

5 Conclusion

Portia spiders are known for their ability to solve novel problems. For instance, when faced with an obstacle that hinders a direct path to their prey, these spiders can choose a detour, even if it leads to a temporary loss of sight of the target. Furthermore, they demonstrate a capacity for learning from past experiences and adjusting tactics accordingly.

This article introduces a nature-inspired model based on the hunting behaviours of the Portia spider, termed the Portia spider algorithm (PSA). Within this framework, the stalking and striking behaviours of the Portia spider inform the exploration phase, while the tactics of invading and imitating guide the exploitation phase.

Our extensive evaluations, which range from 23 classical test functions to 29 CEC2017 benchmarks and five engineering optimization problems, highlight the robustness and adaptability of PSA. Significantly, when compared to other meta-heuristic algorithms, PSA exhibits potential advantages, underscoring its potential in computational optimization. PSA is well-equipped to adapt and traverse complex optimization landscapes, marking its distinctive position in the field of evolutionary algorithms. Subsequent studies could explore further refinements to PSA, leveraging its inherent strengths and customizing it to address specific domain challenges.

Although PSA offers innovative approaches to optimization, it may encounter limitations such as slow convergence rates, particularly when applied to high-dimensional or intricate optimization challenges. To enhance its performance, integrating techniques like Lévy flights, mutation, and additional evolutionary operators could be beneficial. These methods can introduce new diversity into the population of solutions and allow the algorithm to escape local optima more effectively.

Moreover, hybridizing the PSA with other stochastic optimization algorithms could further improve its efficacy. By combining the strengths of PSA with other proven strategies, it is possible to create a more robust algorithm that leverages the advantages of each component method. This could lead to improved convergence speeds, better solution quality, and increased reliability across a wider range of optimization problems.

Such enhancements would be particularly useful in complex optimization landscapes, where the balance between exploration (diversification) and exploitation (intensification) is crucial for finding global optima. The adaptive capabilities of hybrid algorithms can be particularly adept at navigating these challenges, offering a powerful tool for complex optimization tasks.