1 Introduction

Robot laser hardening (RLH) (thermal hardening by laser radiation) [1] of metals and alloys is based on local heating of a surface area by applying radiation (and subsequent cooling) to the material’s surface. The time constants of thermal regimes are extremely short as a result of rapid heat conduction into the inner layers of the metal. Compared to the known heat-hardening processes (quenching by high-frequency currents, electric heating, quenching from a melt, and other methods), laser-quenching is a surface process rather than a bulk one. At the same time, both the laser induced heating times and the corresponding cooling times are insignificant, since the thermal inertia of the small heated area is extremely low. These conditions provide high heating and cooling rates of the treated surface areas. Under these extreme thermal conditions, the deriving material’s structure acquires specific features.

Due to the machining of metallic material, the state of the surface layer (its structure and hardness) changes and so does the surface appearance, since it is directly related to its roughness [2, 3]. The surface appearance may change due to the traces of machining tools being used in the process (plastic deformations caused by cutting the metal). During the mechanic treatment of material crystallites are crushed. The surface layer is influenced to a depth of several microns with fine processing and up to 1 mm at rough machining with the removal of large layers of metal. Consequently, the mechanical properties of the surface layer are quite different compared to the properties of the metal underneath. The operational properties of the products (their strength, wear resistance, corrosion resistance) depend on the thickness of this layer (often called the “defected layer”). In this perspective, the thickness of the defected layer of steel is greater than that of cast iron, since in the former case plastic deformation in the surface layer of the metal is greater than that in the latter case, and large cutting forces and heat release occur during processing.

The performance and the life of a mechanical component, generally, can be influenced by the micro and macro deviations of the real surfaces with respect to the nominal surfaces, which are introduced during the manufacturing process. These errors can be controlled on a macro-scale by dimensional and geometrical tolerances [4] so as to guarantee the proper operation of a component when assembled [5]. Instead, the local irregularities of the real surfaces can be controlled by assigning a limit value, or a range of values, of a parameter usually indicated as surface roughness.

Surface quality is determined by a combination of characteristics such as roughness and quality of the surface layer. The surface texture of an engineering component is very important. It is affected by the machining process, e.g. by changes in the conditions of either the component, tool or machine, which will influence the texture of the produced component [6].

Surface quality has an important role on the performance characteristics of the products such as wear resistance, fatigue strength [7], stability of gaps and strain between the connections, corrosion resistance, furthermore the improvement of surface finish is one of the most reasonable methods of reducing friction [8]. For this reason, especially in applications where components such as bearings [9], gears [10] or similar are involved, in which these events can mostly affect the operating, the state of the surfaces has to be accurately characterized.

Fractals [11] are complex structures possessing the property of self-similarity, i.e. a replication of their form on a different scale. In other words, fractals are not just mathematical constructs, but a powerful tool for describing complex structures and processes. It is pertinent to note that fractal self-similarity structures essentially describe various ways order can be established in complex systems, i.e. products of self-organization must be distinguished from chaos in open systems. The selection of the material is determined by its properties, the material being subjected to a wide range of processes and methods transforming the raw material (the so-called precursor) into the product.

Pattern recognition [12] is a scientific discipline, the purpose of which is to classify objects into several categories or classes. Classification is based on precedents. A precedent is an image, the correct classification of which is known; is a previously classified object, taken as a model for solving classification problems. In the natural science, the idea of decision-making based on precedence is a fundamental concept. For each class, a finite number of precedents are known and studied. The task of pattern recognition is to assign a new recognizable object to one of the given classes and such task represents the core issue in most intelligent systems. The measurements used to classify images are called characteristics. A symptom is a certain quantitative measurement of an object of an arbitrary nature. A set of attributes related to a single image is called a feature vector. Feature vectors take measurements to classify images, and state them in the form of characteristics. Within the recognition task, it is assumed that each image has a unique value of the feature vector characterizing it and vice versa.

