# Non-Cutting Moving Toolpath Optimization with Elitist Non-Dominated Sorting Genetic Algorithm-II
## 2 Path Optimization Problem Description
### Study Conditions and Implementation of the Model  
The conditions of this study concerning toolpath planning focus on optimizing both the path length and path smoothness. The main objectives are to minimize the total travel distance of the non-cutting tool and to ensure a smooth path to reduce energy consumption and avoid sharp turns that could lead to tool wear or damage.  
This study assumes the following conditions and steps:  
* The workspace is a two-dimensional plane where each point is represented by Cartesian coordinates \((x_{i},y_{i})\).
* Determine the sequence of points \((p_{i})\) that the cutting tool must travel through.
* The cutting tool needs to travel through a set of predefined points in a specific sequence.
* The Euclidean distance calculation is used to measure the path length between each pair of consecutive points, as defined in (4).
* Find the sum of these distances to get the total path, as defined in (5).
* The total path length should be minimized to reduce the machining time and energy consumption without compromising the path smoothness.
* Three consecutive points, \((p_{i},p_{i+1},\) and \(p_{i+2})\) are used to calculate the angle \(\theta\) between the segments using the cosine rule, as defined in (6). Path smoothness is evaluated based on the angles between the successive segments formed by these points.
* Compute the average angle for the entire path to quantify smoothness. A smoother path can be obtained via (7) to obtain the angles closer to \(180^{\circ}\).
* Introduce weighting factors \(\omega_{1}\) and \(\omega_{2}\) for path length and path smoothness, respectively, to balance their importance in the optimization process.
* The objective function can be expressed using (9).
* The values of \(\omega_{1}\) and \(\omega_{2}\) can be adjusted based on the specific requirements of the application. For instance, if minimizing the travel distance is more critical, a higher value can be assigned to \(\omega_{1}\). Conversely, if a smoother path is prioritized, \(\omega_{2}\) can be increased.
* Adjust the sequence of points and recompute the path to minimize the objective function.  
\begin{table}
\begin{tabular}{c c c} \hline \hline \(\omega\) Weighting Factors & **Related Objective** & **Value** \\ \hline \(\omega_{1}\) & Path Length & 0.9 \\ \(\omega_{2}\) & Path Smoothness & 0.1 \\ \hline \hline \end{tabular}
\end{table}
Table 1: \(\omega\) weighting factors of each objective function.  
* Iterate the process to find an optimal balance between the shortest path and the smoothest path based on the chosen weighting factors.
* Apply the optimized toolpath to the CNC machine.
* Test the path on a sample workpiece to ensure it meets the desired criteria of minimal travel distance and smoothness.  
By following these steps, the model helps in achieving an optimal toolpath that reduces machining time, energy consumption, and tool wear, thereby enhancing the efficiency and quality of the machining process. The weighting factors provide flexibility in balancing the trade-off between path length and smoothness according to specific application needs.