Fuzzy Dynamic Parameter Adaptation in ACO and PSO for Designing Fuzzy Controllers: The Cases of Water Level and Temperature Control

A novel approach applied to Particle Swarm Optimization (PSO) and Ant Colony Optimization is presented. The main contribution of this work is the use of fuzzy systems to dynamically update the parameters for the ACO and PSO algorithms. In the case of ACO, two fuzzy systems are designed for the Ant Colony System (ACS) algorithm variant. The first system adjusts the value for the pheromone evaporation parameter from the global pheromone trail update equation and the second system adjusts the values for the pheromone evaporation parameter from the local pheromone trail update equation. In the case of PSO, a fuzzy system is designed to find the values for the inertia weight parameter from the velocity equation. Fuzzy logic controllers (FLCs) are optimized with ACO and PSO, respectively, to prove the performance of the proposed approach. The particular benchmark problems considered to test the proposed methods are the water level control in a tank and temperature control in a shower. Therefore,PSOandACOalgorithmsareappliedintheoptimizationoftheparametersoftheFLCs.Theachievementoftheproposed fuzzyACOandPSOalgorithmsiscomparedwiththeoriginalresultsofeachbenchmarkcontrolproblem.


Introduction
In automating the design of fuzzy controllers, the use of metaheuristic algorithms has been amply proposed.The proposed approach is based on the swarm intelligence models [1] that perform research of the collective behavior in decentralized schemes; two swarm intelligence models are utilized in this paper: the Ant Colony Optimization (ACO) [2] and Particle Swarm Optimization (PSO) [3,4] algorithms.The development of the swarm intelligence models is founded on imitating the social behavior of living beings, particularly of insects or animals, in performing the search for the optimal solution in a solution space for a problem.
ACO is a metaheuristic algorithm based on the collaboration of artificial ants in a colony to search for an optimal solution for complex problems.In ACO algorithms, the collaboration between the artificial ants is an important part, and this consists in assigning the computational resources to artificial ants (artificial agents) by indirect communication mediated by the environment.ACO algorithms are utilized to solve many paradigmatic problems, like the Travelling Salesman Problem (TSP) [5,6].Different ACO variants have been used for fuzzy system controller problems models [7,8].Those algorithms have focused on fuzzy logic parameter tuning to find the values to each membership function, the membership functions type, the number of membership functions, and so forth [9,10].
The inspiration of PSO is based on the social behavior of flock of birds or fishes.The procedure of PSO to encounter the optimal solution is based on the task of this animal community.In a PSO method, in the search space, a swarm of particles (individuals) is scattered.Each particle can be an aspirant solution for the problem at optimization.The PSO has been implemented, obtaining optimal results, to different optimization problems, such as benchmark functions [11,12], finding optimal results for permutation problems [13,14], and optimizing the training of neural networks [15,16] and we also found optimization of fuzzy inference systems [17] and   some optimization problems for fuzzy control systems [18], even with other hybrid optimization algorithms [19].Unlike other algorithms that have been applied for control problems, we have proposed the design of fuzzy systems to adjust some parameters for each of the optimization algorithms.The algorithms, both ACO and PSO, are applied to optimize control systems [20,21].For this paper, we have considered two benchmark control problems for designing their fuzzy controllers with the proposed approach [22].
The novelty in the contribution of this work is the development of fuzzy systems to dynamically adjust parameters of the ACO and PSO algorithms [23,24].In the ACO algorithm, we have proposed the use of two fuzzy inference systems to dynamically adjust in each iteration the  pheromone evaporation parameter in the equations used to calculate the update of the local and global pheromone.For the PSO algorithm, we have designed a fuzzy inference system to adjust dynamically in each iteration the parameter of the inertia weight in the equation used to obtain the velocity of the particle.The approaches were applied to the optimization of water level control and temperature control in a shower for testing.
In the PSO parameters control problems in this work, the membership functions will help in automating the fuzzy control [25,26].The rules were framed through numerous simulations, which are carried out to determine the best   possible set of rules aimed at pushing the stability limits of the system to its maximum.The membership functions can be estimated by studying the behavior of different conditions and for different contingency cases [27,28].
The organization of this paper is as follows: Section 2 describes some basic concepts of fuzzy logic, Section 3 provides a brief description of the fuzzy logic controller (FLC), and Section 3 explains the standard PSO and ACO algorithms with the basic structure for water level control in a shower in a tank and the structure for temperature control in a shower and the experimental results made in this research.The conclusions are summarized in Section 4.

