Keywords

1 Introduction

Population-based algorithms belong to heuristic algorithms and they are used mostly for solving optimization problems. They are different than traditional optimization methods because: (a) they do not process parameters of the problem, but encoded version of these parameters, (b) they search problem parameters not on the basis of one solution but they use a population of solutions, (c) they use objective function directly, not its derivatives, (d) they use probabilistic, not deterministic selection of rules. Due to that they have an advantage in comparison with other kind of approaches such as analytical methods, randomization methods, etc. (see e.g. [4, 10]).

Among population-based algorithms a different approaches can be found (see Fig. 1): inspired by nature, inspired by ecology (e.g. Biogeography-Based Optimization, see [11]) or based on social evolution (e.g. Imperialist Competitive Algorithm, see [1]) etc. It is worth to mention that all population-based algorithms benefit from the evolutionary principle of survival of individuals (solutions of problem specially encoded by parameters) and use mechanisms of exploration and exploitation (defined by specified algorithm) of search space to improve fitness of individuals. The aim of population-based algorithms is to minimize or maximize values of fitness function adopted to the considered problem. Algorithms stop working when a stop condition is achieved (e.g. when value of fitness function reaches assumed value).

Fig. 1
figure 1

Division of the population-based algorithms

Most of the presented in the literature population-based algorithms cannot be used directly to solve a group of complex optimization problems (which are important from a practical point of view). Those problems concern to find both the structure and the structure parameters of solution (which is needed e.g. in neural networks, fuzzy systems, biometric systems and controllers—considered in this paper) [3, 7, 14]. Majority of population-based algorithms are focused on searching parameters of structures defined by user. For more elastic solutions (considering searching both the structure and the structure parameters) hybrid population-based algorithms can be used. In this type of algorithms the structure of the problem can be encoded for example in binary parameters and these parameters can be tuned using genetic algorithm operators. The parameters of the structure can be tuned using any population-based algorithm designed for optimization. The development of hybrid algorithm requires a proper synchronization of its algorithms, components and a proper balance between exploration and exploitation of searching space ensured.

In this paper a new hybrid population-based algorithm is presented. It is based on fusion between firework algorithm (see e.g. [13]) and genetic algorithm (see e.g. [2]). This algorithm was tested on selection of the structure and the structure parameters for controller based on linear correction terms (a controller with an object are a control system). In the literature many approaches for automatization of this process can be found (see e.g. [5]). However, they are based mostly on selecting parameters of controllers with structures experimentally specified by experts. Thus, new and original element of the paper is (a) the proposed hybrid algorithm and (b) a way of its use for the automatic selection of the structure and parameters of the controller in automatic control system.

This paper is organized into four sections. Section 2 presents a description of problem of selecting the structure and structure parameters of controllers. In Sect. 3 a proposed hybrid population-based algorithm is presented. In Sect. 4 simulation results are drawn. Conclusions are presented in Sect. 5.

2 Description of Problem of Selecting the Structure and Structure Parameters of Controllers

In this paper a problem of selecting the structure and structure parameters based on linear correction terms is considered. Linear correction terms correspond to the needs of most automation systems (see e.g. [8]) and they are the most frequently used in practice (see e.g. [9]). Controllers which base on linear correction terms can consist of many Control Blocks (CB) (Fig. 2a). Each of CB can consist of correction terms such as: proportional (P), differential (I) and derivative (D). Moreover, each correction term consist of real number parameter: for P it is a reinforcement parameter K p , for I it is a time constant T i , for D it is a time constant T d . An adequate cooperation of CB (including proper structure of the controller) should be ensured to achieve a proper quality of control.

Fig. 2
figure 2

Main structure of: a control block (CB) and b node block (NB)

Proposed method is based on the idea of using general structure of controller which can be modified during training process (it can be reduced or revived). The process of modification of the structure aims to obtain the most simple structure (thanks to properly defined fitness function considering, among others, complexity of the solution), which possibly best suits the control criteria. The main (general) structure of controller of MISO type (multiple input, single output) is presented in Fig. 3. It consists of a subset of selected CB blocks presented in Fig. 2a. The control signal from the block CB may be described as follows:

Fig. 3
figure 3

The generalized structure of the controller based on a linear correction terms, designed by automatically evolutionary reduction

$$u_{CB} \left( t \right) = P^{\text{str}} \cdot {K}_{p} \cdot {e\left( t \right)} + I^{\text{str}} \cdot\frac{1}{{T_{i} }}\cdot\int\limits_{0}^{t} {e\left( t \right)dt} + D^{\text{str}} \cdot {T}_{d} \cdot\frac{de\left( t \right)}{dt},$$
(1)

where e(t) stands for input signal attached to CB block, u CB (t) stands for CB block output signal. Each correction term in (1) is marked symbolically by key \(P^{\text{str}} \in \left\{ {0,1} \right\}\), \(I^{\text{str}} \in \left\{ {0,1} \right\}\) or \(D^{\text{str}} \in \left\{ {0,1} \right\}\). The status of the keys corresponds to the occurrence of a merger or a break in the circuit (see Fig. 3). In the proposed method the key values are selected evolutionarily. Moreover, structure of the controller also contains Node Blocks (NB) (Fig. 2b) described as follows:

$$u_{NB} \left( t \right) = \left( { - 1} \right)^{{hcb^{\text{str}} }} \cdot {x}_{CB} \left( t \right) + \left( { - 1} \right)^{{hfb^{\text{str}} }} \cdot{x}_{fb} \left( t \right),$$
(2)

where is a type of feedback of signal connected to the output of the corresponding block CB (if then it is a positive feedback, if then it is a negative feedback) and a type of feedback of signal connected to the corresponding input of controller structure.

The aim of the proposed method is to select structure and parameters related to the structure. Selection of the structure is based on modification (reduction/addition) of correction terms and selection of feedbacks occurring in the controller. The selection process promotes these solutions, in which the number of attached keys is as small as possible.

3 Hybrid Genetic-Firework Population-Based Algorithm

Proposed hybrid genetic-firework population-based algorithm is a fusion between genetic algorithm and firework algorithm. The aim of genetic algorithm part is to select the structure of the controller, the aim of firework algorithm is to select the parameters of the controller. Both algorithms work simultaneously. The well-known idea of genetic algorithm is based on evolution of species (see e.g. [2]), the idea of firework algorithm is based on the behaviour of fireworks and their sparks (see e.g. [13]). In the firework algorithm each firework and spark are individuals representing single solutions for considered problem. Exploding of firework generates specified number of sparks around it and covers considered search space. After creation of sparks, all individuals are evaluated and best solutions are selected for next step of the algorithm (these solutions became new fireworks). Repeating such actions a certain number of times (resulting from the assumed number of steps of the algorithm) gives a real chance to get close to the optimal solution for the considered problem.

The next part of this section describes: (a) encoding method for fireworks and sparks (Sect. 3.1), (b) evaluation method for fireworks and sparks (Sect. 3.2) and (c) evolution of the fireworks and sparks (Sect. 3.3).

3.1 Encoding of the Structure and Parameters

The solutions encoded in population are marked as \({\mathbf{X}}_{j}\), j = 1, …, N, where N stands for the number of individuals in population (each individual represent single controller). Each individual consists of two parts of parameters: \({\mathbf{X}}_{j}^{\text{str}}\) and  \({\mathbf{X}}_{j}^{\text{par}}\) \(\left( {\mathbf{X}}_{j} = \left\{ {{\mathbf{X}}_{j}^{\text{str}} ,{\mathbf{X}}_{j}^{\text{par}} } \right\} \right)\). The part \({\mathbf{X}}_{j}^{\text{str}}\) is used to encode structure of the controller, and it is expressed as follows:

$${\mathbf{X}}_{j}^{\text{str}} = \left[ {\begin{array}{*{20}l} {CB_{j,1,1}^{\text{str}} ,P_{j,1,1}^{\text{str}} ,I_{j,1,1}^{\text{str}} ,D_{j,1,1}^{\text{str}} ,hcb_{j,1,1}^{\text{str}} ,hfb_{j,1,1}^{\text{str}} , \ldots ,} \\ {CB_{j,1,I}^{\text{str}} ,P_{j,1,I}^{\text{str}} ,I_{j,1,I}^{\text{str}} ,D_{j,1,I}^{\text{str}} ,hcb_{j,1,I}^{\text{str}} , \ldots ,} \\ {CB_{j,I!,1}^{\text{str}} ,P_{j,I!,1}^{\text{str}} ,I_{j,I!,1}^{\text{str}} ,D_{j,I!,1}^{\text{str}} ,hcb_{j,I!,1}^{\text{str}} ,hfb_{j,I!,1}^{\text{str}} , \ldots ,} \\ {CB_{j,I!,I}^{\text{str}} ,P_{j,I!,I}^{\text{str}} ,I_{j,I!,I}^{\text{str}} ,D_{j,I!,I}^{\text{str}} ,hcb_{j,I!,I}^{\text{str}} } \\ \end{array} } \right] = \left[ {X_{j,1}^{\text{str}} , \ldots ,X_{{j,L^{\text{str}} }}^{\text{str}} } \right],$$
(3)

where each parameter \({\mathbf{X}}_{j,g}^{\text{str}}\), \(g = 1, \ldots ,L^{\text{str}}\), encodes information about corresponding key (\(CB^{\text{str}}\), \(P^{\text{str}}\), \(I^{\text{str}}\), \(D^{\text{str}}\), \(hcb^{\text{str}}\) or \(hfb^{\text{str}}\)) of controller structure, \(L^{\text{str}} = 6\cdot {I!\cdot I - I! }\) stands for the number of parameters of the individual \({\mathbf{X}}_{j}^{\text{str}}\) (in the practice controllers use small amount of inputs which translate into processable L str). The part \({\mathbf{X}}_{j}^{\text{par}}\) encodes parameters of controller, and it is defined as follows:

$${\mathbf{X}}_{j}^{\text{par}} = \left[ {\begin{array}{*{20}l} {P_{j,1,1}^{\text{par}} ,I_{j,1,1}^{\text{par}} ,D_{j,1,1}^{\text{par}} , \ldots ,} \\ {P_{j,1,I}^{\text{par}} ,I_{j,1,I}^{\text{par}} ,D_{j,1,I}^{\text{par}} , \ldots } \\ {P_{j,I!,1}^{\text{par}} ,I_{j,I!,1}^{\text{par}} ,D_{j,I!,1}^{\text{par}} , \ldots ,} \\ {P_{j,I!,I}^{\text{par}} ,I_{j,I!,I}^{\text{par}} ,D_{j,I!,I}^{\text{par}} } \\ \end{array} } \right] = \left[ {X_{j,1}^{\text{par}} , \ldots ,X_{{j,L^{\text{par}} }}^{\text{par}} } \right],$$
(4)

where each parameter \(X_{j,g}^{\text{par}}\), \(g = 1, \ldots ,L^{\text{par}}\), encodes information about real number parameter K p , T i or T d of a CB block of the controller, \(L^{\text{par}} = 3\cdot {I!\cdot {I}}\) stands for the number of parameters of individual \({\mathbf{X}}_{j}^{\text{par}}\).

3.2 Individuals Evaluation

The way of defining fitness function in most of the control systems does not depend on algorithm but on considered problem. In case of selecting structure and parameters of controller, fitness function can consist the following elements: RMSE error, oscillations of the controller output signal, controller complexity and overshoot of the control signal. This is a very important issue, because e.g. (a) High number of the controller output signal oscillations tends to induce an excessive use of mechanical control parts and may cause often big changes of the controller output signal value. (b) The overshoot of the control signal is not acceptable in many industrial applications. The individual evaluation function (maximization problem) is described as follows:

$$ff \left( {{\mathbf{X}}_{j} } \right) = \left( RMSE_{j} + c_{j} \cdot {w_{c}} + os_{j} \cdot {w_{os}} + ov_{j} \cdot {w_{ov}} \right)^{ - 1}$$
(5)

where w c  ∊ [0, 1] denotes a weight factor for the complexity of the controller structure, c j  > 0 denotes the complexity of the controller structure described by the formula:

$$c_{j} = \sum\limits_{g = 1}^{{L^{\text{str}} }} {X_{j,g}^{\text{str}} } ,$$
(6)

