A New Proposed Pendulum-Like with Attraction-Repulsion mechanism Algorithm for Solving Optimization Problems

This work aims to contribute to the domain of new modification in electromagnetism-like (EM) algorithm, which will be referred to in this work as pendulum-like with attraction-repulsion mechanism algorithm (PA). PA algorithm has been constructed with the purpose of solving inverse kinematics (IK) problem. The proposed new algorithm mimics the concepts of a simple physical pendulum and is derived as a local search in order to promote the performance of the EM algorithm. Comparisons between the suggested PA with the available algorithms, such as genetic algorithm (GA) and EM were conducted using two mathematical test functions. On top of the testing, the PA algorithm is tested to solve the problem of IK for a four degree-of-freedom (DOF) planar robot. The simulation results indicate that the PA algorithm outperforms other approaches in terms of accuracy and the speed of convergence through the errors and the decreasing of objective with iterations as mention in presented tables and figures, on top of being able to successfully solve the IK problem with multiple robot configurations.


Introduction
Inverse kinematics (IK) problem is a very important topic in robotic systems [1], as it is used for trajectory planning and motion control of the robot. In recent research, artificial intelligent has been applied in order to ease and optimize the solution of IK. Kalra et al. [2] suggested an evolutionary technique for industrial robot in order to solve the inverse kinematics which is depended on genetic algorithm (GA) of single-level. The authors utilized the fitness function in the suggested approach, they explained this function in a way that needs isolation of evaluation of the error of position and the displacement of total joint. Utilizing a niche method, they earned population candidates with arrangement which is satisfied around the multiple solutions of inverse kinematics, this is in a manner of selection binary tournament selection operation is used with restriction mating. The Scara and Puma are two types of robotics used to examine this method. For every point of the target, the first robotic configuration comes up with one or two solution. Four solutions for every location of the wrist are given by the second robotic type. Using niching method 1 and niching method 2, the authors proposed for the wrist a minimum errors of position for the resulted values of the variables of the joint. In niche method 1 for Scara, the range of the errors of position between 0.4-2.19 mm while for niche method 2 within 0.14-0.69 mm. Meanwhile, niche strategy 2 ended up with lesser positional errors compared to niche strategy 1. Moreover, in their work, for Puma with niche method 2 the error is between 0.36-1.91 mm. In order to reach to the optimal solution in the case of Scara robot about 100 generations are  [3] utilizing the Neuro-Fuzzy. As training data in their work, the Cartesian coordinates and angles used to learn the adaptive Neuro-Fuzzy inference system (ANFIS). They utilized the back-propagation (BP) neural network-like structure as performer for fuzzy inference system to execute ANFIS. In order to prove the efficiency of the suggested technique, it is examined by two simulation examples of 2-DOF (degree of freedom) and 3-DOF. The technique of adaptive particle swarm optimization (A-PSO) concerted the equations of kinematics is given by Zang et al. [4]. Inverse kinematics of serial manipulator is solved by this method. Because of the PSO is easily track down in the local optima and needs size with large candidates , the authors changed the classical PSO. The combinatorial matrix deviation from the end of the robot to the goal is the utilized fitness function. The complication of the analysis of inverse kinematics can be decreased by the introduced approach, which renders the adaptive solution obtainable. They compared their method with the traditional PSO algorithm, and the efficiency of the proposed method is demonstrated in the case study. Yin et al. [5] have been developed a method for solving the inverse kinematics problem for robot, especially for those manipulators with high-dimensional nonlinear kinematics equations. They transform the IK problem into a minimization problem. Then, an Electromagnetism-like (EM) method is used to solve this equivalent problem. Moreover, in order to further improve the accuracy of the EM algorithm, a hybrid method, which combines EM with the Davidon-Fletcher-Powell (DFP) method, is proposed. The EM complexity is independent on the characteristics of the kinematics equations, involving dimensionality and the degree of nonlinearity. Moreover, EM can be used as an accompanying algorithm for the DFP method in order to obtain better precision at a lower iteration number. EM algorithm is a good choice in solving continuous problems [5].It is derived from the attraction-repulsion theory of physics, and is classified as a population based algorithm [6]. It is capable of a faster solution approximation compared to other algorithms [7], and is also fairly accurate [8]. The local search is one of the important steps in EM algorithm. Without it, the particles would lack the local information, which makes it difficult to obtain the local optimums [9]. The efficiency of simple random local search applied is low [10]. It is random, and one of its drawbacks is that it is incapable of evading the local optima [11]. In this paper, a new method contributing to the field of robotics has been proposed to effectively solve the inverse kinematics for robot manipulator. The remainder of the paper is divided as follows. Section 2 and Section 3 provides the definition of EM and the proposed methods; Section 4 details a brief four test functions, which are used for comparison; Simulation results have been presented in section 5 for all methods; and the work will be concluded in Section 6.

EM Algorithm
In order to direct the solutions to the optimal position , this algorithm is used. It is utilized the attraction-repulsion technique [12,13,14 ]. The procedures of EM are set in figure1 [15,16].

