1 Introduction

Chaos is a discipline that has shown novel applications in different engineering areas [1]. Nowadays, fractional-order chaotic systems are a hot topic for research, but yet the solution of the dynamical system is a challenge, because there is not an analytical method to solve them. Almost all dynamical systems can be converted from its integer-order models to fractional-order ones. In both cases, one can evaluate their performances as dynamical characteristics that are associated to Lyapunov exponents, entropy, and Kaplan–Yorke dimension (\( D_{KY}\)). These characteristics can be optimized by metaheuristics [2,3,4]. For instance, among the available optimization algorithms, differential evolution (DE) and particle swarm optimization (PSO) have shown advantages in maximizing fractional-order systems [5]. In this paper, we apply DE and accelerated PSO (APSO) to optimize fractional-order neural networks that can have commensurate (if the derivatives have the same fractional-order) or incommensurate (if the derivatives have different fractional-order) orders.

Artificial neural networks (ANNs) are associated to model the behavior of a biological neural network, as in the human brain [6]. They are modeled by mathematical equations, some of them involving continuous-time and other discrete time variables. Chaotic neural networks have shown advantages in generating random binary sequences to encrypt color images, as shown in [7]. Other applications can be found in [8], where the authors show recent developments on fuzzy logic, neural networks and optimization algorithms, as well as their hybrid combinations, and their application in areas such as intelligent control and robotics, pattern recognition, medical diagnosis, time series prediction, and optimization of complex problems. More recently, it has been proven that neural networks are a good option for the analysis of the coronavirus pandemic problem [9]. One can list a huge number of applications of neural networks, but in this paper, the efforts are focused on problems involving fractional-order issues [10]. For instance, the following fractional-order neural networks can be suitable for optimization: the fractional-order residual convolutional neural network introduced in [11]; the distributed-order neural networks introduced in [12]; the fractional-order neural network with time-varying delays given in [13]; the fractional-order quaternion-valued neural network given in [14]; the fractional-order complex-valued neural network with impulsive effects given in [15]; the fractional-order memristive neural synaptic weighting given in [16]; the fractional-order complex-valued neural network given in [17], and so on.

As it is well known, the challenge on applying metaheuristics is the reduction of the execution time in the optimization loop. In this manner, as the evaluation of the dynamical characteristics of a fractional-order chaotic system consumes large time, we introduce a procedure to eliminate the evaluation of \(D_{KY}\) of a fractional-order CNN when the behavior is not chaotic. Henceforth, the proposed method consists on applying Fourier transform to the chaotic time series, to evaluate if the CNN generates chaotic behavior or not. If the CNN is chaotic, its time series are introduced to the time series analysis (TISEAN) software to evaluate \( D_{KY} \). If the CNN is not chaotic, the individual in DE or particle in APSO is eliminated and this saves execution time in the optimization loop.

The organization is done as follows: Sect. 2 describes the mathematical model of the cellular neural network (CNN) in its fractional-order version. Section 3 describes the metaheuristics, namely: DE and APSO algorithms that are used to optimize the CNN. The formulation of the optimization problem is shown in Sect. 4, where the goal is maximizing \( D_{KY} \), and we show the application of Fourier transform to reduce execution time of DE and APSO. Section 5 summarizes the optimization results and lists the best individuals provided by DE and solutions by APSO along their corresponding chaotic attractors. Finally, the conclusions are given in Sect. 6.

2 Fractional-order chaotic cellular neural network

Some recent fractional-order chaotic systems have been introduced in [18, 19], and the commensurate and incommensurate characteristics have been described in [20, 21]. This paper focuses on the Cellular Neural Network (CNN) that was proposed in [22]. Basically, it consists of a series of modeled cells by an analog nonlinear circuit. In [23], the authors analyzed the chaotic behavior of the autonomous CNN composed by two or three cells. For instance, the CNN modeled by three cells is given in (1). In this mathematical model: x, y, and z are neural states; f(x) , f(y) , and f(z) are neural activation functions shown in (2); and \( p_1 \), \( p_2 \), \( p_3 \), s, and r are the weights or coupling forces of the network, which values generating chaotic behavior are set to \( p_1 = 1.25 \), \( p_2 = 1.1 \), \( p_3 = 1 \), \( s = 3.2 \), and \( r = 4.4 \)