Fuzzy Logic Control (FLC).
The fuzzy logic control is utilized in ill-defined complex process that can be operated by a trained human without knowing the dynamics of the system.
In a FLC, the basic idea consists in utilizing the knowledge of an expert operator for the construction of the FLC that performs the control for a system; the input-output variables for the system are represented by fuzzy rules (IF-THEN) at difference to a complicated mathematical model.In the design of the FLC, the use of fuzzy rules with linguistic variables and the fuzzy reasoning allows incorporating the experience of the human expert.A traditional scheme for a FLC is shown in Figure 1.

Particle Swarm Optimization. PSO works with particles
for representing a potential solution to the optimization  problem [3,4]; the process consists of flying around a search space, and the position of each particle is updated using the personal experience and the social particles experience [29,30].The position of each particle is updated by the following equation: where   ( + 1) describes the position of the particle  in the time ( + 1),   () describes the position of the particle  in the time (), and V  ( + 1) denotes the velocity of the particle  in the time ( + 1).
In this work, we utilized the gbest PSO variant, in which the experience neighborhood for each particle is obtained from the entire swarm.For each particle , the velocity is calculated with the equation as follows: where V  () describes the velocity of the particle  in the dimension  in the time ,   () represents the position of the particle in the time ,   () denotes the best position of the particle, ŷ () describes the global best position of all particles,  1 ,  2 are cognitive and social components, respectively (positive acceleration constants), and  1 (),  2 () are random numbers in the interval [0, 1].
Some research work has been developed to enhance the convergence and the optimal solution obtained with the basic PSO, like the velocity constriction [31], inertia weight [32], and velocity clamping [27].
In this paper, a modification of the gbest PSO variant using the inertia weight () is proposed.The inertia weight allows having control in the exploration and exploitation swarm besides the control of the speed and direction of the particles.Equation (2) of the gbest PSO changes as follows: A number of works to dynamically adjust the inertia weight  have been developed, like the random adjustments [33], linear decreasing [26,34], nonlinear decreasing [34], and fuzzy adaptive inertia [35].We propose adjusting the inertia weight  and learning factors  1 and  2 of the PSO during the iteration process.
The learning factors  1 and  2 affect the total velocity of a particle [36].The cognitive component ( 1 ) determines the own confidence of the particle and the social component ( 2 ) defines the confidence of the particle in the neighbors.
We have designed a fuzzy inference system for the adaptation of the inertia weight and learning factors; the design consists of the following: Two inputs: the number of iterations () when the best fitness does not change and the actual value of the inertia weight () Three outputs: the change in inertia weight (ℎ) and the change in learning factors  1 and  2 Three membership functions for each input and outputs in the fuzzy inference systems: they are shown in Figure 2, defined as LOW, MEDIUM, and HIGH and represented as a left triangle, middle triangle, and right triangle, respectively Figure 3 illustrates the fuzzy inference system architecture with two inputs (the number of iterations when the best fitness does not change () and the actual inertia weight ()) and three outputs (the change in inertia weight (ℎ) and learning factors ( 1 ) and ( 2 )).
To obtain the new ℎ,  1 , and  2 values, nine fuzzy rules are used in the fuzzy inference system.An example of one fuzzy rule is given as follows: If  is MEDIUM, and The rules were obtained by empirical knowledge obtained by experimenting and are shown in Table 1.
The range of  is in [1,10], the value for  is in 0.2 ≤  ≤ 1.2, and the values of  1 and  2 are in 1.0 ≤  1 ,  2 ≤ 2.0.
The mathematical descriptions for  1 and  2 are defined with the following expressions: where  1 is percent of cognitive acceleration of the particle ,   1 is number of fuzzy rules activated to  1 ,  1 is output of the fuzzy rule  for  1 , and   1  is membership function value of fuzzy rule  for  1 .
where  2 is percent of cognitive acceleration of the particle ,   2 is number of fuzzy rules activated to  2 ,  2 is output of the fuzzy rule  for  2 , and For obtaining the values of the variable, the Mamdani FIS model is utilized.
The method of the centroid of area is performed to obtain the defuzzification:

Ant Colony Optimization
The first algorithm to fall into the framework of the ACO metaheuristics was the Ant System (AS) [2].In AS,  (artificial) ants build, at the same time, a graph for the solution of the optimization problem.At first, the nodes for the ants are randomly chosen.At each building step, to obtain the node in the next iteration of the ant , a probabilistic action selection rule, called random proportional rule, is applied [37].Determining the probability of the ant  to select the path from node  to  is as follows: defines the heuristic value that is independent of the experience of the ant., are two parameters that define the influence of the pheromone trail and the heuristic information.
represents the probable neighborhood of the ant  in the node , namely, the grouping of nodes that the ant  has not visited yet.  defines the pheromone evaporation for the route.
The update of the pheromone trails is performed after all the ants build their routes.To reach the update, first the pheromone values on the arcs are reduced by a constant factor and later, on the arcs which the ants passed, pheromone is added.This action is called pheromone evaporation and is performed as follows: where 0 <  ≤ 1 is the pheromone evaporation rate.The parameter  is utilized to elude the accumulation without limits of the pheromone trails and it allows the algorithm to "forget" wrong decisions previously taken.After applying the evaporation, the ants add pheromones on the arcs of their route as follows: where Δ   is the quantity of pheromones that the ant  provides on the arcs visited.It is determined as follows: where   represents the longitude of the graph and   is calculated as the sum of the longitudes of the arcs of the route for the th ant.
Many research works dealing with the updating rules for Δ   have been performed, like the Ant System (AS) [2], Elitist Ant System (EAS) [38], Rank-Based Ant System (AS rank ) [39], Max-Min ant System (MMAS) [40], and Ant Colony System (ACS) [41].In this paper, we used an Ant Colony System (ACS) [41] for three important reasons.At first instance, the ACS uses an action choice rule that is more aggressive than the AS in the exploitation of the search experience concentrated by the strongest ants.Second, the ACS applies the pheromone deposit and the pheromone evaporation only in the arcs of the more promising route.Third, when the ant moves from node  to node  using the arc (, ), with the objective of incrementing the exploration, it eliminates a small amount of pheromone from the arc [42,43].ACO has a process in which it does not use heuristic values and the part of the consequent can be merely selected as follows: In ACS, the ant  moves from node  to node  according to a pseudo-random-proportional rule as follows: where  is random value uniformly distributed in [0, 1],  0 is parameter in the interval [0, 1], and  is random value calculated by (11) (with  = 1).
In the global pheromone trial update for ACS, in each iteration, only the global best ant has authorization to add the   pheromone.Accordingly, the update in ACS is performed as follows: where Δ   = 1/  ; in ACS, the pheromone trail update is applied to the arcs of   , not to all the arcs as in AS.
We have defined a fuzzy inference system for pheromone evaporation  which is made up of the following elements:   2 The ranges of Δ  and  are normalized into [0, 1] In ACS, besides the global pheromone trail update rule, a local pheromone update rule is applied after the ants cross an arc (, ) in the construction of the graph.This rule is given by the following equation: where , 0 <  < 1.The value of  0 is configured to take the initial value of the pheromone trails.
We have defined a fuzzy inference system for pheromone evaporation  which consists of the following components:  - Parameter values -0.9 -0.09Parameter values -19 -0.9The ranges of  and  are normalized into [0, 1]