w ov  ∊ [0, 1] denotes a weight for the overshoot factor, ov j  ≥ 0 denotes value of the greatest overshoot of the controlled s 1 signal, w os  ∊ [0, 1] denotes a weight for the oscillations factor and finally os j  ≥ 0 denotes oscillation count of controller output signal calculated as follows:

$$os_{j} = \sum\limits_{o = 1}^{O - 1} {\left| {r_{o} - r_{o + 1} } \right|} ,$$
(7)

where r o are (sorted by time value) minima and maxima of the signal u according to Fig. 4. It is worth noting that the function of the form (7) should also count the oscillations with minimum amplitude as an undesirable phenomenon in control systems.

Fig. 4
figure 4

Minima and maxima of the output signal u

3.3 Evolution Process

The hybrid genetic-firework algorithm proposed in this paper works according to the following steps:

Step 1. Initialization of fireworks \({\mathbf{X}}_{j}\), j = 1, …, N. Individuals in this algorithm are called fireworks and sparks. Each parameter of firework \({\mathbf{X}}_{j}^{\text{str}}\) (Sect. 3.1) is chosen randomly from the set {0, 1}, each parameter \({\mathbf{X}}_{j}^{\text{par}}\) (coding parameters of controllers) is generated randomly from ranges related to the considered problem.

Step 2. Evaluation of the initialized population. Each firework is evaluated by the fitness function defined in Sect. 3.2.

Step 3. Exploding of the fireworks. Each firework explodes and generates specified number of sparks. This number is calculated for each individual on the basis of fitness function value of fireworks (thanks to that more fittest fireworks get more sparks and vice versa):

$$\hat{s}_{j} = m\cdot\frac{{y_{\hbox{max} } - ff\left( {{\mathbf{X}}_{j} } \right) + {\check{n}}}}{{\sum\nolimits_{k = 1}^{n} {\left( {y_{\hbox{max} } - ff\left( {{\mathbf{X}}_{k} } \right)} \right)} + {\check{n}}}},$$
(8)

where m is a parameter controlling total number of sparks, y max is a best value of fitness function of fireworks, \({\check{n}}\) is a smallest constant in the computer (which prevents division by zero). This number (\(\hat{s}_{j}\)) is then reduced (projected) to the range \(\left[ b\cdot{m}, a\cdot {m} \right]\), where parameters of the algorithm a and b should satisfy the condition a < b < 1. Limiting the number of sparks is performed in order to: (a) prevent the domination of the entire population by fireworks outstanding good value of the evaluation function, (b) allocate sparks even to the fireworks which in the current step have a bad value of evaluation function. The locations of sparks are obtained by mimicking the firework explosion process. Each spark is a clone of firework (it gets the same parameters and the same structure as firework) with specified number of parameters modified randomly in a calculated range (range stands ‘amplitude of explosion’ and it is calculated individually for each firework). The value of amplitude of explosion for individual \({\mathbf{X}}_{{\mathbf{j}}}\) depends on the fitness function value:

$$A_{j} = \hat{A}\cdot\frac{{ff\left( {{\mathbf{X}}_{j} } \right) - y_{\hbox{min} } + {\check{n}} }}{{\sum\nolimits_{k = 1}^{n} {\left( {ff\left( {{\mathbf{X}}_{k} } \right) - y_{\hbox{min} } } \right)} + {\check{n}}}},$$
(9)

where \(\hat{A}\) is a parameter controlling maximum range of sparks, y min is the worst value of fitness function of fireworks. Thanks to that, fittest fireworks generate sparks close to them (exploitation) and vice versa (exploration). In this step additional number of sparks is generated on the basis of randomly chosen fireworks with modification of specified number of parameters using Gaussian explosion (to maintain diversity of population).

Step 4. Structure modification. In this step a structure of sparks generated in Step 3 is modified by mutation operator (known from genetic algorithm). For each spark a number from unit interval is generated randomly. If this number is smaller than mutation probability p m  ∊ (0, 1), spark structure will be modified as follows: for each structure parameter a number from unit interval is generated randomly, if this number is smaller than mutation probability, value of the structure parameter is changed to the opposite value (from 0 to 1 and vice versa).

