## 1. Introduction

Metaheuristics are optimization algorithms that use a set of high-level strategies, such as search and optimization, to explore the solution space. Metaheuristics have become popular in recent years because they can be applied to a wide range of complex problems that are difficult to solve using traditional mathematical optimization methods.

Nature-inspired metaheuristic algorithms aim to solve complex optimization problems by mimicking the behavior and processes found in nature. One such nature-inspired algorithm is the Slime Mould Algorithm (SMA), which is **based on the behavior of the physical organism known as ”slime mould”**.

In this tutorial, we’ll introduce SMA, its background, and how it works.

## 2. The Slime Mould Algorithm

The Slime Mould Algorithm (SMA) is an algorithm miming the behavior of the physical organism known as ”slime mould”. The “slime mould” demonstrates incredible problem-solving abilities, as seen in its application to path-finding and network optimization. This is the famous case of the Japanese railroad network reconstruction.

**The SMA consists of multiple agents representing the spread of mould** close to food sources in an environment. The agents compete for limited resources and cooperate to form a network connecting the food sources. The process is repeated several times, and the final network that emerges represents the optimal solution to the problem being solved.

SMA has been applied to a wide range of optimization problems, including network design, facility location, and scheduling, and has been shown to be an effective and efficient algorithm.

### 2.1. Phase-Based Learning

Like many metaheuristics, the algorithm consists of two main phases. These are a search phase and an optimization phase. The slime mould extends tendrils into the search. When a food source is found, the tendril will thicken based on the viability of the food source found.

Trading off against the potential threat of environmental hazards leads to the classic exploration-exploitation trade-off. **The decision to leave a food source is naturally heuristic and depends on the quality of the food source.**

It is also notable that the slime mould can exploit multiple food sources simultaneously by distributing its biomass. Natural heuristics, in this case, are to narrow the search space when high-quality food is found and to explore further when the quality of the food is less.

## 3. Mathematical Model

We now start constructing the algorithm. **The two main phases are approach (search) food and wrap (exploit) food, respectively.** The algorithm will then oscillate between these two phases.

Before we start searching, we need to initialize the algorithm. The slime mould is, in one sense, a single entity. It can, however, act at different locations along itself so that we will treat it as a fixed number of multiple entities or locations.

We initialize locations to represent the slime mould. Then, for each of these locations, we compute the fitness of the slime mould.

### 3.1. Approach Food and Wrap Food

The slime mould senses food through its odor in the air. We capture this approaching food through odor with the following equation:

(1)

Here two random locations of our mould are represented by and . We also represent the best individual found so far as . The first condition searches for food based on the best-discovered location and mixes two random locations. The second condition causes the slime mould to exploit the locally available food source instead.

### 3.2. Breaking Down the Formula

(2)

(3)

With defined above, we now define as a random sample from the range . We also define as a random variable chosen from the linearly decreasing range :

(4)

is the weight parameter. The condition is that is in the first half of the population. We define in this way to mimic the oscillation pattern of slime moulds. helps the slime mould move towards high-quality food sources quickly while slowing down the approach when food concentration is lower:

(5)

The is the ranking of the slime mould by fitness value. **Fitness is the metric used to evaluate a given solution.**

### 3.3. Oscillation

**When running the full algorithm, a degree of random exploration is maintained.** This is the first term in the full equation below. is a hyperparameter that can be set according to the problem:

(6)

**The flow of food through the venous structure of the slime mould has a natural ebb and flow captured in the weight, , and the random parameters, and, **.

This allows for an oscillation in the thickness of the venous structure of the slime mould, allowing more or less food to flow. This helps the slime mould to avoid local optima. Our modeled parameters allow our model to achieve a similar effect.

## 4. Pseudocode

Here is an example pseudocode of the algorithm:

## 5. Computational Complexity

The algorithm runtime can be broken into five main operations. Those operations with their respective computation complexity are:

- initialization , is dimension of functions
- fitness evaluation , is the number of cells of slime mould
- sorting
- weight update
- location update

Total time complexity is .

## 6. Conclusion

In this article, we discussed the slime mould algorithm – a powerful nature-inspired metaheuristic algorithm. We show the inspiration for the algorithm and how it was converted into a series of mathematical operations. The algorithm is presented with further material in the research paper introducing it.