Water Level Control in a
Tank.The water tank model and the control of this water tank using a fuzzy control system is the system used for the experiments of the proposed approach [22].For this case, the control of the water that flows into the tank is made by using one valve.The outflow rate depends on the diameter of the output pipe, which is constant, and the pressure in the tank, which varies with the water level.Therefore, the system has nonlinear characteristics.The main objective of the fuzzy logic controller (FLC) for the water tank is to maintain the water in between the lower level L and upper level U according to the reference R, as shown in Figure 6.The FLC performs the control of the level and velocity to the water, giving as output of the FLC the quickness of flow out of the pipe.The controller needs to be efficient to manage flow in the pipe and maintain the current level of water in the tank.The water level error is the input for the controller (the difference between the desired water level and the current water level) and the rate of opening or closing for the valve is the output.
As Figure 7 illustrates, the fuzzy controller has two inputs: the rate of change of the water level and the difference between the actual and the required water levels.The controller uses these inputs to manipulate the inflow rate.
For the fuzzy system of the water tank, 11 membership functions were used: 3 per each input and 5 at the output and all this is illustrated in Figure 7.The linguistic variable level is defined to have three fuzzy sets, HIGH, OK, and LOW, with the associated membership functions as leftGaussian, Gaussian, and rightGaussian, respectively; the linguistic variable rate is defined to have three fuzzy sets, NEGATIVE, NONE, and POSITIVE, with associated membership functions as leftGaussian, Gaussian, and rigthGaussian, respectively; the linguistic variable valve is defined to have five fuzzy sets, CLOSE FAST, CLOSE SLOW, NO CHANGE, OPEN SLOW, and OPEN FAST, with associated membership function as leftTriangle, Triangle, and rigthTriangle, respectively.The following five fuzzy rules are used to calculate the change in the valve: 3.2.Temperature Control in a Shower.We also used as basis for our experiments the problem of temperature control and the fuzzy system presented in [22].As Figure 8 illustrates, the fuzzy controller consists of two inputs: the water temperature and the flow velocity.The controller utilizes the outputs obtained with the two inputs to control the cold and hot valves.For the fuzzy system of the temperature control, 16 membership functions were used: 3 per each input and 5 at the output and all this is illustrated in Figure 8.The fuzzy variable temp is defined to have three fuzzy sets, COLD, GOOD, and HOT, with associated membership functions as leftTriangle, Triangle, and rigthTriangle, respectively; the fuzzy variable flow is defined to have three fuzzy sets, SOFT, GOOD, and HARD, with associated membership function as leftTriangle, Triangle, and rigthTriangle, respectively; the fuzzy variables cold and hot are defined to have five fuzzy sets, CLOSEFAST, CLOSESLOW, STEADY, OPENSLOW, and OPENFAST, with associated membership functions as leftTriangle, Triangle, and rigthTriangle, respectively.The following nine fuzzy rules were used to calculate the change of the flow and temperature in the outputs:

Implementation of the Proposed Methodology.
In this section, the PSO and ACO algorithms are implemented for the optimization of two FLC systems [44,45].The optimization approach has been designed in the following sequence: first, the optimization defines the type of membership function: can be Gaussian, triangular, trapezoidal, or generalized bell; later, the optimization determines the parameters for the chosen membership functions; it is for the interesting values depending on the type of membership function, like the coordinates of the points of edge, the standard deviation, and so forth.The objective function is built to represent the fitness of a solution and is considered as an interface between optimization problem and the algorithm.In order to determine the fitness of the fuzzy model, the mean square error (MSE) is used (defined in (15)).The goal error for MSE is zero.
where () is desired output, ỹ() is calculated output of the proposed methodology, and N is number of pieces of data by the validation of model.

