Applications of Artificial Intelligence Techniques to Enhance Sustainability of Industry 4.0: Design of an Artificial Neural Network Model as Dynamic Behavior Optimizer of Robotic Arms

Industrial robots have a great impact on increasing the productivity and reducing the time of the manufacturing process. To serve this purpose, in the past decade, many researchers have concentrated to optimize robotic models utilizing artificial intelligence (AI) techniques. Gimbal joints because of their adjustable mechanical advantages have been investigated as a replacement for traditional revolute joints, especially when they are supposed to have tiny motions. In this research, the genetic algorithm (GA), a well-known evolutionary technique, has been adopted to find optimal parameters of the gimbal joints. Since adopting the GA is a time-consuming process, an artificial neural network (ANN) architecture has been proposed to model the behavior of the GA.(e result shows that the proposed ANNmodel can be used instead of the complex and time-consuming GA in the process of finding the optimal parameters of the gimbal joint.


Introduction
In the definition of the sustainable economic model, natural resources such as energy and material are considered as limited resources. Industrial robots can be utilized as a potential solution for the issue by increasing the productivity and reducing the wastes which results in the reduction in emission and contributing to sustainability [1]. In the past decade, designing more precise and accurate robots has been a point of research interest of many scientists. In particular, many research studies have been concentrated to utilize artificial intelligence (AI) techniques to contribute to economic and environmental sustainability [2][3][4].
A variety of novel techniques such as ring probabilistic logic neural networks (RPLNNs) [5], genetic algorithms (GA), particle swarm (PS), hybrid algorithms, and agentbased algorithms have been presented by researchers to provide an approximate solution of the synthesis of mechanisms [5,6]. In 2017, Soldberg [7] investigated the possibility of object detection in agricultural robots via deep neural networks. Jin et al. [8] presented the special form of neural networks to optimize the redundant manipulators. Fuzzy wavelet ANN approach has been utilized by Yen et al. [9] in 2017 to control the industrial robot manipulator using fuzzy wavelet neural networks. Also, in 2018, they adopted recurrent fuzzy wavelet neural network approach to control the manipulator [10].
In this paper, an ANN architecture has been adopted to model the behavior of the GA optimizer in the process of finding the optimal parameters of robotic arms equipped with a gimbal driver. e research presents a novel approach in the training process of ANN by adopting data of genetic algorithms (GAs) to train the proposed ANN, so at the end of the training process, the proposed ANN acts as a function optimizer instead of GA. In this research, MATLAB software has been utilized to generate the ANN model and perform the GA optimization process. It is important to highlight the point that other effective optimization techniques such as PSO, bee colony, and RPLNN can be adopted to train the proposed ANN, and GA has been utilized just as an example of an optimization technique.

Methodology
e ultimate aim of this research is to develop an ANN model as a function approximator which is able to model the dynamic behavior of the GA optimizer in the process of finding the optimal parameters of gimbal drive in robotic arms.
Different from previous works, the designed ANN has not been trained by the general extracted data from the mathematical model of the robotic arm, but its reference model is the GA as the parameter optimizer of the gimbal equipped robotic arm model. It means that the proposed ANN should act as a function optimizer and will eliminate the need of utilizing optimization techniques.
To reach this goal at the first step, the behavior of the gimbal drive should be modeled mathematically, and the next step is utilizing the introduced gimbal drive in 3 different well-known robotic arms and introducing the related mathematical models. e third step is to find the optimum design parameters utilizing GA which is one of the wellknown AI evolutionary techniques. e last step which is the novelty part of this research is to design and train an ANN to act instead of the optimization algorithm, GA. e proposed approach has been illustrated as a flowchart in Figure 1.
To fulfill the task, the rest of the manuscript has been prepared in the following sequence: a brief introduction of gimbal mechanisms is presented in the next section. Also, the resistivity ellipsoid is formulated to measure the manipulability of robotic arms. Next, to be able to apply maximum force in a desired direction, genetic algorithm (GA) as one of the well-known evolutionary optimization techniques has been employed to optimize the highly nonlinear fitness function. As GA is very time-consuming, an artificial neural network (ANN) as the novelty of this research has been utilized to learn the relation between the inputs and outputs of GA. e ANN is trained using the optimization results obtained from GA in several randomly generated configurations. us, the trained ANN could replace the whole optimization process and act as a function optimizer. is way enables utilizing the trained ANN model to obtain the optimized results for new configurations instead of the GA optimizer. To have a better perception of the effectiveness of this method, three simple robotic arms are selected to investigate the task. Figure 2, a regular one-degree-offreedom gimbal drive is shown. Following is the governing equation on gimbal mechanism [11]:

e Gimbal Drive. In
where θ in is the input angle (angle of rotation of vertical shaft), θ out is the output angle (angle of rotation of the horizontal shaft/frame), θ c is the gradient of the truncated cylinder, and θ of_out is the offset angle at the output. It can be deduced that the gradient of the truncated cylinder, θ c , is a design parameter because it sets the range of output angle. Verity is that, for any input value (θ in ), there exist two possible output configurations (θ out ), which is another advantage of the gimbal mechanism. e effect of the reduction ratio should be considered too. We also should notice that the gradient of θ c is a design parameter because it will set the range of the output angle.
To study manipulability modality, the classical criterion of resistivity ellipsoid is formulated for manipulators with traditional revolute joints. It is compared to the same modality of the same arm in which some joints are substituted with gimbal transmissions.
To have the maximum achievable force at the manipulator tip point, the classical hypothesis is to assume that the Euclidian norm of the joint torques remains unity [11]: (2) e relation of the task-space force F and the vector of joint torques τ is given by [11] τ � J T F, where J is the Jacobian of the whole manipulator. By substituting (3) in (2), one obtains the following equation: Relation (4) changes the hypersphere of the joint forces (2) into a hyperellipsoid that is called the resistivity ellipsoid.
is method is largely employed to evaluate the manipulability qualities of robotic arms.
Here, achieving greater force in a specified direction by using the gimbal mechanism is the main goal. e task-space force vector is expressed as [11] where f is the magnitude of F and dx dy dz T are the unit vectors on the direction of f along X, Y, and Z axes, respectively, and to maintain conciseness, substitute by F. Substituting (5) in (4) yields the following equation [11]: us, the magnitude of the applicable force in a desired direction at a specific point of manipulator's workspace should be determined. Comparing the magnitudes of the applicable force, f, for different types of manipulators, would lead to recognizing the efficient robot design and whether using gimbal transmission instead of the traditional revolute joints improves robot's manipulability or not.

Case Studies
(1) RRR Arm. To get numerical examples, three case studies have been performed. First, a spatial robot with three revolute joints (RRR or 3R) shown in Figure 3 is investigated to analyze the advantages of gimbal drive in robot joint transmission. For convenience, Now it is desired to use gimbal transmissions at joints 2 and 3. To obtain a new Jacobian matrix, one shall substitute for θ 2 and θ 3 of the 3R spatial robot. Assuming θ of_out � 0 and θ c � 45°, the Jacobian matrix for the manipulator with gimbal transmissions at joints 2 and 3 becomes [11] where J G is the Jacobian of the manipulator when a gimbal transmission is used at joints 2 and 3. Using manipulability ellipsoid, f in the simple and gimbal equipped 3R spatial robots has been compared by Mohammadi et al. [11].
Using gimbal drive at joint 2, the new Jacobian matrix is obtained by substituting from (1) for θ 2 in (11). Assuming θ of_out � 0 and θ c � 45°, the following Jacobian matrix is derived [11]: where J G is the Jacobian of the manipulator where a gimbal transmission is used at joint 2. Using manipulability ellipsoid, we compare f in the simple and gimbal equipped Stanford arm with traditional revolute joints and the arm equipped with gimbal transmissions at revolute joint 2. To this end, d 3 (the joint variable of the arm's mere prismatic joint) is set to 1 m. e direction of the desired force vector is assumed to be dx � dy � dz � 1 [11].
(3) RPR Planar Arm. Figure 5 shows a revolute-prismaticrevolute (i.e., RPR) planar manipulator. e Jacobian matrix for the arm, assuming L 1 � 1 m and L 2 � 0.5 m, is as follows [11]: Gimbal transmission is used at joint 3 by replacing the traditional revolute joint. To obtain a new Jacobian matrix, one shall substitute from (1) for θ 3 of the robot. Assuming Figure 4: Stanford arm [11]. 4 Complexity θ of_out � 0, the Jacobian matrix for the manipulator with gimbal transmission at joint 3 becomes [11] where J G is the Jacobian of the manipulator when a gimbal transmission is used at joint 3. To maintain conciseness, the elements of J G are not shown here.

Genetic Algorithms.
Genetic algorithm is one of the wellknown evolutionary optimization techniques, which has been adopted by many researchers to optimize complex problems [12][13][14]. Briefly, the optimization process by GA can be divided into 6 steps as follows [15]: (1) Creating population of possible answers (2) Evaluation of fitness function (3) Creating the next generation of possible answers (4) Applying crossover (5) Applying mutation (6) Repeat steps 2-5 In this research, genetic algorithm has been utilized to find optimal parameters of the gimbal joints (truncation angles). For this purpose, the population generation techniques as listed above have been explored to generate the new population of the weight matrices. is process continues until the selection of the last weight matrix or matrices has been performed. In this simulation, a population of weight matrices is produced randomly when the GA starts. In each generation, the matrices of this population have been modified through discrete crossovers and uniformly random mutations, and their fitness values have been evaluated. e cycle of reconstructing the new population with better individuals and restarting the search is repeated until a better solution is found. e fitness function has been defined as maximizing the applicable force magnitude, f, by minimizing the parameters of equation (6) [16]. To this end, to generate the fitness function for each of the three robotic manipulators (RRR, RPR, and Stanford), it is needed to substitute Jacobian matrix of each of the case studies, equations (9), (12), and (14) in equation (6) [16]. en, the optimization process has been started with a population of 20 individuals and has been run for 1000 times. As it is shown in Table 1, the probability of happening of crossover and mutation has been assumed as 0.4 and 0.01, respectively.

Neural Networks.
Artificial neural networks have been utilized to different engineering and science fields such as control, data processing [17], robotics [18], function approximation [19], and pattern and speech recognition [20]. An ANN consists of interconnecting neurons which have been categorized into three layers which are, namely, input layer, hidden layer, and output layer [21]. ere could be more than one hidden layer in an ANN making it more flexible and accurate to learn at the cost of learning time and effort.
Based on the type of connections between these neurons, artificial neural networks can be divided into two different groups: weighted artificial neural networks and weightless artificial neural networks [22].
is research focuses on utilizing weighted neural networks as a function optimizer.
As seen in Figure 6, parameters of the networks should be adjusted to enable the network to act as the plant (reference model). It means that by giving the same input to the ANN and the plant, the output of the network should be similar to the output of the plant. e first step in training a feed-forward network is to create the network object. It requires three arguments and returns the network object. e first argument is a matrix of sample R-element input vectors. e second argument is a matrix of sample S-element target vectors. e sample inputs and outputs are used to set up network input and output dimensions and parameters. e third argument is an array containing the sizes of each hidden layer (the output layer size is determined from the targets). In this research, the mentioned unknown function is the GA optimizer. e proposed ANN consists of a sigmoid hidden layer and a linear output layer.
Parameters of the ANN have been adjusted to enable the ANN to act as the GA optimizer (reference model) which optimizes the performance index of gimbal equipped robotic arm. It means that by giving the same input to the ANN and the GA, the output of the network should be like the output of the GA which is the evaluated fitness function. It means that the proposed ANN has a single input-single output (SISO) architecture. Levenberg-Marquardt algorithm has been adopted here to train the proposed ANN to model the dynamic behavior of the GA optimizer of the gimbal equipped robotic arms. e input of ANN is a Jacobian matrix with the dimension of 3 * 3 and its output is the matrix of the calculated maximum force with the demotion of 1 * 1.
Levenberg-Marquardt algorithm computes the approximate Hessian matrix, which has dimensions n-by-n. Gradient descent is the process of making changes to weights and biases, where the changes are proportional to the derivatives of network error with respect to those weights and biases. is is done to minimize network error. When the performance function has the form of a sum of squares (as is where J is the Jacobian matrix that contains first derivatives of the network errors with respect to the weights and biases and e is a vector of network errors. e gradient can be computed as

Results
As described previously to find the maximum value of f in each of the introduced case studies, GA optimization technique has been adopted in this research. e process has been started with a population of 20 individuals and has been run for 1000 times and the probability of happening of crossover and mutation has been assumed as 0.4 and 0.01, respectively. e results for normalized fitness function values of each of the robotic arms in each iteration of the GA optimization process have been shown in Figure 7. It can be observed that the optimization process for all the three cases works properly and normalized fitness values have been increased in each iteration. Table 2 shows the results achieved by running GA for four different joint values and directions based on the fitness function of RRR arm which is used to evaluate and optimize the maximum values for f, and also it compares the amount of maximum force in gimbal equipped RRR robot with the robot with revolute joints. It is shown that in these points, the amount of force delivered by the gimbal equipped robot is greater than the same quantity for the robot that uses revolute joints. us, it can be reasoned that gimbal drive has improved the manipulability of the robot. Here, the values of θ c2 and θ c3 are restricted to 10 to 85 degrees so that the design becomes feasible. Table 3 shows the results achieved by running GA for four different joint values and directions based on the fitness function of RPR arm which is used to evaluate and optimize the maximum values for f. It can be inferred from results that implementation of gimbal drive in joint 2 has increased the maximum achievable force at the tip point of the manipulator. Here, the value of the truncation angle is bound to ensure design feasibility between 49 and 85 degrees. Table 4 shows the results achieved by running GA for four different joint values and directions based on the fitness function of Stanford arm which is used to evaluate and optimize the maximum values for f. e amount of maximum force in gimbal equipped robot has been compared to      6 Complexity the robot with traditional revolute joints and shows that in these points, the amount of force exerted by the gimbal equipped robot is greater than the same quantity for the robot that uses traditional revolute joints. us, it can be reasoned that gimbal drive has considerably improved the manipulability of the robot. Here, the value of the truncation angle is bound to ensure design feasibility between 10 and 85 degrees. Now, by having the optimized results of the GA, the training of the proposed ANN can be performed. Basically, since the GA has been utilized to optimize three different case studies which have different Jacobian matrixes, three different ANNs have been trained for each of the robotic arms. It is important to know that since the number of the hidden layer's neurons should be chosen arbitrary, in this research the effect of increasing the hidden layer neurons has been investigated for 15, 20, and 25 neurons, and also the training mean square error limit has been defined as 0.9. Figure 8 shows the ANN training results for RRR arm with assuming 15, 20, and 25 neurons in the hidden layer.
From Figure 8, it can be observed that by increasing the number of neurons from 15 to 20, training of the ANN has been finalized in fewer steps, but the training mean square error has been increased and it makes the simulation result worse. On the other hand, by increasing the number of neurons from 20 to 25, training of the ANN has been finalized in fewer steps, and the training mean square error has been decreased even it is less than the case with 15 neurons and it makes the simulation result better.
Training results for RPR arm with assuming 15, 20, and 25 neurons in the hidden layer have been illustrated in Figure 9.
In Figure 9, although the results show that the trainings were successful, they do not follow the previous path as described for RRR. e difference is in the accuracy of the simulations results which indicate that by increasing the neurons in the hidden layer, training time and iterations will be reduced, but the mean square error of the ANN with 15 neurons is the lowest one, so the related ANN has a superior performance in comparison with the other two.
Training results for Stanford arm with assuming 15, 20, and 25 neurons in the hidden layer have been illustrated in Figure 10.
e results shown in Figure 10 are completely different from the results of RRR and RPR; also, the designed ANN shows different behavior. Like the previous two cases, it can be observed that by increasing the number of neurons in the hidden layer, the training iterations have been increased. Here, different from the results for RPR and RRR, the training mean square error has been decreased by increasing the number of neurons in the hidden layer. It means that the ANN with 25 neurons in the hidden layer has the best performance than the other two. e summary of all these observations has been shown in Tables 5-7. e results indicate that the behavior of the proposed ANN cannot be predicted by the number of hidden layer's neurons, but one thing is obvious, and it is the fact of the proposed ANN working properly.   Generally, following points regarding the training procedure of the proposed ANN for all three robot arms with three different number of neurons in the hidden layer for each case study can be observed from Tables 5-7. 1000 random points (inputs and outputs) have been generated as a feed to ANN. ey were generated according to normal distribution in the permissible zone of the joint space of each one of the robots. Moreover, validation and test data samples are each set to 15 percent of the original samples (see Tables 5-7). So, 300 random samples are used for validation and test, and 700 samples are left for training. Although it is correct, by changing this arrangement or using larger data samples and retraining network over and over, different results are faced, but one should note that it would give some marginal improvements. To achieve reliable results, initial conditions are fixed for all three cases (RRR, Stanford, and RPR).
A set of training samples are presented to the network during training and the network is adjusted according to its error. In addition, a set of validation data are used to measure network generalization and to halt training when generalization stops improving. Furthermore, a set of testing samples have no effect on training and provide an     Tables 5-7).
Regression R values measure the correlation between outputs and targets. An R value of 1 means a close relationship and 0 means a random relationship. As the data fed into the neural network might be of the scattered type, the discretion and correlation of data values are good measures of those data. is way the regression values help decide on the closeness of the data used for training and the way the ANN is predicting the unknown results.
It can be interpreted from Tables 5-7 that by increasing the number of neurons from 15 to 25, in this special case study, the number of iterations decreases which means that the mean square error decreases to zero. It is important to know this result cannot be used as a pattern for all cases, and there is no guarantee to get better results by increasing the number of neurons and there is a possibility to get worse result by increasing the number of neurons. e results demonstrate that the increasing number of neurons lead to a decreasing number of iterations which means that the mean square error has been approaching to zero, and the regression data have become closer to one in the case study of this research. So, one may conclude that by increasing the number of neurons, the proposed neural network performance for this research has been increased.

Conclusion and Future Work
In this paper, synthesis of three robotic arms such as RRR, RPR, and Stanford with gimbal drive which can be used to achieving the maximum force have been analyzed. Genetic algorithm has been employed to find optimal parameters of the gimbal joints (truncation angles), and then it has been utilized as a model reference for the proposed neural networks. ousands of randomly generated points have been used as the inputs to the gimbal dynamic model in the GA optimization process. ese points have been fed to the neural network to find the relation between inputs and outputs to investigate how well the proposed ANN algorithm can act instead of the GA optimizer of the parameters of the mechanism equipped with gimbal drive. e results confirm that the proposed ANN optimizer of gimbal drive is a novel and effective technique which can be utilized as an effective optimizer for improving the performance of robots based on their applications. Since robots make a qualitative contribution to productivity, improvement of their performance contributes to sustainability by reducing energy consumption and waste in manufacturing processes.
One of the valuable topics of future works can be defined as measuring the power consumption and material waste reduction rates by utilizing the proposed ANN in real-life industrial implementation which can give a better view to understand how the proposed ANN contributes to sustainability. As another future work, other well-known optimization techniques such as hybrid optimization techniques, bee colony, and particle swarm can be utilized as a reference model to train the proposed neural networks. Also, different neural network models such as ring probabilistic logic neural networks (RPLNN) and RAM-based neural networks can be utilized instead of the proposed ANN.

Data Availability
No data were used to support this study.

Conflicts of Interest
e authors declare that they have no conflicts of interest.