Step 5. Evaluation of sparks. In this step each spark generated in Step 3 and modified in Step 4 is evaluated by fitness function defined in Sect. 3.2.

Step 6. Selection of new population. New population obtains one of the actually best firework and N − 1 sparks chosen from sparks generated in Step 3 and modified in Step 4. In the original version of the algorithm process of selecting individuals takes into account only their diversity: which gives more chances to choose (by the method of roulette wheel) for those individuals with greater distance from the others. It promotes a fuller exploration of search space, however, can lead to degeneration of the population. For this reason, the proposed approach also takes into account the value of fitness function. Thus, the probability of selecting an individual \({\mathbf{X}}_{j}^{{}}\) is defined as follows:

$$p\left( {{\mathbf{X}}_{j} } \right) = \frac{{\sum\nolimits_{k = 1}^{K} {\left\| {{\mathbf{X}}_{j} - {\mathbf{X}}_{k} } \right\|} }}{{ff\left( {{\mathbf{X}}_{j} } \right)}}.$$
(10)

Step 7. Replacement of the old population by population generated in the previous step. All individuals from new population are treated as fireworks. In this step a stop condition is checked. This condition affects the number of iterations of the algorithm. If this condition is not met, then algorithm goes back to Step 3.

Detailed information on the used algorithms can be found e.g. in [2, 13].

4 Simulations Results

In our simulations a problem of designing controller structure and tuning parameters for double spring-mass-damp object was considered (see Fig. 5). The purpose of the controller was the generation of such a control signal (acting on masses and), to adjust in the best way a position of the mass to the reference position. The motion equations for the mass m 1 (for position s 1, velocity v 1 and acceleration a 1) are described as follows:

Fig. 5
figure 5

Simulated spring-mass-damp object

$$s_{n}^{1} = s_{n - 1}^{1} + v_{n - 1}^{1} \cdot {T} + \left( {a_{n - 1}^{1} \cdot {T}^{2} } \right)\cdot 0.5,$$
(11)
$$v_{n}^{1} = v_{n - 1}^{1} + a_{n - 1}^{1} \cdot {T},$$
(12)
$$a_{n}^{1} = \left( {\left( {s_{n}^{2} - s_{n}^{1} } \right) \cdot {k} - v_{n}^{1} \cdot \mu } \right) \cdot {m_{1}^{ - 1} },$$
(13)

where n and n − 1 denotes current and previous simulation step respectively, k is spring constant. Analogically, for mass m 2, the motion equations (for position s 2, velocity v 2 and acceleration a 2) have the following form:

$$s_{n}^{2} = s_{n - 1}^{2} + v_{n - 1}^{2} \cdot{T} + \left( {a_{n - 1}^{2} \cdot{T}^{2} } \right)\cdot 0.5,$$
(14)
$$v_{n}^{2} = v_{n - 1}^{2} + a_{n - 1}^{2} \cdot {T},$$
(15)
$$a_{n}^{2} = \left( {\left( {u - s_{n}^{2} } \right) \cdot { k- v}_{n}^{2} \cdot \mu } \right) \cdot { m_{1}^{ - 1}} ,$$
(16)

where u is controller output signal and μ is coefficient of kinetic friction. Remarks about considered model can be summarized as follows: (a) Object parameters values were set as follows: spring constant k was set to 10 N/m, coefficient of friction μ = 0.5, masses m 1 = m 2 = 0.2 kg. Initial values of: s 1, v 1, s 2 and v 2 were set to zero (which means that the masses were in the rest state at their initial positions). (b) Signals fb i used in structure were set to: s 1, s 2, s* – s 1 respectively. (c) Simulation length was set to 10 s, a shape of the reference signal s* (trapezoid) is presented in Fig. 6, a shape of test signal s* (sinuous) is also presented in Fig. 6. (d) Search range for genes encoding controller parameters were set as follows: P = [0, 20], I = [0, 50], D = [0, 5]. (e) Output signal of the controller was limited to the range u ∊ (−2, +2). (f) Quantization resolution for the output signal u of the controller as well as for the position sensor for s 1 and s 2 was set to 10 bit. (g) Time step in the simulation was equal to T = 0.1 ms, while interval between subsequent controller activations were set to twenty simulation steps.