Proposed Methodology for PSO.
In this case, we represented the problem as is shown in Figure 9, where one particle can be divided into sections to represent the type and parameters of the membership function.
PSO is used to optimize fuzzy controllers for two cases.In one, PSO is used to optimize the FLC from the water control in a tank and in the other PSO is used to optimize the temperature control in a shower.They both used a set of 200 particles and 300 iterations and they perform 30 experiments.We use 200 particles and 300 iterations because after making several tests the best results were obtained with these values.In Section 3.6.3,we show a statistical test with the 30 experiments against ACO to validate in the best way the experimental results.The flowchart and pseudocode of the PSO algorithm are displayed in Figure 10 and Algorithm 1 of PSO, respectively, and the process is described as follows: (1) In the search space of the problem, we use random values for the positions and velocities of the particles; this is to create and initialize the population.
(2) The fitness (in the fuzzy controller) is evaluated for all particles using the established objective function, MSE.
(3) A comparison between the current fitness against the previous fitness of each particle is applied.If the current fitness is better than the previous fitness, then the current value is established for the pbest and the current position like the pbest position.(4) A comparison among the current fitness of each particle against the best global fitness (gbest) of the previous population is applied.If the current fitness is better than gbest, then the index and value of the current particle are established like the gbest.
(5) The evaluation is performed with the star topology: (5.1)In base to (3) and the proposed fuzzy inference system (Figure 3), the particle velocity is calculated.(5.2) Actualize the particle position using (1).( 6) Steps ( 2) to ( 6) are repeated until the algorithm reaches the maximum number of iterations or the best fitness is better than the desired value.

PSO for Water Level Control.
Figure 11 shows the graphical representation of the particles used for the optimization of the FLC for tank control.As it was mentioned before, we have implemented a set of subswarms of size of 27 particles, where we can see that each subswarm is formed with two value types, such as the type of membership function and parameter value corresponding to each variable (input-output).

PSO for Temperature Control.
Figure 12 shows the graphical representation of particles used for the optimization of the FLC from tank control.As mentioned before, we have implemented a set of subswarms of size of 40 particles, where we can see that each subswarm is formed with two value types such as type of membership function and parameter value corresponding to each variable (inputoutput).

Proposed Methodology for ACO. In the Ant Colony
Optimization algorithm, the problem to optimize must be represented as a combinatorial problem; in this case, the types of membership functions should be represented as a graph; it means that the potential values require to be represented as a graph.This is an important part, for the reason that ACO operates with this type of representation.Each node must be a possible solution that an ant can take.
The ant can consider each node like a potential solution to choose.At the end of the iterations, every ant will have a graph with the potential values to make the evaluation; in this graph, if we suppose that the problem to optimize is used to design a graph with q i nodes, the node value is determined as   with i as the variable index (i=1, 2,. .., n) and j as the number node for x i (j = 1, 2, q ij ).After the division, a network that is composed of variables and their division is constructed as depicted in Figure 13.
The flowchart for ACO is displayed in Figure 14, and the illustration of the ACO algorithm is shown in Algorithm 2 and the process is described as follows: (1) The ant colony is created and initialized with random positions.We set the initial parameters for ACO making several trial and error experiments.For each ant, construct a graph (for the fuzzy controller).
(1.1) The next node is selected in function to the probability obtained with (11).(1.2) Reduce the local pheromone trail (evaporation) according to (14) with the proposed fuzzy system (Figure 7).
(3) Steps ( 2) to ( 4) are repeated until the algorithm reaches the maximum iterations or the best fitness is better than the desired value.

Water Level Control in a
Tank.In this paper, the design of fuzzy logic control (FLC) is performed using Ant Colony System.Figure 15 shows the graphical representation of the potential solutions in the pheromone matrix used for the optimization of FLC from tank control, where the first node of the graph represents the nest and the food source is the last node.This implementation is structured with a total of 27 nodes, where each node is formed for a type of membership function or parameter value (input-output).

3.4.2.
Temperature Control in a Shower.We also used the Ant Colony System algorithm for this case.Figure 16 shows the graphical representation of the potential solutions in the pheromone matrix used for the optimization of FLC from tank control, where the first node of the graph represents the nest and the food source is the last node.This implementation is structured with a total of 40 nodes, where each node is formed for a type of membership function or parameter value (input-output).

Simulation Results.
In this part, the results of the optimization of the FLCs for the water level control and temperature control systems with Particle Swarm Optimization and Ant Colony Optimization are presented.For comparison purposes, we used FLCs provided by [22] which have not been optimized.

Simulation Results for the Water Level Control.
Figure 17 shows the fuzzy logic control (FLC) for the water tank without optimization, the type of membership functions, and their structure.
Figure 18 shows the original simulation in relation with the Mean Square Error (described in Section 3) obtaining an error of 0.0668 when the fuzzy system was not optimized, where ỹ is taken as the control signal,  as the reference signal, and N as the number of data points.

