CNC Milling Machine Parameters Optimization by Hybrid Optimization algorithm


 Discuss Code


Recently, metal cutting improvement and advancement of the machining tool are significant aspects of the mechanical field. The machining operations of the industrial area are performed by the Computer Numerical Control (CNC).  It uses a computerized program to operate machining and cutting tools for shaping the metal. The machining technology is classified into four processes: turning, drilling, shaping/planning, and milling of material clearing and cutting. In this work, the CNC milling operation parameters are optimized by Hybrid Grey Wolf Optimization-Particle Swarm Optimization (GWO-PSO).

Thesis statement

The milling machine is a device that cuts the metal by different tooth components called milling shaper.  It has the following advantages like less tool requirement, specific design, and high accuracies. A CNC machine performs various machining processes like cutting, drilling, and turning. The surface roughness can quickly analyze the quality of the material or product. The parameters of the CNC machine affect the surface roughness of the material. Therefore cutting speed, feed, depth of cut, and step over ratio are tuning parameters. So a novel GWO-PSO algorithm is developed to achieve the optimal value of these parameters and achieve the best-fit surface roughness. The entire scripts are generating on the MATLAB 2018a software.

 Milling Machine

The milling machine is used for cutting and finishing the task of a metal. A metal shaper performs these two tasks in milling operation. In other words, the milling machine provides some variety in the metal cutting shape. There are three types of milling available in the milling machine [1, 2].

  • Slab Milling
  • Face Milling
  • End Milling

Types of Milling Machine

There are two types of milling machines used in industrial applications.

  1. Vertical Milling Machine

In the vertical milling machine, the spindle axis is connected in the vertical direction. Therefore, the key components of a vertical milling machine are spindle and top slide, base, cutters column, table, knee, and y-axis. The milling cutters are connected in parallel to the spindle and move as per its axis. For normal cases, the drilling and small cuts are allowed by the spindle. Figure 1 shows the structure of a vertical milling machine.

Virtual Milling Machine

Figure 1 Vertical Milling Machine [1]

  1. Horizontal Milling Machine

In horizontal milling machines, the spindle axis is situated in the horizontal direction. It is much costly than the vertical milling machine. The best surface finishing is achieved by using the HMM. The cutting chips are removed very quickly, and surface finishing is good. The weight of the HMM is larger than the vertical milling machine. It is more powerful than the VMM and can do work of 3 VMM very smoothly. Figure 2 shows an example of a horizontal milling machine.

Figure 2 Horizontal Milling Machine [1]

CNC Machine

In the CNC machining process, several capabilities are presented, like electrical, mechanical, chemical, and thermal. Lots of machining process like cutting, drilling, and turning is performed by CNC machine. The entire operation of the CNC machine explained in steps;

  • Prepare the CAD model
  • Conversion of CAD model into CNC script
  • Adjustment of CNC machine
  • Delivered the milling operation

The cutting tool is the essential element of the CNC and NC machines. The cutting tool is used to remove the extra material from the workpiece and give the exact required shape of the material [2].

Problem Statement

The surface roughness can quickly analyze the quality of the material or product. It is defined as the parameters by which the product’s adaptability to the environment can be checked. There are some impurities of surface texture and feed marks produced via the machining process. The productivity of the machine tool and parts are evaluated based on the quality of the surface.


We developed a hybrid GWO algorithm, which provided better results than the previously proposed algorithms. So in our work, we will try to remove this issue with less convergence time and better surface roughness. The following objectives are considered in the study;

  • Maximum value of surface roughness based on CNC parameters.
  • Control these independent parameters, a new hybrid GWO-PSO optimization scheme will be proposed.
  • Compare all the results like the regression relationship for dependent and independent variables with the previous GWO optimized work.

A Hybrid PSO-GWO optimization is available on


In this work, we worked towards improving the surface roughness of aluminum-silicon carbide (Al-SiC) composite using a CNC milling machine. Our work is mainly focused on optimizing the machine parameters to get the maximum surface smoothness of the job. A mathematical relationship is developed in [4] based on their experiment between surface roughness and optimizing parameters of the CNC machine.

Objective function

The linear equation which relates the surface roughness with four optimizing parameters is given in equation 1.

Ra=0.893-0.0028x1+0.0018x2+1.19x3+3.39x4    (1)

Where Ra is surface roughness in µm, x1 =speed in m/min , x2 =feed-in µm /rev, x3 =depth of cut mm, x4 =step over ratio.

Here these four variants of ‘x’ are input parameters of the CNC machine, whereas surface roughness is the output parameter observed over the processed job on CNC.

Ra=1.99-0.454log10x1+0.124log10x2+0.157log10x3+0.794log10x4   (2)

All notations have the same significance as in equation 1.

Optimization of CNC Milling