$$\begin{aligned}&\begin{array}{*{20}{c}} \dot{x} = - x + p_{1}f(x) - sf(y) - sf(z)\\ \dot{y} = - y - sf(x) + p_{2}f(y) - rf(z)\\ \dot{z} = - z - sf(x) + rf(y) + p_{3}f(z) \end{array} \end{aligned}$$
(1)
$$\begin{aligned}&\begin{array}{*{20}{c}} f(x) = \frac{|x + 1| - |x - 1|}{2}\\ f(y) = \frac{|y + 1| - |y - 1|}{2}\\ f(z) = \frac{|z + 1| - |z - 1|}{2}. \end{array} \end{aligned}$$
(2)

As one sees, (1) is a dynamical system of integer order, and it can be transformed to its fractional-order version, as shown in (3). It can be observed that the differential equations changed to have fractional orders denoted by \(q_1, q_2, q_3\). One can have two cases for the optimization process of the fractional orders: if \(q_1=q_2=q_3\) the CNN has commensurate orders, otherwise, the CNN has incommensurate orders, i.e., \(q_1\ne q_2\ne q_3\)

$$\begin{aligned} \begin{array}{*{20}{c}} _{0}D_{t}^{q_1} x(t) = - x(t) + p_{1}f(x) - sf(y) - sf(z)\\ _{0}D_{t}^{q_2} y(t) = - y(t) - sf(x) + p_{2}f(y) - rf(z)\\ _{0}D_{t}^{q_3} z(t) = - z(t) - sf(x) + rf(y) + p_{3}f(z). \end{array} \end{aligned}$$
(3)

In general, the optimization of a continuous-time system can have infinite possibilities for the design variables, in this case the coefficients and fractional orders of the derivatives. However, not all the possibilities will lead to generate chaotic behavior, so that one can estimate reduced search spaces for \( p_1 \), \( p_2 \), \( p_3 \), s, and r, and for the fractional orders, one can also establish fractional ranges for \( q_1 \), \( q_2 \), and \( q_3 \), as listed in Table 1, which have high possibilities of generating chaotic behavior than other random values.

Table 1 Proposed search space ranges of the design variables for the optimization process

The authors in [24] demonstrated that for a chaotic oscillator consisting of three fractional-order derivatives, and considering different types of model nonlinearities, and using the proper control parameters, chaotic attractors are obtained with system orders as low as 2.1. Consequently, those authors introduced a conjecture that third-order systems can still produce chaotic behavior with a total system order higher than 2. In this manner, the fractional-order chaotic CNN modeled by (3) has three differential equations, and its minimum fractional order to generate chaotic behavior must be higher than two. This can be accomplished if all the commensurate fractional orders of the derivatives have values equal or higher than 0.7. However, for incommensurate fractional orders, one can have combinations of values, so that the sum of the three fractional orders be higher than two. To know the dimension of the problem: By setting the search spaces from 0.60000000 to 0.99999999, it leads us to have \((10^8)^3=10^{24}\) possibilities of having \(q_1\ne q_2\ne q_3\). This number increases exponentially when varying \( p_1 \), \( p_2 \), \( p_3 \), s, and r. For this reason, metaheuristics are a good option to optimize a fractional-order chaotic CNN.

3 Metaheuristics

The pseudocodes of DE and PSO algorithms have already given in [5] for the optimization of fractional-order chaotic oscillators. In this paper, DE and APSO are applied to optimize a fractional-order chaotic CNN. The pseudocodes are summarized in the following subsections.

3.1 Differential evolution (DE)

DE algorithm is a metaheuristic that uses real numbers in its representation and then can be applied to optimize continuous-time problems. DE requires as input, the size of the population, number of generations, the value for the recombination constant (CR), the value for the differential constant (F), and the threshold value s. The pseudocode for the optimization of the chaotic CNN is given in Algorithm 1. The evaluation of \( D_{KY} \) is performed, as shown in Sect. 4.2, including the verification of chaotic behavior of the times series using the spectrum.

figure a

The generations are updated by creating new vectors by performing mutation (4) and crossover (5) operations. Where, a, b, and c are different numbers randomly chosen; g denotes the current generation; \( F \in [0, 2] \) is the differential constant; \( j = \{1, 2, \ldots , D\} \); \( randb(j) \in [0, 1] \) is the jth evaluation of a generated random number; \( CR \in [0, 1] \) is a crossover coefficient chosen by the user; and \( rnbr(i) \in [0, D-1] \) is an index randomly generated [5]