Simulation Results for Water Level Control with PSO.
The best experiments, with the smaller error of 0.026952, are presented in Figure 19; Figure 19 shows the behavior of the reference signal against the control signal in simulation for the optimization with PSO; the resulting new structures of membership functions after parameter optimization for the water tank FLC are shown in Figure 20.

Simulation Results for Water Level Control with ACO.
The best experiments, with a smaller error of 0.045792, are presented in Figure 21; Figure 21 shows the behavior of the reference signal against the control signal in simulation for the optimization with ACO; the resulting new structures of membership functions after parameter optimization for the water tank FLC are shown in Figure 22.
3.6.Simulation Results for Temperature Control. Figure 23 shows the fuzzy logic control (FLC) for the shower temperature without optimization, the type of membership functions, and their structure.Figure 24 shows the original simulation in relation with the Mean Square Error (described in Section 3) obtaining an error of 0.007013 when the fuzzy system was not optimized, where ỹ is taken as the control signal,  as the reference signal, and N as the number of data points.

Simulation Results for Temperature Control with PSO.
The best experiment, with a smaller error of 0.0003758, is presented in Figure 25; Figure 25 shows the behavior of the reference signal against the control signal in simulation for the optimization with PSO; the resulting new structures of membership functions after parameter optimization for the shower temperature FLC are shown in Figure 26.

Simulation Results for Temperature Control with ACO.
The best experiment, with a smaller error of 0.00076356, is presented in Figure 27; Figure 27 shows the behavior of the reference signal against the control signal in simulation for the optimization with ACO; the resulting new structures of membership functions after parameter optimization for the shower temperature FLC are shown in Figure 28.

Comparative Study of Optimized ACO versus Optimized PSO:
The Case of Temperature Control in a Shower.In this section, we included a statistical test to validate in the best way our approach between the ACO and PSO optimized methods.We made 100 experiments for the case of the temperature control with both methods.The following table shows the results with a Student's -test.We use 30 samples, selected randomly from the 100 experiments to make this test.We can see in Table 4 for this case that the ACO method was better than PSO because the T-value was -7.28; however, in Table 5, we can see that the 30 experiments and the values are very similar with both methods; however, some values of PSO are larger than 1, and for the ACO algorithm, the values are smaller than 1.Therefore, the differences for these two methods using optimized controllers were significant.

Conclusions
In this work, we have applied the Ant Colony Optimization (ACO) and Particle Swarm Optimization (PSO) metaheuristics for the design of fuzzy systems.For this purpose, we have adopted one ACO variant, namely, the Ant Colony System (ACS).Both algorithms, ACS and PSO, have changing For the ACS algorithm, the global and local evaporation of the pheromone is dynamically adapted using a fuzzy system.For the PSO algorithm, the inertia weight and the parameters c 1 and c 2 are adapted dynamically with a fuzzy system.The type of membership functions and the parameters of membership function of the fuzzy logic controllers for temperature control and water level control were optimized with ACO and PSO algorithms, respectively.The results of both optimization algorithms are compared.Those results show good solutions in comparison with the original problem that is not optimized.The use of metaheuristic algorithms is amply utilized in optimization of problems; for the benchmark problems of temperature control and water level control, the implemented fuzzy systems are used to adjust parameters of the ACO and PSO and improve the results of the algorithms.
As a general conclusion with the statistical test applied with both analyzed methods, we can demonstrate that, with the dynamic parameter adaptation, ACO and PSO can be good alternatives to solve some cases of control; the experimental results are very similar to the two optimized methods; however, for the case of temperature control in a shower, ACO was slightly superior to PSO.Also, there are other experiments to validate this approach with other cases, for example, the water tank control, and in some cases PSO is better than ACO.
For future work, we plan to hybridize these algorithms to compare results and test with fuzzy inference systems for different membership functions or implement type 2 fuzzy inference systems to enhance the results of the work.