GWOPSO is the latest technique and helps us to get the optimal answer to our non-linear problem. GWOPSO and milling machine are two isolated systems, but these are linked through a feedback system. GWO-PSO optimization is an iterative process. It starts with random values of wolves’ positions, which are the values of CNC’s four inputs.

Consider 20 wolves are considered in a group, which means we have 20 different sets of CNC machine input, and for each set, surface roughness is calculated. Out of these 20 values, the minimum value is indexed. The wolf’s position for which this minimum value is obtained is made leader of the group and comes at the top level into a hierarchy. This is called an alpha wolf with the most optimal way to hunt’s position. The top three best positions of wolves are identified for which surface roughness values are minimum. It can be done by arranging the 20 surface roughness values in decreasing order. The top three indexes of wolves (three best sets of input values to CNC machine so far) are updated by equation 3. The mean of these three updated positions is the newly updated position.

GWO-PSO Optimal Position=(αwolfwolfwolf)/3       (3)

where αwolf is the leader of the wolf group with minimum surface roughness, followed by two more wolves with corresponding decreasing fitness function as βwolf and γwolf

Steps of the proposed algorithm
  1. Input the upper and lower bounds for machine input parameters.
  2. Initialize the positions of 20 wolves randomly for the first iteration and update these till 100 iterations.
  3. For each wolf, position calculates the surface roughness for linear and non-linear regression using equations 1 and 2.
  4. Save the 20 roughness values into a table for 1st iteration and arrange them in increasing order.
  5. Top 3 minimum surface roughness values are selected, and corresponding wolves are assigned as αwolf, βwolf, and γwolf.
  6. Update three best positions of wolves
  7. The mean of these three new positions is considered as the new position of each swarm and their velocity towards the convergence point in the searching space.
  8. Surface roughness for these new positions of 20 wolves is calculated again
  9. Repeat the steps from 4-7 till all iterations are finished.
  10. Finally settled saturation position of the swarm for which no more convergence is achieved is the optimal value of CNC milling machine input parameters.

Results and Discussion

In this work, we have developed the MATLAB script to tune the CNC machine’s tuning variables, whose description is provided in previous chapters. MATLAB R2018a is used in our implementation and testing work. It offers a wide range of library, which reduces the work hassle to develop some basic functions. We compared our results with previous work in which GWO was used.

Comparative study

The surface roughness for both calculations appears in the bar graph in figure 3. It demonstrates that hybrid GWOPSO gives less roughness than GWO optimized parameters. The finally achieved surface roughness by hybrid GWOPSO is 20.5% less than GWO.

Figure 3 bar graph comparison of surface roughness for linear mathematical formulation

From figure 4, it is clear that the graph of depth and feed in the machine has a larger slope than others. The surface roughness value shows more dependency over these as compared to others. The depth of cut and feed values provides minimum roughness of surface. The step-over ratio has an almost negligible effect.

Figure 4 surface roughness comparison for both linear and non-linear analysis

3D Analysis

A 3D surface view shows the change in surface roughness values is figure out. The GWOPSO optimization process with a step over ration and feed in figure 5. The figure 6 shows it for the depth of cut and speed with surface roughness.

Figure 5. 3D surface plot for surface roughness vs step over ratio and feed in milling machine

Figure 6 3D surface plot for surface roughness vs depth of cut and speed in milling machine


This work presents the milling machine’s improved ability to minimize the surface roughness of a composite job object Al2O3 + SiC. We developed a hybrid algorithm by using Gray Wolf (GWO) and Particle Swarm (PSO) Optimization algorithms (GWO-PSO). The proposed GWO-PSO tunes the input parameters of the milling machine keeping the minimum surface roughness of the object in consideration. The proposed GWO-PSO optimization-based CNC machining achieves the minimum value of surface roughness.


  1. Karuppanan, B. Raja Chinna, and M. Saravanan. “Optimized sequencing of CNC milling toolpath segments using metaheuristic algorithms.” Journal of Mechanical Science and Technology33, no. 2 (2019): 791-800.
  2. Li, Congbo, Lingling Li, Ying Tang, Yantao Zhu, and Li Li. “A comprehensive approach to parameters optimization of energy-aware CNC milling.” Journal of Intelligent Manufacturing30, no. 1 (2019): 123-138.
  4. Vikas Pare – GeetaAgnihotri – Chimata Krishna “Determination of Optimum Process Parameters in High Speed CNC End-Milling of Composite Materials Using Meta Heuristic Techniques” Journal of Mechanical Engineering-2015
  5. Narinder Singh and S. B. Singh, “Hybrid Algorithm of Particle Swarm Optimization and Grey Wolf Optimizer for Improving Convergence Performance,” Journal of Applied Mathematics, vol. 2017, Article ID 2030489, 15 pages, 2017



There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.