Fig. 6
figure 6

Signal values s 1, s* and output signal u for case: a FAGA-1, b FAGA-2

The authorial environment (implemented in C++) was used for simulations. Parameters of the algorithms for the simulations were determined as follows: the number of individual (fireworks) N was set to 10, the number of sparks was set to m = 100 [13], the number of additional sparks was set to 10, bounds parameters for number of sparks: a = 0.04 and b = 0.80, maximum amplitude of explosion was set to \(\hat{A} = 0.5\), the algorithm performs 1000 steps (generations), the mutation probability was set as p m  = 0.3. In our simulations, RMSE error function of the individual was described by the following formula:

$$RMSE_{j} = \sqrt {\frac{1}{Z}\sum\limits_{n = 1}^{Z} {\varepsilon_{j,n}^{2} } } = \sqrt {\frac{1}{Z}\sum\limits_{n = 1}^{Z} {\left( {s_{j,n}^{*} - s_{j,n}^{1}} \right)^{2}}},$$
(17)

where n = 1, …, Z, denotes sample index, Z denotes the number of samples, ɛ j,n denotes controller tracking error for the sample \(s_{j,n}^{*}\) denotes the value of the reference signal of the controlled value for the sample n, s 1 j,n denotes its current value for the sample n. Moreover, the following weights of fitness function components were used: w os  = 0.0100 and w ov  = 0.0001. At the same time two cases associated with different weight values w c were considered:

Case 1. This case (marked further as FAGA-1) aims to obtain high accuracy of the control system: w c  = 0.0010.

Case 2. This case (marked further as FAGA-2) aims to obtain low complexity of the control system: w c  = 0.0040.

The conclusions of the simulations can be summarized as follows:

  • The controllers obtained for considered in simulations problem using hybrid genetic-firework algorithms perform well (see Fig. 7): the level of oscillations (in case FAGA-1 a best value for oscillations was achieved—see Table 2) and overshooting is low, the accuracy of the system is more than satisfactory. This applies to situations, where testing of the controller was made using signal s* with trapezoidal shape (used in a training phase) and also when signal s* have sinusoidal shape (used only in test phase).

    Fig. 7
    figure 7

    Structure of the controller obtained for case: a FAGA-1, b FAGA-2 (structures denoted by dashed line were formed by reduction of the structure shown in Fig. 3)

  • The structure of controllers for both cases considered in simulations was chosen according to assumptions. For case FAGA-1 the structure is more complex than for case FAGA-2 (see Fig. 7), but it works more accurate (see Fig. 6a, b). It is worth to mention that, in our previous work (see [12]) different methods for automatic selection the structure and the structure parameters were used, however we did not achieved as simplest structure as in case FAGA-2 (see Table 1) with comparable quality of control (see Table 2).

    Table 1 Number of correction terms (nterms) for best individuals of population
    Table 2 Values of the fitness function (5) for best individuals of population
  • In our previous works problem of selecting both the structure and the structure parameters was considered (see [6, 12]). Those papers contains methods based on simple algorithms (e.g. genetic algorithm, evolutionary strategy (μλ)) and on standard population-based algorithms (e.g. gravitation algorithm, firefly algorithm). Results obtained in this paper differ than results from other papers (see Tables 1 and 2). Accuracy obtained for case FAGA-1 is close to the best accuracy achieved in previous researches (see Table 2). At the same time, the structure obtained in case FAGA-2 is the simplest (in comparison to other results) and preforms appropriate well.

5 Conclusions

In this paper a new hybrid genetic-firework algorithm is proposed. This algorithm can be used to solve complex optimization problems in which: both the structure and the structure parameters of the controller have to be found and various criteria for selection have to be taken in consideration (e.g. related to the complexity, accuracy, etc.). The algorithm was used for automatic selection of the controller, but can also be used e.g. for selection of structure and structure parameters of another kind of computational intelligence algorithm (e.g. neural network, decision tree, neuro-fuzzy systems, etc.). Results received in the simulations are positive and obtained structures of the controller are simple.