Machine Learning [13] (ML) is a highly specialized field that is nowadays extensively used as a tool intended to facilitate the “big data” and the Internet of Things (IoT) that are both focused on automated knowledge extraction from a large and raw data sets. Among other principles, learning schemes are based on the generation of predictive and/or prescriptive recommendations, pattern recognition, etc. A sign of the advancing era of cognitive computing is the increased interest in ML and the numerous attempts to introduce ML in various, sometimes unexpected, areas of human activity.

The concepts of graph theory [14] are useful in dealing with many theoretical and practical problems. The complexity of graph structure is well suited to the capabilities of the human brain: it is clearly structured but, on the other hand, rich enough to capture many non-trivial phenomena. Algorithms that operate on graphs are the foundation of search engines, such as Yandex and Google. As a part of computer science, graphs are actively used in bioinformatics, chemistry, sociology, material science, etc.

The aim of the paper is to outline possibilities of applying a new method for pattern recognition by using network theory for the prediction of surface roughness as a consequence of RLH.

This new method lends itself to be applied by an interactive control of manufacturing [15,16,17] through RLH. This type of control is devised here as a possibility to interact by hand or automatically with the robot laser cell parameters in order to verify any increase of roughness and variations in the operational properties of the surface, as well (strength, wear resistance, corrosion resistance).

The interactive control can be utilized by implementing a system of acquisition and analysis of SEM images either while machining in real time or during the performance of the first prototypes of products.

2 Material preparation and methodology

Figure 1a presents the RLH treated specimen whose roughness is presented in Fig. 1b. For the measurement of the surface roughness, the profilometer was used. Contact profilometry is a quantitative technique known to reflect the irregularities of the surface profile of the robot laser hardened specimens. The most common parameter calculated from the roughness profile is the average roughness (Ra). Figure 2 presents the microstructure of the RLH specimen. Irregular surface texture with a few breaks, represented by black islands, is revealed. The impact of the robot laser cell parameters on the morphological properties of the surface can be observed. Red arrows show the direction of measurements.

Fig. 1
figure 1

a RLH specimen, b roughness of RLH specimen

Fig. 2
figure 2

Microstructure of (RLH) specimen

The microstructure of RLH specimens is very complex, irregular and chaotic. Chaotic microstructure of RLH specimens refers, more broadly, to small-scale stochastic or chaotic behavior affecting dynamics at large scales. Problems that involve chaotic and irregular microstructure are of fundamental importance in materials science. Chaotic microstructure also plays a key role in determining the topographical properties of hardened materials. Thus, fractal geometry was used for the assessment of irregularity. In particular fractal dimension, which describes the complexity of specimens, was calculated by using box counting method [18].

A new approach to pattern recognition by using graph theory was developed. The graph G = (V, E) is represented by the set of nodes V(u,v) and the set of edges E(u,v). Firstly, micro-structural images were transformed into graphs (network). Nodes were established by black pixels detected on SEM images. Nearest node neighbors were connected and a SEM image based network was built. By Eq. 1 the network clustering coefficient (topological property) was calculated (Figs. 3, 4, 5).

$$ C = \frac{{3 \times {\text{number}}\;{\text{of}}\;{\text{triangles}}}}{{{\text{number}}\;{\text{of}}\;{\text{connected}}\;{\text{triplets}}\;{\text{of}}\;{\text{vertices}}}} = \frac{{{\text{number}}\;{\text{of}}\;{\text{closed}}\;{\text{triplets}}}}{{{\text{number}}\;{\text{of}}\;{\text{connected}}\;{\text{triplets}}\;{\text{of}}\;{\text{vertices}}}} $$
(1)
Fig. 3
figure 3

New method for pattern recognition by using network theory

Fig. 4
figure 4

Genetic programming model

Fig. 5
figure 5

Neural network model

Black pixels represent holes in material’s microstructures. Black holes in microstructures depend on the parameters of the RLH cell. A new approach to pattern recognition by using graph theory is used for the determination of microstructure complexity depending on parameters of the RLH cell which have an influence on the topography of RLH specimens.

Multiple regression (MR) [19] is a method of multivariate analysis, through which the dependent variable (or criterion) Y is associated with a set of independent variables (or predictors) X by means of a linear equation:

$$ {\text{Y}} = {\text{a}} + {\text{b}}_{1} {\text{X}}_{1} + {\text{b}}_{2} {\text{X}}_{2} + \cdots + {\text{b}}_{{\text{k}}} {\text{X}}_{{\text{k}}}. $$

Regression coefficients or (weights) b are usually determined by the method of least squares, minimizing the sum of the squared deviations of the dependent variable actual values from the corresponding values.

Genetic programming (GP) [20] is an evolutionary optimization methodology that can also be used to identify patterns or dependencies in data structures. A GP is a set of instructions (usually simple operators, addition and subtraction) for a source data and a matching function to determine how well a system is capable of combining functions and data to achieve a specific goal. Applied to the trading context, the initial data may include not only prices, but also volatility, moving averages, and a set of other technical indicators. The matching function can be simple, for example, net profit, but it can also represent other measures of profitability or risk, with factors such as profit/loss per trade, probability of prediction or maximum drawdown. In order to reduce the risk of adjustment, it is necessary to restrict the types of functions such as functions with simple operators (+, −, /, *), exponential and trigonometric functions. The scope of the program can also be limited in terms of the maximum number of rows allowed. The evolutionary aspect of the GP process originates from the idea that the existing signal or model can be modified by moving nodes in the branches of a tree, or even replacing one whole branch with another. The performance of the system is recalculated using the matching function and the most profitable mutations are selected for further generations. The resulting models are usually highly nonlinear and can be represented in a very general form.

Neural network (NN) (artificial neural network) [21] is a system of combined and interacting simple processors (artificial neurons). Such processors are usually quite simple (especially in comparison with processors used in personal computers). Each processor of such a network only deals with the signals it periodically receives, and the signals it periodically sends to other processors. Nevertheless, in conjunction with such efficient transactions as neural networks, processors are trained in the process of work. An artificial neural network (ANN), or simply a neural network, is a mathematical model, as well as its software or hardware implementations, built in a certain way in the image and nerve cell networks of a living organism. Neural networks are one of the most famous and oldest methods of machine learning.

Support vector machine (SVM) [22] is one of the most popular and universal algorithms of machine learning. Perhaps, this is the most complex method of classification from all described. SVM takes a data set consisting of numbers, and tries to predict which category it falls into. You can, for example, determine the role of the player in the basketball team in terms of the person’s height and running speed. For simplicity, consider only two possibilities: the position in the attack, which requires great height, and in the defence, where the player must move quickly. This algorithm can be used both for solving classification problems and regression recovery. SVM builds a prognostic model, looking for a line dividing the two categories. If you enter the height on one axis and the speed on the other, and select the best positions for each player, you get the diagram shown in Fig. 6. Forward players are represented by crosses, whereas defenders are represented by circles. Also, the diagram shows several lines that divide the data into two categories. The reference vector machine finds the line that best divides the data. This means that it passes at the maximum distance from the points located near it. In Fig. 6 there are several dividing lines, but the best one is marked with the inscription “Best”. To determine where the line must pass, only the nearest points are needed, and they are called support vectors. In order to classify new samples after the dividing line is found, they must be depicted in the diagram to see on which side of the diving line they will be situated. Viewing training data during the classification of new samples is useless, so the classification process is very fast. We use v-SVM Type with regression cost (C) 1.00. Optimization parameters, we use 110 iteration limit and numerical tolerance 0.001. We use Kernel (g × x × y + 0.14)3 and g was auto.

Fig. 6
figure 6

Model of SVM

Random Forest (RF) [23] is one of the most popular and extremely effective methods for solving the problems of machine learning, such as classification and regression. In terms of efficiency, it competes with support vector machines, neural networks and boosting, although it certainly does not lack its shortcomings. In appearance, the learning algorithm is very simple (in comparison with the learning algorithm of the support vector machines). The basic ideas laid down in Random Forest model (binary decision tree, bootstrapping aggregation or bagging, random subspace method and decorrelation) are further presented in Fig. 7. We use 16 tree, 30 fixed seed for random generator. Growth Control: Do not split subset smaller than 5.

Fig. 7
figure 7

Random Forest model