Figure 2 :Figure 3 :
Figure 2: Membership functions for the inputs and outputs of the fuzzy inference system.

Figure 4 :
Figure 4: Fuzzy system to adjust the pheromone evaporation .

Figure 5 :
Figure 5: Fuzzy system to adjust the pheromone evaporation .

Figure 9 :
Figure 9: Example of the graphical representation of the PSO particles for the membership functions.

Figure 11 :Figure 12 :
Figure 11: Representation of the PSO for the optimization of membership functions.

Figure 13 :
Figure 13: Variable division and ant search path.
Two inputs: the value of Δ   and the pheromone trail   One output: the change in pheromone evaporation  Three membership functions for each input and output: LOW, MEDIUM, and HIGH, respectively, represented as membership functions of left triangle, middle triangle, and right triangle.
Figure 4 illustrates the fuzzy system to obtain the change in pheromone evaporation  Nine fuzzy rules are considered from which the changes in  are calculated.The rules are obtained by experimental knowledge as shown in Table

Figure 14 :
Figure 14: The flowchart of the ACO algorithm.

Figure 15 :
Figure 15: Representation of the potential solutions in the pheromone matrix for the water system.

Figure 16 :Figure 17 :
Figure 16: Representation of the potential solutions in the pheromone matrix for temperature system.
Figure 5 illustrates the fuzzy inference system to obtain the change in pheromone evaporation  Nine fuzzy rules are considered from which the changes in  are calculated.The rules are obtained by experimental knowledge as shown in Table 3

Figure 18 :Figure 19 :
Figure 18: Behavior of the water level in the tank with the FLC not optimized.

( 1 )
If (level is OKAY) then (valve in NO CHANGE) (2) If (level is LOW) then (valve in OPEN FAST) (3) If (level is HIGH) then (valve in CLOSE FAST) (4) If (level is OKAY) and (rate is POSITIVE) then (valve in CLOSE SLOW) (5) If (level is OKAY) and (rate is NEGATIVE) then (valve in OPEN SLOW)

( 1 )
If (temp is COLD) and (flow is SOFT) then (cold is OPENSLOW) and (hot is OPENFAST) (2) If (temp is COLD) and (flow is GOOD) then (cold is CLOSESLOW) and (hot is OPENSLOW) (3) If (temp is COLD) and (flow is HARD) then (cold is CLOSEFAST) and (hot is CLOSESLOW) (4) If (temp is GOOD) and (flow is SOFT) then (cold is OPENSLOW) and (hot is OPENSLOW) (5) If (temp is GOOD) and (flow is GOOD) then (cold is STEADY) and (hot is STEADY) (6) If (temp is GOOD) and (flow is HARD) then (cold is CLOSESLOW) and (hot is CLOSESLOW) (7) If (temp is HOT) and (flow is SOFT) then (cold is OPENFAST) and (hot is OPENSLOW) (8) If (temp is HOT) and (flow is GOOD) then (cold is OPENSLOW) and (hot is CLOSESLOW) (9) If (temp is HOT) and (flow is HARD) then (cold is CLOSESLOW) and (hot is CLOSEFAST)

Figure 20 :Figure 21 :
Figure 20: Membership functions optimized with PSO for the water tank FLC.

Figure 22 :Figure 23 :Figure 24 :
Figure 22: Membership functions optimized for the water tank FLC with ACO.

Figure 25 :
Figure 25: Behavior for the optimized temperature control FLC with PSO.

Figure 26 :Figure 27 :
Figure 26: Membership functions optimized for the temperature control FLC with PSO.

Figure 28 :
Figure 28: Membership functions optimized for the temperature control FLC with ACO.
Calculate fitness value IF the fitness value is better than p best id in history Assign current fitness value as the p best id END IF IF the fitness value is better than g best id in history Assign current fitness value as the g best id END IF END FOR FOR each particle i FOR each dimension d Calculate w, c 1 and c 2 with the fuzzy inference system Calculate velocity using the equation v id (k+1) = w v id (k) + c 1 Rand 1 (p idx id ) + c 2 Rand 2 ( x id )

Table 5 :
Experimental results with ACO and PSO.