# Dimensional Synthesis for Multi-Linkage Robots Based on a Niched Pareto Genetic Algorithm
## 2 Objective Functions of NPGA
### Workspace Density Function
#### 2.1.1 Calculation of Monte Carlo method  
The principle of the Monte Carlo method for workspace solution is  
\[W=\left[M(k):k\in G\right] \tag{1}\]  
where \(W\) is workspace, \(k\) is the generalized joint variable, \(M(k)\) is forward kinematics expression, and \(G\) is the joint space sets. The Monte Carlo method generates a large number joint space points randomly, map them to flexible workspace, obtain corresponding end-position data, and then computes the boundary of the flexible workspace statistically. The specific flow of the algorithm is as follows:  
1. Divide the samples of each joint angle, construct the sample space \(G\) according to the definition of flexible workspace;
2. Calculate the positions end-effector reached on the basis of forward kinematics expression \(M(k)\);
3. Construct the flexible workspace \(W\) using outputted the end-effector position. The larger the sample size, the geometric contour will be clearer and the flexible workspace will be more accurate. The forward kinematics equation was established based on Denavit-Hartenberg method (D-H method), according to the geometric relationship between the robot end-effector position, bar lengths, and joint angles in Figure 1.  
Let the coordinate axis \(z_{0}\), \(z_{1}\), \(z_{2}\) be perpendicular to paper outward, in that way the homogeneous rotation transformation matrix from \((x_{0},y_{0},z_{0})\) to \((x_{1},y_{1},z_{1})\) is shown in Equation (2). \[\overset{0}{{}_{1}}T=\left[ \begin{array}{cccc}\cos\theta_{1}&-\sin\theta_{1 }&0&0\\ \sin\theta_{1}&\cos\theta_{1}&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array} \right] \tag{2}\]The homogeneous rotation transformation matrix from \((x_{1},y_{1},z_{1})\) to \((x_{2},y_{2},z_{2})\) is shown in Equation (3). \[ \begin{array}{c}{}_{2}^{1}T=\left[\begin{array}{cccc}\cos\theta_{2}&-\sin \theta_{2}&0&l_{1}\\ \sin\theta_{2}&\cos\theta_{2}&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array}\right]\end{array}  \tag{3}\]  
The homogeneous rotation transformation matrix from \((x_{2},y_{2},z_{2})\) to \((x_{3},y_{3},z_{3})\) is shown in Equation (4). \[ \begin{array}{c}{}_{3}^{2}T=\left[\begin{array}{cccc}\cos\theta_{3}&-\sin \theta_{3}&0&l_{2}\\ \sin\theta_{3}&\cos\theta_{3}&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array}\right]\end{array}  \tag{4}\]  
Then we can get the homogeneous rotation transformation matrix from \((x_{0},y_{0},z_{0})\) to \((x_{3},y_{3},z_{3})\), as shown in Equation (5). \[ \begin{array}{c}{}_{3}^{0}T={}_{1}^{0}T{}_{1}^{1}T{}_{2}^{2}T=\left[\begin{array} []{cccc}\cos\theta_{1}&-\sin\theta_{1}&0&0\\ \sin\theta_{1}&\cos\theta_{1}&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array}\right]\left[\begin{array}{cccc}\cos\theta_{2}&-\sin \theta_{2}&0&l_{1}\\ \sin\theta_{2}&\cos\theta_{2}&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array}\right]\left[\begin{array}{cccc}\cos\theta_{3}&-\sin \theta_{3}&0&l_{2}\\ \sin\theta_{3}&\cos\theta_{3}&0&0\\ 0&0&1&0\\ 0&0&0&1\end{array}\right]\\ =\left[\begin{array}{cccc}\cos(\theta_{1}+\theta_{2}+\theta_{3})&-\sin( \theta_{1}+\theta_{2}+\theta_{3})&0&l_{1}\cos\theta_{1}+l_{2}\cos(\theta_{1}+ \theta_{2})\\ \sin(\theta_{1}+\theta_{2}+\theta_{3})&\cos(\theta_{1}+\theta_{2}+\theta_{3}) &0&l_{1}\sin\theta_{1}+l_{2}\sin(\theta_{1}+\theta_{2})\\ 0&0&1&0\\ 0&0&0&1\end{array}\right]\\ \end{array}  \tag{5}\]  
Therefore, the \(P\) position vector of the end-effector can be expressed by Equation (6). Figure 1: Forward kinematics model of 3R linkage robot. Since the sum of discrete probability distributions is 1, integration of probability density function is 1 always, as shown in Equation (17). \[\int p(x)dx=1 \tag{17}\]  
The continuous probability density function is not limited to 1, so in the study of workspace, all continuous random variables are measurable, and all continuous distributions have density. For a NR manipulator, if each link angle has \(M\) states, the samples number is \(K=M^{n}\) in the linkage manipulator workspace, the variance of this sample space can be written as Equation (18).