The nearest neighbour classifier [24] is one of the simplest classification algorithms, also used for problem classification. Due to its simplicity, it is a good tool to get acquainted with the field of Machine Learning. Using this approach, one must consider examples of writing a code for such a classifier in Python, as well as result visualization. The task of classification in machine learning bears the problem of assigning an object to one of the predetermined classes on the basis of its formalized characteristics. Each of the objects appears in the form of a vector in an N-dimensional space, whereas each measurement contains a description of one of the object characteristics. In order to classify monitors, such measurements as the available space, size, maximum resolution, presence of the HDMI interface, costs etc. play a major role. Text classification is somewhat more complicated, thus the term document matrix is commonly used. To train a classifier, one must work in advance to prepare a set of objects for which classes must be assigned. This set is called a training sample, and its marking is done manually, with the involvement of field specialists. For example, in the task of Detecting Insults in Social Comments for pre-compiled sets of comments that have been declared opinions, the task of determining whether the comment is an insult to one of the participants in the discussion is an example of a binary classification. In the classification problem there can be more than two classes (multi-class), and each of the objects can belong to more than one class (intersecting). We use Chebyshev metric, number of neighbour was 2. We use uniform weight. The nearest neighbour model is presented in Fig. 8.

Fig. 8
figure 8

Nearest neighbour model

3 Results and discussion

Table 1 outlines the parameters of hardened specimens that have an impact on material hardness. Column S presents specimens, which are marked from A1 to A22. Parameter X1 represents the temperature in °C, X2 is the speed of hardening [mm/s], X3 represents the calculated fractal dimension, and X4 presents Network Clustering Coefficient (Transitivity) of graph shown in Fig. 3. The last parameter Y is the measured roughness of RLH specimens. In Table 1, we can see that A11 possesses the largest fractal dimension, 1.9784. Thus the specimen A11 is the most complex. Specimen A13 has the highest roughness after hardening (2350 nm). Specimen A4 has the lowest roughness (76 nm). Specimen A20 has the highest network clustering coefficient of the network presented in Fig. 3 (0.38682865). The multiple regression model is presented by Eq. 2, but the genetic programming model is presented by Eq. 3.

Table 1 Parameters of hardened specimens

Regression Model

$$ {\text{Y}} = 8611.99 + 1.50405 \times {\text{X}}1 - 68.9251 \times {\text{X}}2 - 1802.03 \times {\text{X}}3 - 16373.7 \times {\text{X}}4 $$
(2)

Genetic programming Model

$$ \begin{aligned} Y & = X4 + \frac{{0.105902 \times ({\text{X}}1 + {\text{X}}4)}}{{ - 56.6559 + 0.0289857 \times X1\frac{{0.273702\left( { - 3.65362 + \frac{{{\text{X}}1}}{{{\text{X}}4}}} \right)}}{{ - 15.8853 - \frac{3.65361}{X1}}} + \frac{{{\text{X}}1 + \frac{{{\text{X}}1}}{X4}}}{X4 - 9.44265} + \frac{{{\text{X}}1}}{X4}}} + \frac{1}{X2} \times 0.273702 \times 28.328 + X1 \\ & \quad + \;\frac{{{\text{X}}1}}{{28.328 + \frac{{{\text{X}}1}}{{\frac{{{\text{X}}1}}{X4} - 9.44265}}\frac{3.65361}{X4}}} + \frac{{{\text{X}}1 + \frac{{{\text{X}}1}}{X4}}}{9.44265 + X4} + \frac{{{\text{X}}1}}{X4} - \frac{{{\text{X}}4 - 3.65361}}{X4} - \frac{{{\text{X}}1 + {\text{X}}4}}{{\frac{{{\text{X}}1}}{X4} - 9.44265}} + \frac{{{\text{X}}1 + 2 \times X4}}{9.44265 + X4} \\ & \quad - \;\frac{{0.821106 \times {\text{X}}4 \times ({\text{X}}1 + 2 \times {\text{X}}4) \times (2 \times {\text{X}}4 - 3.65361)}}{{\left( {{\text{X}}1 + \frac{{{\text{X}}1}}{X4}} \right) \times \left( {{\text{X}}1 + \frac{{{\text{X}}1}}{X4}} \right)}} \\ \end{aligned} $$
(3)

