Collaborative Learning using Fuzzy Inferencing (CLIFF) Part 1 Sponsored by: The National Science Foundation Grant ID No: DUE-0756921 University of Cincinnati AY-REU Program 2012 - 2013 Sophia M. Mitchell Junior Aerospace Engineering ACCEND Student, College of Engineering and Applied Science, University of Cincinnati, Cincinnati, Ohio, 45219 Dr. Kelly Cohen Mentor and Professor, Department of Aerospace Engineering, College of Engineering and Applied Science University of Cincinnati, Cincinnati, Ohio, 45219 Mitchell, 2 I. Goals and Objectives The overall research endeavor is to use type-2 fuzzy logic to create a team of robots that learn from their environment to work effectively and collaborate within an uncertain spatiotemporal environment. This overall objective will be met through completing three major tasks: 1. Developing type-2 fuzzy logic software in the MATLAB environment using theoretical literature as a guide. This software will then be verified through comparison and improvement of a determined benchmark problem. 2. Implementation of this new type-2 fuzzy logic software into the Collaborative Robotic PONG environment developed in FLIP. 3. Create a robotic coach that uses the new type-2 fuzzy software to learn from its opponent and use this intelligence to alter the logic of the players, allowing them to develop over time into a team that can beat its opponent. Both ideas of using fuzzy logic to alter fuzzy logic as well as having it “learn” over time from its environment will be two interesting, novel and useful developments. In the current research endeavor, the first task is being attempted. II. Research Methods A. Development of the fuzzy system Type-2 fuzzy logic is unique in that its membership functions not only come in different shapes but also in different sizes depending on if the mean or standard deviation is being varied and if so by how much. Therefore before performing any actual coding it was necessary to learn about the different types of type-2 fuzzy logic that exists, and from that understanding decide on what type of type-2 membership function would be used in the simulation. First, it was decided that a Gaussian primary membership function would make the most sense to use, as its gradual nature would allow for very smooth membership function outputs; something that is important for an effective and efficient decision making system. Research conducted by Baklouti, Robert and Adel [5] suggested that a type-2 system that varies in standard deviation is more effective in controlling a system than one which varies by mean, so it was decided to use a Gaussian function that varies along its standard deviation as can be seen in equation 1 below. (1) Finally, through studying a benchmark problem provided by Dongrui and Woei [2] it was seen that using a singleton type-2 system would be best for comparison with a type-1 system as the outputs are more similar. Finally it was decided that the type-2 system would be an interval system, which means that along the third dimension the type-2 membership functions would be constant which allows for a more simplistic function. B. Creation of MATLAB Code Mitchell, 3 Once the type of type-2 logic to use was decided upon, it was then necessary to create a toolbox in MATLAB for the type of type-2 logic that would be used. Several matlab functions had to be created including the functions that determine the shape and effects of each type-2 membership function, as well as the function to communicate between the system being controlled and the type-2 system. The MATLAB code works as follows: an input Figure 1: Schematic diagram of the dynamic system is taken into the fuzzy system where it is then being controlled for the benchmark problem. Note: fuzzified by the type-2 fuzzy membership probes do not restrict or effect water flow. functions. These membership functions are more complex than type-1 functions since a crisp input point results in a fuzzified set of numbers. Therefore a special MATLAB function was necessary to determine (1) overlapping membership function results and (2) what rules would be fired as both of these steps are extremely different and much more complex than a similar situation in a type-1 system. The firing of the rules creates an array which is then type reduced; a step that is unique to type-2 fuzzy logic. Type reduction takes the array from the rules and turns it back into a set of numbers that can then be defuzzified to produce a crisp output from the system. The system was then tested manually with a few points to determine if the results it produced at least made sense before attempting to have it solve an entire system iteratively in the benchmark problem. These results are discussed in the results and discussion of this paper. Creating the entire toolbox for just this one type of type-2 fuzzy logic was extremely time consuming, but very rewarding as it provided the researcher with a much better understanding of the inter-workings of type-2 fuzzy logic. Developing the toolbox to be able to compute more types of type-2 systems would be a very useful future endeavor. C. Verification with the Benchmark Problem In order to fully verify that the created type-2 system and toolbox were in true working order, it was necessary to re-create a simulation environment for testing that had results for comparison. For this, the problem presented by Dongrei and Woei [2] was used, as it had a straightforward problem scenario, included the dynamic equations that control the dynamic system and had interesting results for comparison. To start, the dynamic scenario had to be re-created in a MATLAB environment. The presented scenario was that the type-2 system was to control the flow rate of water being pumped into a set of drums which are divided by a wall. There are holes in the bottom of both drums as well as a space in the wall for water to flow into the second drum, as can be seen in Figure 6. In order to simulate this dynamic system, some equation manipulation was necessary in order to use the equations given in the text with the MATLAB ode45 solver. The ode45 solver uses a RungeKutta method in order to bring a set of differential equations to their solution iteratively. The following differential equations (Equations 2 and 3) were given to describe the system, where H1 is the height of the water in drum one, and H2 is the height of the water in drum two. Mitchell, 4 𝑑𝐻1 𝐴1 𝐴2 𝑑𝑡 𝑑𝐻2 𝑑𝑡 = 𝑄1 −∝1 √𝐻1 +∝3 √𝐻1 − 𝐻2 (2) = −∝2 √𝐻2 +∝3 √𝐻1 − 𝐻2 (3) A was the area of each drum, while α was a constant for the amount of water lost through holes in the bottom of the drums. These constants could be defined as follows: A1=A2= 36.52 cm2, α1= α2=5.6186 and α3=10. Each of these equations was then used to derive the following differential equations which define the height of the water in drum one and the change in that height in terms of the height of the water in drum two. This derivation was necessary as the optimization of the problem was to fill drum two to a certain height; not drum one. 𝑑𝐻1 2 ∝ 3 (4) = 2 [𝐴2 𝐻̇2 +∝2 √𝐻2 ] ∙ (𝐴2 𝐻̈ + (𝐻2 ) ⁄2 ) 𝑑𝑡 2 ∝3 + 𝐻̇2 1 𝐻1 = [𝐴 𝐻̇ +∝2 √𝐻2 ]2 (5) ∝3 2 2 + 𝐻2 Equations 4 and 5 were then combined and inserted into equation two to create equation 6. 2 𝑑𝐻 ∝ 𝐹 = [ 𝑑𝑡1 − 𝐻̇2 ] − 23 ∙ (𝐴 1 ̇ 𝐻 +∝ 2 2 2 √𝐻2) (6) From this equation the following solution for Ḧ was then derived. 𝐻̈ = −∝2 2𝐴2 (𝐻2 ) 3⁄ 2 +𝐹 (7) The MATLAB model could then use equation 7 in the ODE45 solver to simulate the solution for the benchmark problem. This whole system was tested with a type-1 system to ensure its reliability, as can be found in the results. III. Results The results produced by this study are as follows. First the software was tested to see if it created useful Gaussian singleton interval type-2 fuzzy membership functions. The system created both input membership functions which can be found in Figures 3 and 4 below. Mitchell, 5 Figure 2: Produced type-2 membership functions for input variable E Figure 3: Produced type-2 membership functions for input variable Edot The creation of the membership functions was considered a success, and when tested manually with inputs the system produced results from these membership functions that made sense for the filling and control of water level in a drum, meaning that a low amount of water resulted in a higher filling rate, and a situation in which the drum was overflowing resulted in no fill rate (so the water would drain out). Before comparing this type-2 system to the benchmark problem, it was first necessary to solve the problem using the more familiar type-1 system to ensure that the differential equation solver (ode45) was being implemented correctly in MATLAB to produce correct results. This verification would then ensure that any changes or discrepancies between data would be a result of a change in the type-2 system and not because of an error in the simulation. Figures 5 and 6 Mitchell, 6 are plots of the benchmark problem results obtained by the previous researcher, and results obtained by the system that was created for this project. Figure 4: Results obtained by the benchmark problem paper Figure 5: Results obtained by this study One can see that both systems fill the drum to the target height of 15cm; however, the results for this project do not overshoot the limit. It can also be seen that both results fill the drum in roughly the same amount of time. IV. Computer Software and Training This project utilized a University of Cincinnati licesnsed version of MATLAB 2012. The student was already quite familiar with this software coming into the research project and therefore did not need any formal training on its basic use. However, a type-2 fuzzy logic toolbox was needed in order to complete the research. As this toolbox did not exist at the time of the research, the student took it upon them to create this toolbox, which is generally outlined in the methods section of this paper. In order to create this toolbox the student had to self-teach type-2 fuzzy logic with the help of their mentor as no classes and few textbooks exist on the subject. V. Discussion and Conclusion The data suggests two things: the type-2 MATLAB fuzzy logic toolbox that has been created during this research gives results which make sense, and that the simulation created for Mitchell, 7 the benchmark problem to verify this type-2 system works. Sadly, due to time constraints the type-2 system could not yet be tested for results. Nevertheless, some interesting ideas did come from the results that were produced. First, it is interesting to see that with a simple type-1 system, this research project was able to produce results with a type-1 system that were almost better than the results produced by the type-2 system in the benchmark problem. This was a very interesting note because the whole argument for using type-2 fuzzy logic is that it is supposed to perform better than a type-1 system. If the type-1 system produced by this project could be improved and then compared, this whole reasoning for using type-2 falls apart, unless that simply means a much better type-2 system could also be created. Therefore future work will include not only improving the type-1 system to see what results could be obtained, but also improving the type-2 system to see how much better it really is. In conclusion the creation of a type-2 fuzzy logic toolbox for a Gaussian singleton interval type-2 fuzzy Inferencing system was considered a success, as well as the creation of the simulation environment for the benchmark problem. Future work will include several goals: finding the best possible solution to the problem using both type-1 and type-2 fuzzy logic systems, as well as implementing the type-2 logic into the aforementioned fuzzy PONG game if said logic does prove to be a better solution than type-1. VI. Acknowledgements I would like to thank my mentor, Dr. Kelly Cohen, for all of his wisdom and support while I perused this endeavor. I would also like to thank the University of Cincinnati AY-REU program as well as NSF for funding me and providing me with a framework with which I could conduct this research. Finally I would like to thank my family and friends for the moral support as I worked through teaching myself type-2 fuzzy logic. VII. References [1] Baklouti, Nesrine, Robert John, and Adel Alimi. "Interval Type-2 Fuzzy Logic Control of Mobile Robots."Journal of Intelligent Learning Systems and Applications. 4.November 2012 (2012): 291-302. Web. 18 Feb. 2 013. [2] Dongrui Wu, Woei Wan Tan, “Genetic learning and performance evaluation of interval type2 fuzzy logic controllers, Engineering Applications of Artificial Intelligence”, Volume 19, Issue 8, December 2006, Pages 829-841, ISSN 0952-1976, 10.1016/j.engappai.2005.12.011. (http://www.sciencedirect.com/science/article/pii/S0952197606000388) [3] Mendel, Jerry. Uncertain Rule-Based Fuzzy Logic Systems: Introduction and New Directions. Upper Saddle River, NJ: Prentice Hall PTR, 2001. Print. [4] Castillo, Oscar, and Patricia Melin. Type-2 Fuzzy Logic: Theory and Applications. 1. Heidelberg: Springer, 2008. Print. [5] Castillo, Oscar. Type-2 Fuzzy Logic in Intelligent Control Applications. 1. Heidelberg: Springer, 2012. eBook. VIII. Appendix A - Pictures Mitchell, 8 Figure 6: Brainstorming area Figure 7: Sophia, working on her research Mitchell, 9 Figure 8: Sophia, working on her research Figure 9: A screen shot of a sample output from the research project