## 2 Materials and Methods
### Optimization Framework
Encoding of candidate solutions refers to chromosome representation, where each individual of the population is represented as a chromosome by using several binary digits (genes) to numerically represent the individual. Initialization refers to generating the initial population of the design where a diverse set of candidate solutions are randomly distributed across the designed space to ensure adequate workspace. Fuzzy design refers to defining the key performance metrics that serve as inputs for the fuzzy logic system; the design of the membership functions for each input parameter handle uncertainties and formulate fuzzy rules to connect the inputs with the outputs of the fuzzy system. Fitness evaluation implies that each individual is analyzed and evaluated with respect to the current population using the fuzzy logic system to derive the fitness score. Selection process refers to using selection techniques based on fuzzy fitness scores to choose individuals for reproduction (crossover). Crossover implies combining pairs of selected individuals to produce offsprings that inherit from both parents. By mutation, it is implied that random changes are introduced in offsprings to explore new regions of the design space and maintain diversity. Iterative evolution deals with replacing the population based on new offsprings by replacing less fit individuals with newly generated ones. After replacing some individuals, the fitness evaluation is performed on the new population. The iterative process stops when a maximum number of generations is obtained, or improvements of fitness values fall below a set of thresholds over successive generations. After the selected optimal solution is implemented into the design, it is validated by simulations or experimental testing. For the genetic algorithm of the parallel robot for pancreatic surgery, the optimization problem is formulated as follows: \"starting from a set of points recorded during manual operation of the medical instrument inside of a phantom by a medical doctor, determine the optimal position for the RCM point (center for the spherical passive mechanism) to assure that all the recorded points fit inside the workspace of the robot\". The points were recorded with the help of an optic motion tracking equipment (Optitrack-Natural Point Inc., Corvalis, OR, USA). A total number of 6951 points were recorded and used as initial data for the population. Figure 2: General flow chart of a genetic algorithm with fuzzy logic fitness evaluation. The first step of the optimization algorithm is to establish chromosome representation. For this, each candidate solution for the optimal RCM is represented as a three-dimensional vector. Let the set of tracking points be:  
\[\left\{P_{i}\in\mathbb{R}^{3}\ |\ i=1,2,\ldots,N\right\} \tag{2}\]  
where N = 6951 and the length of the medical instrument \(L\) = 450 mm. The chromosome representation for a candidate RCM position yields Equation (3). The initial population is established in 100 randomly generated RCMs. \[R=\left(R_{x},R_{y},R_{z}\right)\in\mathbb{R}^{3} \tag{3}\]  
with  
\[R_{z}\geq\max_{i}\{P_{i,z}\}+\delta,\ i=1\ldots N \tag{4}\]  
where \(\delta>0\) ensures that the RCM is placed above all input points. The distance from R to \(P_{i}(P_{ix},P_{iy},P_{iz})\) is given by Equation (5). \[d_{i}=\left\|P_{i}-R\right\|=\sqrt{\left(P_{i,x}-R_{x}\right)^{2}+\left(P_{i,y }-R_{y}\right)^{2}+\left(P_{i,z}-R_{z}\right)^{2}},\ \ i=1\ldots N \tag{5}\]  
The second step of the algorithm implies raw performance evaluation using measured data. For each reachable point \(P_{i}\), the inverse kinematic model computes the center of the joint \(R_{1P}\) (Figure 1) using Equation (6). \[T_{i}=R-\frac{L}{d_{i}}(P_{i}-R),\ i=1\ldots N \tag{6}\]  
From the computed points, three metrics are derived, which are reachability ratio, convex hull volume, and spread. Equation (7) denotes the set of instrument tip points while Equation (8) represents the convex hull volume if \(T_{t}\geq 4\), otherwise, convex hull volume is 0.