Table 2 highlights the experimental and predicted data measured in nm. The first column includes the specimen names, while the second column contains experimental data. Prediction with multiple regressions is presented in the column P MR, genetic programming prediction is included in the column P GP, neural network prediction is outlined in the column P NN, support vector machine results are provided in the column P SVM, prediction with Random Forest is disclosed in the column P RF, where ask-nearest neighbour results are presented in the column kNN.

Table 2 Experimental and prediction data

The measured and predicted surface roughness of (RLH) specimens is shown in Fig. 9. The multiple regression model sums up to a 53.91% deviation from the measured data. The genetic programming model sums up to a 26.61% deviation from the measured data. The neural network model sums to a 36.14% deviation from the measured data. Parameters of 0.1 learning rate, 0.9 moment, 0.01 training tolerance, 0.2 testing tolerance were used in 4 layer neural network. Sigmoid function was used in neural network. The support vector machine model presents a 67.95% deviation from the measured data.

Fig. 9
figure 9

Measured and predicted roughness of hardened specimens

Parameters presenting the following values: regression constant 1.00, complexity bound 0.5, numerical tolerance 0.001, iteration limit 100, the polynomial kernel (xy + 0.13)3 were used in support vector machine model. The random forest model sums up to a 61.60% deviation from the measured data. Parameters containing 16 trees, 30 fixed seeds for random generator and split subset 5 were used in random forest model. The k-nearest neighbour model sums up to a 35.30% deviation from the measured data. Parameter’s 2 neighbours, Chebyshev metric and uniform weight, were used in k-nearest neighbour model. All in all, the genetic programming prediction model provided the best result.

Many steel parts require heat treatment or surface hardening to obtain additional wear resistance and the ability to withstand significant loads. Unfortunately, high hardness negatively affects the machinability of such parts. Gear parts and various shafts and axes—typical hardened parts, machined by turning, milling in hardenedform—are subjected to stamping in dies and moulds. Heat-treated parts—rolling elements, as a rule, require finishing, which removes the shape errors and ensures the required accuracy and quality of the surfaces. As for dies and moulds, now there is a tendency to process them in the quenched state. This leads to a significant reduction in the time necessary for manufacturing the stamp. Surface roughness is extremely important in material science. The paper is concerned with the parameters of a robot laser cell which directly impact the roughness. So, specimen A4 has minimal roughness. It means that optimal parameters of robot laser cell are 1000 °C temperature and 4 mm/s speed of laser beam. The roughness of RLH specimens is analysed by means of a new pattern recognition method. It can be concluded that surface roughness increases after hardening between 76.3 nm and 2.35 μm.

4 Conclusion

The present paper deals with a new method for pattern recognition by using graph theory. Surface roughness is an indicator that indicates a certain amount of data characterizing the state of surface irregularities measured by extremely small segments. The question of the finishing treatment of hardened steel is solved in modern production mainly by roughness processing. Until recently, this was due to different level of equipment used for grinding and blades. Lathes could not guarantee the same precision as it was achieved by grinding machines. But now modern CNC machines have sufficient accuracy of movement and rigidity, therefore the share of turning and milling of solid materials is constantly expanding in many industries. Hardened turning has been used in the automotive industry since the mid-1980s, but today a new era begins in this kind of processing. High quality of RLH processing of details allows reducing the wear and tear of surfaces. The fractal analysis of a series of digitized surface microstructures from the robot laser surface modified specimens indicate that useful correlations can be derived between the fractal dimensions and the surface microstructural features such as surface roughness. A new approach to pattern recognition by using graph theory was developed for the determination of surface roughness depending on parameters of the RLH cell which have an influence on the topography of RLH specimens. The models that were here studied can be applied in an interactive way during the stage of laser hardening. The proposed method allows to determine, in the case of the RLH, a relationship between the manufacturing parameters and the microstructural features such as the surface roughness. Therefore it seems appropriate for interactive applications to control the manufacturing parameters which influence the surface roughness, thus contributing to the Interactive engineering development as it is able to evaluate the operational properties of the products through the surface roughness measurement. The utility of this method can also be applied to other types of surface machining.