## 2 Methods and Materials
### CoT Optimization Using Red Fox Optimization (RFO) Algorithm  
To perform CoT optimization, we adopted the Red Fox Optimization (RFO) algorithm [55]. RFO is a nature-inspired heuristic algorithm that is based on the metaphor of red fox hunting behavior. When crossing the area, the fox takes every opportunity for food and creeps up to the hidden prey until he gets close enough to strike effectively. Exploration of territory in search of food was modeled as a global search when the fox spots the prey in the distance. Before the attack was modeled as a local hunt, the fox traverses through the habitat to get as close as possible to the prey. The RFO algorithm performs a global search by modeling solution space exploration as the search of food when the fox spots the prey in the distance, whereas local search is modeled as territory traversal aiming to get as close as possible to the prey before attacking it. Formally, the algorithm is described as follows. Let \(f\in\mathbb{R}^{n}\) be the target function of \(n\) variables in the solution space, and let \((\overline{x})^{(i)}=\left[(x_{0})^{(i)},(x_{1})^{(i)},\dots,(x_{n-1})^{(i)}\right]\) mark each point in the space \(\left\langle a,b\right\rangle^{n}\), where \(a,b\in\mathbb{R}\). Then \((\overline{x})^{(i)}\) is the optimal solution, if the value of function \(f\Big{(}(\overline{x})^{(i)}\Big{)}\) is a global optimum on \(\left\langle a,b\right\rangle\). The search process consists of two stages: variable space exploration and convergence of the solution. The RFO algorithm is summarized in Algorithm 1. ```
Inputs: search space \(\left\langle a,b\right\rangle\), fitness function \(f(\cdot)\) Outputs: optimal solution \(x^{best}\) Begin  Define the number of iterations \(T\), the maximum size of population \(n\),  Generate randomly the population of \(n\) foxes within search space,  Set iteration count \(i\ :=\ 0\), whilei\(\leq\ T\)do For each fox in populationdo  Sort individuals according to the fitness function,  Select best individual \(\left(x^{best}\right)^{i}\)  Calculate _reallocation_ of individuals ifreallocation is better than the previous position then  Move the _fox_, else  Return the _fox_ to previous position, endif  Choose randomly the noticing parameter of the _fox_, ifforx is not noticed then  Calculate reallocation else  Fox stays at his position endif
```  
**Algorithm 1**_Red Fox Optimization Algorithm_  
```
Inputs: search space \(\left\langle a,b\right\rangle\), fitness function \(f(\cdot)\) Outputs: optimal solution \(x^{best}\) Begin  Define the number of iterations \(T\), the maximum size of population \(n\),  Generate randomly the population of \(n\) foxes within search space,  Set iteration count \(i\ :=\ 0\), whilei\(\leq\ T\)do For each fox in populationdo  Sort individuals according to the fitness function,  Select best individual \(\left(x^{best}\right)^{i}\)  Calculate _reallocation_ of individuals ifreallocation is better than the previous position then  Move the _fox_, else  Return the _fox_ to previous position, endif  Choose randomly the noticing parameter of the _fox_, ifforx is not noticed then  Calculate reallocation else  [PERSON] stays at his position endif
```  
**Algorithm 2**_Red Fox Optimization Algorithm_  
```
Input: search space \(\left\langle a,b\right\rangle\), fitness function \(f(\cdot)\) Outputs: optimal solution \(x^{best}\) Begin  Define the number of iterations \(T\), the maximum size of population \(n\),  Generate randomly the population of \(n\) foxes within search space,  Set iteration count \(i\ :=\ 0\), whilei\(\leq\ T\)do For each fox in populationdo  Sort individuals according to the fitness function,  Select best individual \(\left(x^{best}\right)^{i}\)



For our problem of finding the best gait type and gait parameter of the robot, we defined the search space in terms of three independent variables:

\[(\overline{x})\ =\ [(x_{1}),(x_{2}),(x_{3})], \tag{5}\]

where \(x_{1}\) is the step length [mm], \(x_{2}\) is gait resolution, and \(x_{3}\) is gait type (one of Tripod, Tetrapod, Ripple, or Wave).