Modified EM Algorithm with Concentrated Local Search
This is the first proposed modification which does not mention before, a population of 10 particles is randomly distributed in the search space with the objective function values shown in figure 2. The current best solution is chosen according to the objective function value at the current moment. Subsequently, the procedure would start with global search by calculating the forces which would be used to move the particles as shown in figure 3. This is because the global search is used to discover the entire search space or its approximation [17].Then, the Concentration Local Search (CLS) in the neighbourhood of the current best solution is obtained after the global search process. This would help to fine tune the best solution and give better convergence as shown in figure 4. Thereafter, the population would be randomized again while the current best solution is stored for the next generation. The randomization step helps the particle to avoid being stuck in local optima or to obtain a better position solution.  Therefore, instead of doing the neighbourhood search for the particles which are far from the target, concentrated search performed for current best particle will be focusing on the solutions in the neighbourhood the best particle. Figure 5 illustrates the flowchart of MEMC algorithm.
The pseudo code for CLS is shown in figure 6. This local search also uses adaptive local search parameter and it will search the neighbourhood for the current best solution only. It will concentrate the search for the current best solution according to the value of counter.

Pendulum-Like with Attraction-Repulsion Mechanism Algorithm
In order to solve the problems which are complex, a robust method should be provided. The proposed integration between attraction-repulsion mechanism and pendulum-like algorithm is introduced. This also enhance the ability of the searching algorithm with a minimum drawbacks. Hence the procedures of the attraction-repulsion mechanism and movement are still as in the traditional electromagnetismlike. PA algorithm steps are shown in figure 7, while the pseudo code of the method is shown in figure  8.

Mathematical Test Functions
In the context of this work, mathematical test functions are utilized for the purpose comparing the performance of proposed algorithms. But there is no standard list of test functions one has to follow [18]. For the subsequent subsections, the details of each of the test functions utilized would be discussed in brief [18], where a two-dimensional plot of two common functions which are:

De Jong's Function
De Jong's function is defined as in equation 1, while the two-dimensional plot is shown in figure 9.  Figure 9. A two-dimensional plot of De Jong's function

Rastrigin's Function
Rastrigin's function is mathematically defined as in equation 2, while the two-dimensional plot is shown in figure 10.
And at . While , , the twodimensional plot for the function is shown in figure 11.
And at . While , , the twodimensional plot for the function is shown in figure 12.

Simulation Results
The development of EM algorithm and pendulum-like with attraction-repulsion mechanism algorithm, has been performed in the previous sections. In this section, the simulation results for all methods exactly the PA algorithm has been presented and compared. The details required are shown in table 1, where the specifications of GA are selected after many tests.    PA algorithm outperforms all the other methods and even if at very early iterations it seems to be comparable to MEMC but it is much less processing time.   figure 16, EM and GA are comparable up to about 200 iterations. MEMC is much better than MEMA, EM, and GA in this test most probably because of the Concentrated Local Search operator which is used to enhance the solution further. PA algorithm performs the best between all the other methods which shows the powerful of using the Pendulum-like algorithm.

Simulation Results of Inverse Kinematics
The number of iterations in the proposed methods is 1000. The parameter is 0.00001 while the chosen value of is 100 after several runs. The parameters and are 2, 0.05, and 1, respectively; which were also obtained after running some tests. Figures 17 and 18 and table 3 show the comparison between GA, EM, MEMA, MEMC, and PA for two suggested goal points. Figure 17 were captured after solving the IK using the above mentioned methods at the end effector position which is (100, 50) cm where this point is selected according to the robot workspace and suitable with the robot dimensions, GA converges faster than EM algorithm for about the first 400 iterations. Then, the EM algorithm enhances rapidly from about 500 to 600 iterations. After that, it converges slowly and reaches average error of 1.69E-6 cm. MEMA and MEMC algorithms are close to each other with better convergence for MEMC at the beginning of the simulation and slightly better accuracy for MEMA algorithm at the end of the simulation. PA algorithm is outperformed the others in terms of high speed convergence and very low positional error which is 3.50E-9 cm.  The performances of the GA and EM, MEMA, MEMC, and PA algorithms at the task point of (50, 60) cm which is a new point and suitable for the situation of the robot are shown in figure 18 and table 3. The worse result is obtained by GA which is 4.13E-3 cm while best algorithm with an accuracy of 1.37E-9 cm is PA algorithm.

Effect of PA on the Behavior of the Population during the Optimization
The number of iterations of PA algorithm for this test is 1000. The constant is set to be 2. The point mass and the gravity constant are 0.05 and 1, respectively. The first test was carried out on the target point of (100, 50) cm. figures 19 (a), 19 (b), and 19 (c) show the whole population movement towards optimal position. figures 20 (a), 20 (b), and 20 (c) show the behavior of the algorithm at the second target, which is (90, 60) cm. At beginning, the workspace will initialize with new random population. Search the convergence of the best particle will happen after a few generations, when the algorithm get about back and forth. The desired position will be near the current best solution and a group of particles. So as to get so near solution to the desired point in every generation, the produced solution which has the superiority to the current best solution, will be changed with the current best solution.

Conclusion
EM algorithm is an effective optimization method. However, it requires better performance local search in order to fine tune and further improve its result. Instead of using additional gradient or other local search, a powerful and newly developed local search namely pendulum-like algorithm has been replaced the local search of original EM and produced the PA algorithm. This algorithm has been tested on mathematical test functions and also used to solve for IK in planar robot. In both cases, the results of PA algorithm are compared with original EM algorithm and GA. The proposed PA algorithm performs better, and it is not easily trapped in local optima, due to the combination of directed force with the back and forth principle. In this research, a simulator package has been designed and developed in order to illustrate the continuous enhancement in PA solutions by some iterations, in the inverse kinematics. As a conclusion, the proposed PA is able to provide different solutions at each task point of the robot with higher accuracy and faster convergence speed. Hence, different applications have given been given here for proposed PA which are the mathematical functions and IK. However, additional applications can be solved by this algorithm such as the optimal path for robot , optimal parameters for the photovoltaic model.