$$\begin{aligned}&v_{i}^{g+1} \leftarrow x_{c}^{g} + F(x_{a}^{g} - x_{b}^{g}) \end{aligned}$$
(4)
$$\begin{aligned}&u_{ij}^{g+1} \leftarrow \left\{ {\begin{array}{*{20}{c}} {v_{ij}^{g+1}}&{}{\; \; \; \; \; \; \text {if}\; randb(j) \le CR \; \text {or} \; rnbr(i) = j}\\ {x_{ij}^{g+1}}&{}{\; \; \; \; \; \; \text {if}\; randb(j) > CR \; \text {and} \; rnbr(i) \ne j}. \end{array}} \right. \nonumber \\ \end{aligned}$$
(5)

3.2 Accelerated particle swarm optimization (APSO)

Similar to DE, APSO algorithm is a metaheuristic that performs a direct random search in an intelligent sense. Generally, APSO requires the following parameters as input: size of the population, number of generations, \( \beta \), and \( \alpha \). The pseudocode of APSO for the optimization of the chaotic CNN is given in Algorithm 2. The evaluation of \( D_{KY} \) is performed, as shown in Sect. 4.2, including the verification of chaotic behavior of the times series using the spectrum.

The particle behavior is defined by two equations: velocity (6) and position (7). Where, i is the index of the particle; j its dimension; \( p_i \) the best position found in i; \( p_g \) the best position found during the optimization; \( \alpha \in {\mathbb {R}} \) is the inertial weight; \( \beta \in {\mathbb {R}} \) the acceleration constant; and \( U(\bullet ) \) a random number generator with uniform distribution [5]

$$\begin{aligned}&v_{ij}^{t+1} \leftarrow \alpha v_{ij}^{t} + U(0, \beta )(p_{ij} - x_{ij}^{t}) + U(0, \beta )(g_j - x_{ij}^{t}) \end{aligned}$$
(6)
$$\begin{aligned}&x_{ij}^{t+1} \leftarrow x_{ij}^{t} + v_{ij}^{t+1}. \end{aligned}$$
(7)
figure b

4 Optimizing \(D_{KY}\) of a chaotic CNN by DE and APSO

This section shows the fitness function of the optimization process, and the handling of constraints highlighting the use of Fourier transform to verify if the time series is chaotic or not and, therefore, save execution time when evaluating \(D_{KY}\) by TISEAN, who is time-consuming.

4.1 Fitness function

In chaotic systems, \(D_{KY}\) is evaluated considering the number of ordinary differential equations. In this case, the chaotic CNN has three equations and its dimension can be evaluated by applying (8). This dimension is related to the Lyapunov exponents \(\lambda _{1}\), which are equal to the number of state variables. In this case, the chaotic CNN has three state variables xyz, so that it has three Lyapunov exponents, and to show a chaotic behavior, one must be positive, one zero, and another negative, and therefore, \(D_{KY}>2\) [25]. Maximizing \(D_{KY}\) leads us to deal with the fitness function given in (9)

$$\begin{aligned}&D_{KY} = j + \frac{\lambda _{1} + \cdot \cdot \cdot + \lambda _{j}}{\left| \lambda _{j+1} \right| } \end{aligned}$$
(8)
$$\begin{aligned}&f(\lambda ) = 2 + \frac{\lambda _{1} + \lambda _{2}}{\left| \lambda _{3} \right| }. \end{aligned}$$
(9)

Among the available methods to evaluate Lyapunov spectrum, one can use the online available software called TISEAN, who requires the chaotic time series of the associated state variable xyz, as input. This software is used herein to evaluate \(D_{KY}\), but is time-consuming, so that we propose to verify if the chaotic time series is chaotic or not by computing the Fourier transform, and it is taken as a constraint.

4.2 Verification of chaotic behavior using the spectrum

The optimization algorithms based on populations as DE and APSO are time-consuming, so that to reduce the execution time, we propose the application of Fourier transform to select those individuals in DE or particles in APSO that can be passed to TISEAN to compute \(D_{KY}\). Besides, the first constraint is imposed by (10) for both commensurate or incommensurate fractional orders

$$\begin{aligned} \sum _{i=1}^{3} q_i \ge 2.1 \end{aligned}$$
(10)

A second constraint consists on verifying the eigenvalues that must be complex to generate oscillating behavior. If the mathematical model does not have equilibrium points, as the case of the fractional-order chaotic CNN given in (3), then one can apply a numerical method as Newton–Raphson [26], which is given in (11). This method is very fast, so that the execution time of the metaheuristic is not increased as for the one taken by TISEAN

$$\begin{aligned} X_{i+1} = X_{i} - J^{-1}(X_{i}) f(X_{i}). \end{aligned}$$
(11)

Guaranteeing the constraint in (10) and that the eigenvalues are complex conjugated may not lead to chaotic behavior. In fact, in many cases, the time series may have periodic behavior or they can be damped. In this manner, as DE and APSO work with populations, if the individuals are verified to have chaotic behavior, the execution time can be reduced, because \(D_{KY}\) is evaluated by TISEAN and it is the bottleneck in the optimization loop. See for example the spectrum of a chaotic time series shown in Fig. 1, and the spectrum of a non-chaotic time series shown in Fig. 2. It is very notable that the spectrum of a chaotic time series has higher amplitude than a non-chaotic one. For this reason, we propose to evaluate the Fourier transform of each time series before the individual or particle pass to TISEAN and this is decided by setting a threshold for the spectrums. In this work, the threshold was set to 0.2.

Fig. 1
figure 1

Fourier transform of a chaotic time series

Fig. 2
figure 2

Fourier transform of a non-chaotic time series

Table 2 DE input parameters
Table 3 Four best solutions provided by DE

The pseudocode including the Fourier transform as constraint is given in the procedure named Evaluate(), shown below. This procedure is executed in Algorithm 1 at step 3, and in Algorithm 2 at step 4 to evaluate \(D_{KY}\). As one can see, the first step is verifying the fractional order to accomplish (10). If this is accomplished, the eigenvalues are computed applying Newton–Raphson. If the eigenvalues are complex conjugated, the chaotic CNN is simulated by applying a numerical method, as the Grüwald–Letnikov [1]. The generated time series is evaluated with the Fourier transform to double check that is chaotic behavior. Finally, the chaotic time series is processed by TISEAN computing \(D_{KY}\).

figure c

5 Results

Both DE and APSO were programmed in python language. The simulation of the fractional-order CNN modeled in (3) is done applying Grünwald–Letnikov with a step-size \( h = 0.01 \) and a short memory length of \( 1\% \) of the total length, e.g., \( Lm = 2 \) for 20, 000 samples. The initial conditions for all the cases were set to \( x_0 = -0.1 \), \( y_0 = 0.2 \), and \( z_0 = -0.1 \).

5.1 Best feasible solutions provided by DE

The input parameters that were used for DE algorithm are listed in Table 2. It can be noted that it includes the parameters given in Subsect. 3.1

The four best feasible solutions provided by DE are given in Table 3. It can be noted that solution 2 has incommensurate, while solutions 1, 3, and 4 have commensurate fractional order, but the other parameters are totally different, and all these best solutions have good values for the fitness function, i.e., \(D_{KY}\).

Figure 3 shows the chaotic attractors of the solutions provided by DE for the fractional-order CNN. It can be appreciated that they have very similar ranges in the state variables x and y.

5.2 Best feasible solutions provided by APSO

APSO algorithm was executed by setting the input parameters, as shown in Table 4. It includes the values of the search spaces ranges of the design variables given in Sect. 3.2.

Fig. 3
figure 3

Chaotic attractors for the solutions given in Table 3: a Solution 1, b Solution 2, c Solution 3, and d Solution 4

Table 4 APSO input parameters
Table 5 Four best solutions provided by APSO
Fig. 4
figure 4

Chaotic attractors for the solutions given in Table 5. a Solution 1, b Solution 2, c Solution 3, and d Solution 4

The four best solutions provided by APSO are given in Table 5. In this case, just one commensurate case associated with solution 1 is listed. the other three solutions 2, 3, and 4 have incommensurate fractional order, but in all cases, again the fitness function is high. In fact, APSO provided higher \(D_{KY}\) than DE.

Figure 4 shows the chaotic attractors associated to the four best solutions provided by APSO.

6 Conclusions

This paper showed the optimization of a fractional-order cellular neural network by applying metaheuristics, such as DE and APSO. The fitness function was associated to maximize the Kaplan–Yorke dimension, which is evaluated by TISEAN program. To reduce execution time of the optimization loops in both metaheuristics, we proposed the evaluation of the Fourier transform to the time series of the CNN and apply a threshold to the spectrum to verify chaotic behavior. However, to verify that the individual or particle in the population will generate chaotic behavior, some constraints were evaluated, namely: verification that the fractional order is higher than two, verification that the eigenvalues are complex, and verification that the Fourier transform has high amplitude values in the spectrum, e.g., 0.2, in this work. These constraints driven DE and APSO algorithms to maximize \(D_{KY}\), providing feasible solutions whose attractors have similar ranges in their phase portraits. The best \(D_{KY}\) results provided by the metaheuristics were associated to incommensurate fractional-order CNNs. They can be implemented on embedded systems for the development of real applications as encryption systems under a protocol for IoT.