scieee AI-readable full text Open interactive document viewer

Hybrid Optimization Based Mathematical Procedure for Dimensional Synthesis of Slider-Crank Linkage

Hernández Frías, Alfonso,Muñoyerro Barriocanal, Aitor,Urízar Arana, Mónica,Amezua San Martín, Enrique

Abstract

The authors wish to acknowledge financial support received from the Spanish government through the Ministerio de Economía y Competitividad (Project DPI2015−67626-P (MINECO/FEDER, UE)), the support for the research group through Project Ref. IT949−16, provided by the Departamento de Educación, Política Lingüística y Cultura from the regional Basque Government, and the Program BIKAINTEK 2020 (Ref. 012-B2/2020) provided by the Departamento de Desarrollo Económico, Sostenibilidad y Medio Ambiente from the regional Basque Government.

Full text

mathematics Article Hybrid Optimization Based Mathematical Procedure for Dimensional Synthesis of Slider-Crank Linkage Alfonso Hernández 1, Aitor Muñoyerro 2, Mónica Urízar 1,* and Enrique Amezua 1   Citation: Hernández, A.; Muñoyerro, A.; Urízar, M.; Amezua, E. Hybrid Optimization Based Mathematical Procedure for Dimensional Synthesis of Slider-Crank Linkage. Mathematics 2021,9, 1581. https://doi.org/ 10.3390/math9131581 Academic Editor: Raimondas Ciegis Received: 31 May 2021 Accepted: 2 July 2021 Published: 5 July 2021 Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. Copyright: © 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). 1Faculty of Engineering in Bilbao, University of the Basque Country (UPV/EHU), Plaza Ingeniero Torres Quevedo, 48013 Bilbao, Spain; [email protected] (A.H.); [email protected] (E.A.) 2 SENER Aeroespacial, Avda. de Zugazarte 56, 48992 Getxo, Spain; aitor.munoyerr[email protected] (A.M.) *Correspondence: [email protected] (M.U.) Abstract: In this paper, an optimization procedure for path generation synthesis of the slider-crank mechanism will be presented. The proposed approach is based on a hybrid strategy, mixing local and global optimization techniques. Regarding the local optimization scheme, based on the null gradient condition, a novel methodology to solve the resulting non-linear equations is developed. The solving procedure consists of decoupling two subsystems of equations which can be solved separately and following an iterative process. In relation to the global technique, a multi-start method based on a genetic algorithm is implemented. The fitness function incorporated in the genetic algorithm will take as arguments the set of dimensional parameters of the slider-crank mechanism. Several illustrative examples will prove the validity of the proposed optimization methodology, in some cases achieving an even better result compared to mechanisms with a higher number of dimensional parameters, such as the four-bar mechanism or the Watt’s mechanism. Keywords: path generation; dimensional synthesis; hybrid optimization; slider-crank mechanism 1. Introduction Dimensional synthesis consists of finding a geometry that enables a mechanism to generate certain motion characteristics, such as trajectories or positions of elements. It is tough to solve this problem intuitively and often requires the implementation of specific methods. Depending on the type and amount of prescribed motion characteristics, it is not always possible to obtain an exact solution to this problem, forcing us to use optimization methods to find an approximation with minimal error. The target most commonly addressed in bibliographies is the synthesis type, known as path generation, where a point of a single degree of freedom mechanism is sought to run through a sequence of prescribed positions. This motion may or may not be synchronized with the location of the input element, resulting in prescribed or unprescribed timing problems, respectively. It should be noted that there also exist two other goals that are frequently studied, these being beyond the scope of this paper. These are function generation, where the motion of two elements of the mechanism is synchronized, and motion generation, where a sequence of locations for a certain element of the mechanism is prescribed. Most of the literature on dimensional synthesis focuses on individual cases, the fourbar hinged mechanism being the most widely studied. In the existing literature, both the exact synthesis, by means of graphic [ 1 ] or analytical methods [ 2 ], and the approximate synthesis, by means of dimensional optimization [ 3 , 4 ], have been studied. On the other hand, the slider-crank mechanism has been used to solve function generation problems [5–8] , for dynamic synthesis [ 9 , 10 ], and to serve as an adjustable mechanism [ 11 – 14 ]. However, no publications on dimensional optimization for path generation have been found. It should be noted that, in addition to the usual kinematic objectives, some papers include more specific characteristics within the error function. For example, in [ 15 ] a formulation is Mathematics 2021,9, 1581. https://doi.org/10.3390/math9131581 https://www.mdpi.com/journal/mathematics Mathematics 2021,9, 1581 2 of 17 developed by using exact differentiation that allows for establishing the position of the instant center of rotation and the centrode. An often-employed dimensional optimization procedure consists of minimizing the error function, formulated as the sum of squared differences between the points of the discretized prescribed path, and those belonging to the real generated path. The minimization process can be solved with different methods that can be classified into two main groups, these being local and global methods, which are mentioned below. On the other hand, there are also publications focused not so much on studying the mathematical optimization techniques, but on proposing new ways of describing the output generated by the mechanism. This may result in a more advantageous definition for the optimization error function or for the elaboration of atlases and databases. In relation to the path generation problems discussed in this paper, there exist different approaches to describe the trajectories, and probably the most typical ones are based on the Fourier series [ 16 ] or Haar Wavelet transform [ 17 ]. Similarly, reference [ 18 ] describes a unified theory of the harmonic characteristic parameter method for mechanism synthesis. Apart from the dimensional synthesis, other publications focus on the phase that precedes it, i.e., structural synthesis, the first step in the conceptual design of mechanisms. In this sense, there can be found some proposals of automatic algorithms intended for the structural synthesis of robots and closed-loop mechanisms [19]. In relation to the mathematical optimization techniques for dimensional synthesis, the most effective and widely used local methods consist of applying the null gradient condition, which leads to a non-linear system of equations. This system often includes some passive variables that cannot be eliminated. To solve it, the function is linearized and an iterative method, such as Gauss–Newton, is used, starting from an approximate initial solution provided by the designer. The original reference for this type of method is a paper published in 1966 by Chi-Yeh [ 20 ], which was dedicated to the four-bar linkage. From then on, several papers related to dimensional synthesis of this mechanism by means of gradient methods have been published, exploring different ways to improve the effectiveness of optimization. As part of these alternative approaches, in [ 21 ] the authors proposed modifying the set of variables to be optimized, considering the nodal coordinates instead of the usual dimensional parameters, thereby allowing the elimination of some constraints that were present in the original problem. It is also noteworthy that other publications focus on reformulating the error function, such as [ 22 , 23 ]. The authors of those works proposed to minimize the strain energy originated when the mechanism is forced to run exactly through the prescribed trajectory. On the other hand, some authors have chosen to estimate the error by avoiding its sensitivity to translation and rotation effects, such as [ 24 ], where a system of relative coordinates between precision points is used. Following the same idea, the authors proposed to perform a prior and independent phase to optimize the translation, rotation, and scaling parameters [ 25 ]. In addition to the different alternatives to characterize the design parameters of the mechanism and to estimate the resulting error, a relevant aspect to achieve good performance in gradient methods is to carry out an exact calculation of the partial derivatives, avoiding the numerical derivation, since it increases the computational cost and results in a lower efficiency. Given the interest in solving this problem, reference [ 26 ] presents a general method for calculating the exact partial derivatives from the loop equations previously identified by the designer. Despite the large number of existing publications devoted to optimal dimensional synthesis by means of gradient methods, and to the improvement of their performance, none of them are capable of solving the main limitation they have. Unfortunately, these methods are highly sensitive to the chosen starting approximation, since they are local in nature and hence converge to the nearest minimum, which will not necessarily be the optimal overall solution. To overcome this drawback, global methods make it possible to explore the entire space where solutions can be found. Metaheuristic methods are the most common ones, and they have been covered in several references. These include genetic algorithms [ 27 – 29 ], differential evolution [ 30 – 32 ], ant search [ 33 ], krill herd algorithm [ 34 ], Mathematics 2021,9, 1581 3 of 17 imperialist competitive algorithm [ 35 ], or neural networks [ 36 ]. Nevertheless, the weakness of heuristic methods in comparison with gradient methods is their higher computational cost and a lower convergence rate. Furthermore, there is no guarantee that they will converge to a minimum, neither locally nor globally. Hybrid optimization algorithms, such as [ 37 ], gain greater strength when a global method generating seeds for starting mechanisms is combined with a good local method. Normally, hybrid methods start by running a global method to obtain one or several designs that will later be used as initial approximations in a local method to quickly converge to the nearest relative minimum. In this paper, as described below, a hybrid optimization approach is proposed. In the case of the slider crank mechanism analyzed in this paper, thanks to the simplicity of its kinematics, it is possible to express the synthesis variables directly as a function of the dimensional and input parameters, and thus completely eliminating the passive variables. A novel aspect of the proposed approach is the way in which the resulting system of equations is solved. Considering the more general case of unprescribed timing synthesis, the final system of equations associated with the null gradient condition can be divided into two subsystems with different characteristics. As will be explained, the procedure described in this article allows each subsystem to be solved separately within an iterative process that connects them together. This makes it possible, in some particularly simple cases, such as the two-parameter slider-crank, to solve all the equations analytically, while in more complex cases, numerical methods must necessarily be adopted. The optimum solution reached will be a relative minimum of the error function and will be influenced by the initial approximation used to solve the system of equations numerically. In this paper, reducing this dependency will be attempted by running the local optimization algorithm from different starting points previously selected by a genetic algorithm. The generation of the starting points could also be done by another type of heuristic method, or through a sweeping process that generates random points within the entire search space. Even so, the latter technique would not achieve the most promising regions as the genetic algorithm does, but it would only generate a wide grid of different starting points. Therefore, the genetic algorithm is the preferred choice. It is important to highlight that the procedure described in this paper seeks to obtain reliable solutions, not only from a mathematical vision, but also from a practical point of view. For this reason, it will be stated how to avoid the circuit defect in the slider-crank mechanism, relying on the concept of branch index. This concept was introduced in reference [ 21 ] to analyze the kinematics of the four-bar hinged linkage. The incorporation of design constraints will be addressed by means of penalty functions included in the error function to be minimized. This is essential to impose the Grashof criterion and thus ensure that the input element is able to fully rotate (crank input). Finally, the effectiveness of the proposed methodology will be illustrated through different examples. The final solutions obtained in this paper are as accurate as the ones reached in other papers when solving the same problem by using more complex designs, such as four-bar or Watt linkages. The main novelties and highlights of this paper are: • Deduction of the equations required for the optimal dimensional synthesis of the slidercrank mechanism, which constitutes an alternative to the hinged four-bar linkage usually used in the literature to solve this type of problem. • Proposal of an original methodology to solve a non-linear system of equations resulting from the null gradient condition, based on the decoupling of two subsystems of equations. It facilitates the resolution of the system and, in some cases, allows to obtain all the solutions in an analytical way. • Integration of the local optimization methodology within a hybrid optimization method, which uses a genetic algorithm to search for the best starting approximations. The fitness function has been adapted to solve not only the prescribed timing problem, but also unprescribed timing. Mathematics 2021,9, 1581 4 of 17 • Solving and comparison of examples proposed by other authors in the literature dealing with the four-bar linkage. Thanks to the effectiveness of the method proposed in this work, the slider-crank mechanism, though being simpler and more limited, is able to provide similar performances (or even better in some cases) in path generation problems. 2. Materials and Methods In this section, the basis of the optimum synthesis procedure as well as the functioning of the hybrid optimization strategy is presented. 2.1. Bases of the Optimum Synthesis Procedure Before tackling the optimization process, the loop-closure equations of the mechanism and the position equations of the coupler point that traces the trajectory will be obtained. In addition, the variables that take part in the synthesis process and their functional dependence law will be described. This enables obtaining the partial derivatives that intervene in the minimization process. 2.1.1. Synthesis Equations for a General Design First, the kinematic problem of the slider-crank mechanism with five dimensional parameters, represented in Figure 1, is obtained. Mathematics 2021, 9, x FOR PEER REVIEW 4 of 18 • Integration of the local optimization methodology within a hybrid optimization method, which uses a genetic algorithm to search for the best starting approximations. The fitness function has been adapted to solve not only the prescribed timing problem, but also unprescribed timing. • Solving and comparison of examples proposed by other authors in the literature dealing with the four-bar linkage. Thanks to the effectiveness of the method proposed in this work, the slider-crank mechanism, though being simpler and more limited, is able to provide similar performances (or even better in some cases) in path generation problems. 2. Materials and Methods In this section, the basis of the optimum synthesis procedure as well as the functioning of the hybrid optimization strategy is presented. 2.1. Bases of the Optimum Synthesis Procedure Before tackling the optimization process, the loop-closure equations of the mechanism and the position equations of the coupler point that traces the trajectory will be obtained. In addition, the variables that take part in the synthesis process and their functional dependence law will be described. This enables obtaining the partial derivatives that intervene in the minimization process. 2.1.1. Synthesis Equations for a General Design First, the kinematic problem of the slider-crank mechanism with five dimensional parameters, represented in Figure 1, is obtained. Figure 1. Slider-crank mechanism with 5 dimensional parameters. The loop-closure equations are the following: 𝑎1·𝑠𝑖𝑛𝜑=𝑎5−𝑎2·𝑠𝑖𝑛𝜃 (1) 𝑠=𝑎1·𝑐𝑜𝑠𝜑+𝑎2·𝑐𝑜𝑠𝜃 (2) From Equation (1) yields: 𝑠𝑖𝑛𝜃=𝑎5 − 𝑎1·𝑠𝑖𝑛𝜑 𝑎2 (3) Then, cos𝜃 is given by Equation (4), where 𝐾=±1. 𝑐𝑜𝑠𝜃=𝐾√1−(𝑎5 – 𝑎1·𝑠𝑖𝑛𝜑 𝑎2)2 (4) The synthesis equations are as follows: Figure 1. Slider-crank mechanism with 5 dimensional parameters. The loop-closure equations are the following: a1·sinϕ=a5−a2·sinθ(1) s=a1·cosϕ+a2·cosθ(2) From Equation (1) yields: sinθ=a5−a1·sinϕ a2 (3) Then, cosθis given by Equation (4), where K=±1. cosθ=Ks1−a5−a1·sinϕ a22 (4) The synthesis equations are as follows: x0=s−(a2−a3)·cosθ+a4·cosθ−3π 2(5) y0=−(a2−a3)·sinθ+a5+a4·cosθ(6) Mathematics 2021,9, 1581 5 of 17 Using the loop equations to solve the passive variables s (Equation (2)) and θ (Equations (3) and (4)), and substituting them in Equations (5) and (6), the following expressions are obtained for the synthesis variables, referring to the local system O’X’Y’: x0=a1cosϕ+a3·Ks1−a5−a1sinϕ a22 −a4·(a5−a1sinϕ) a2 (7) y0=(a3−a2)·(a5−a1sinϕ) a2 cosϕ+a5+a4·Ks1−a5−a1sinϕ a22 (8) Remark Regarding Branches and Circuits The sign ± in Equations (7) and (8), which has been substituted for K=± 1 for simplicity, is related to the two possible positions of the coupler point P for the same input ϕ . This means that two branches exist, each one associated with the positive or negative value of K . This circumstance is illustrated in Figure 2, in which the two possible configurations of the mechanism, for a given value of the input ϕ, are represented. Mathematics 2021, 9, x FOR PEER REVIEW 5 of 18 𝑥′=𝑠−(𝑎2−𝑎3)·𝑐𝑜𝑠𝜃+𝑎4·𝑐𝑜𝑠(𝜃−3𝜋 2) (5) 𝑦′=−(𝑎2−𝑎3)·𝑠𝑖𝑛𝜃+𝑎5+𝑎4·𝑐𝑜𝑠𝜃 (6) Using the loop equations to solve the passive variables 𝑠 (Equation (2)) and 𝜃 (Equations (3) and (4)), and substituting them in Equations (5) and (6), the following expressions are obtained for the synthesis variables, referring to the local system O’X’Y’: 𝑥′=𝑎1𝑐𝑜𝑠𝜑+𝑎3·𝐾√1−(𝑎5−𝑎1𝑠𝑖𝑛𝜑 𝑎2)2−𝑎4·(𝑎5−𝑎1𝑠𝑖𝑛𝜑) 𝑎2 (7) 𝑦′= (𝑎3−𝑎2)·(𝑎5−𝑎1𝑠𝑖𝑛𝜑) 𝑎2 𝑐𝑜𝑠𝜑+𝑎5+ 𝑎4·𝐾√1−(𝑎5−𝑎1𝑠𝑖𝑛𝜑 𝑎2)2 (8) Remark Regarding Branches and Circuits The sign ± in Equations (7) and (8), which has been substituted for 𝐾=±1 for simplicity, is related to the two possible positions of the coupler point 𝑃 for the same input 𝜑. This means that two branches exist, each one associated with the positive or negative value of 𝐾. This circumstance is illustrated in Figure 2, in which the two possible configurations of the mechanism, for a given value of the input 𝜑, are represented. Figure 2. Two possible configurations for the same input. The two possible trajectories of point 𝑃 associated with the different configurations of the coupler element, commonly known as branches, can be connected or unconnected, resulting in a unique circuit (a unicursal curve), or two circuits (a bicursal curve). In this work, designs where the crank input is able to perform a 360° full rotation are considered, meaning that the Grashof criterion must be fulfilled. Therefore, the two possible branches will be two unconnected circuits. To avoid branch defects, all the selected points must have the same value of 𝐾. This value will be the one corresponding to the branch that yields a minimum error with respect to the desired path. In the most general case, represented in Figure 3, the local reference system O’X’Y’ has a rotation relative to the global system OXY, defined by the parameter 𝑎6, and a translation in the plane defined by the parameters 𝑎7 and 𝑎8. Figure 2. Two possible configurations for the same input. The two possible trajectories of point P associated with the different configurations of the coupler element, commonly known as branches, can be connected or unconnected, resulting in a unique circuit (a unicursal curve), or two circuits (a bicursal curve). In this work, designs where the crank input is able to perform a 360 ◦ full rotation are considered, meaning that the Grashof criterion must be fulfilled. Therefore, the two possible branches will be two unconnected circuits. To avoid branch defects, all the selected points must have the same value of K . This value will be the one corresponding to the branch that yields a minimum error with respect to the desired path. In the most general case, represented in Figure 3, the local reference system O’X’Y’ has a rotation relative to the global system OXY, defined by the parameter a6 , and a translation in the plane defined by the parameters a7and a8. The equations that express the synthesis variables in the global reference system are the following: xi=xi0·cos(a6)−yi0·sin(a6)+a8(9) yi=xi0·sin(a6)+yi0·cos(a6)+a7(10) Mathematics 2021,9, 1581 6 of 17 Mathematics 2021, 9, x FOR PEER REVIEW 6 of 18 Figure 3. Slider-crank mechanism with 8 dimensional parameters. The equations that express the synthesis variables in the global reference system are the following: 𝑥𝑖=𝑥𝑖′·𝑐𝑜𝑠(𝑎6)−𝑦𝑖′·𝑠𝑖𝑛(𝑎6)+𝑎8 (9) 𝑦𝑖=𝑥𝑖′·𝑠𝑖𝑛(𝑎6)+𝑦𝑖′·𝑐𝑜𝑠(𝑎6)+𝑎7 (10) Now that all the variables involved in the synthesis problem have been defined, the following classification can be established: • Dimensional variables: 𝑎1,𝑎2,…,𝑎8. These are variables that define the lengths of the bars and the translation or rotation parameters of the studied mechanism. • Input variable: 𝜑. This is an independent variable corresponding to the degree of freedom of the mechanism under study. • Passive variables: 𝜃,𝑠. These are not independent variables, but rather depend on the input and the dimensional parameters. • Output variables or synthesis variables: 𝑥,𝑦. These correspond to the coordinates of the coupler point P. In the case of path generation synthesis, these are indeed the synthesis variables. 2.1.2. Optimal Design Based on the Error Function The error function 𝐸, commonly used in synthesis problems, is defined as the sum of the squared Cartesian distances between the prescribed points and those actually generated: 𝐸=∑ [(𝑥𝑖−𝑥𝑖𝑑)2+(𝑦𝑖−𝑦𝑖𝑑)2] 𝑁 𝑖=1 (11) The error between prescribed and generated trajectory must be minimized to obtain the optimal mechanism. There are two options for carrying out this minimization. In the modality known as prescribed timing, only the dimensional parameters are optimized, requiring solving the system shown in Equation (12). In this case, the input parameters 𝜑𝑖 are not variables to be optimized, but constant values (prescribed values). However, in an optimization known as unprescribed timing, both the dimensional parameters 𝑎𝑗 and the set of input parameters 𝜑𝑖 are optimized, requiring solving the systems given by Equations (12) and (13). This last option is more complex but its potential to obtain precise solutions is greater, since the value of the input parameters is not being restricted. Figure 3. Slider-crank mechanism with 8 dimensional parameters. Now that all the variables involved in the synthesis problem have been defined, the following classification can be established: •Dimensional variables: a1 , a2 , . . . , a8 . These are variables that define the lengths of the bars and the translation or rotation parameters of the studied mechanism. •Input variable: ϕ . This is an independent variable corresponding to the degree of freedom of the mechanism under study. •Passive variables: θ , s . These are not independent variables, but rather depend on the input and the dimensional parameters. •Output variables or synthesis variables: x , y . These correspond to the coordinates of the coupler point P. In the case of path generation synthesis, these are indeed the synthesis variables. 2.1.2. Optimal Design Based on the Error Function The error function E , commonly used in synthesis problems, is defined as the sum of the squared Cartesian distances between the prescribed points and those actually generated: E= N ∑ i=1xi−xd i2+yi−yd i2(11) The error between prescribed and generated trajectory must be minimized to obtain the optimal mechanism. There are two options for carrying out this minimization. In the modality known as prescribed timing, only the dimensional parameters are optimized, requiring solving the system shown in Equation (12). In this case, the input parameters ϕi are not variables to be optimized, but constant values (prescribed values). However, in an optimization known as unprescribed timing, both the dimensional parameters aj and the set of input parameters ϕi are optimized, requiring solving the systems given by Equations (12) and (13) . This last option is more complex but its potential to obtain precise solutions is greater, since the value of the input parameters is not being restricted. ∂E ∂aj =0→ N ∑ i=1"xi−xd i∂xi ∂aj +yi−yd i∂yi ∂aj#=0∀j=1, 2, . . . , n(12) ∂E ∂ϕi =0→ N ∑ i=1xi−xd i∂xi ∂ϕi +yi−yd i∂yi ∂ϕi=0∀i=1, 2, . . . , N(13) Mathematics 2021,9, 1581 7 of 17 2.2. Hybrid Optimization Procedure Thanks to the simplicity of its kinematics, in the slider-crank mechanism it is possible to eliminate the passive variables. In this way, the synthesis variables (x,y)are expressed as an explicit function of parameters aj and ϕ , facilitating the obtaining of the partial derivatives that appear in Equations (12) and (13). After performing the substitution, it can be verified that the system of Equations (12) and (13) is non-linear. This system can be decomposed into two subsystems of equations. On the one hand, Equation (12) is composed of 8 equations, as many as the dimensional parameters of the mechanism. Each of these equations has the form g(a1,a2. . . a8,ϕ1,ϕ2, . . . ϕN)= 0. On the other hand, Equation (13) is made up of Nequations, as many as points of precision has the trajectory. Each of these equations has the form h(a1,a2. . . a8,ϕi)= 0. This circumstance is fundamental when establishing the procedure for solving the system of equations. In addition, in order to find the optimal initial approximation, the one that will be the starting point of the local optimization process, and that plays a relevant role in the process, a multi-start approach will be implemented. In the following sections, the hybrid procedure proposed by the authors of this work will be explained. 2.2.1. Solving the Equation System for Local Optimization In this section, the iterative algorithm to solve the non-linear system of equations resulting from the null gradient condition is addressed. The procedure is based on the decoupling of the two subsystems (12) and (13), as described below. •First phase: This starts from a certain mechanism, coming from the multi-start procedure that will be explained in Section 3.2. The dimensions ( a1 , a2 , . . . , a8 ) of this mechanism are assumed constant in this phase. The values of these dimensions are substituted in each of the equations of subsystem (13), resulting in a total of Nequations, each with a unique ϕi . In the simplest case of the slider-crank mechanism, with 2 dimensional parameters ( a1=a2=a3 and a5=a6=a7=a8= 0), and using the transformation of half-angle tangent, ti=tan ϕi 2, Equation (13) becomes a fourth degree polynomial: 2a1a4+xd ia4t4 i+8a12+xd ia1+2yd ia4t3 i−12a1a4t2 i+−8a12+4xd ia1+2yd ia4ti+2a1a4−xd ia4=0 (14) From the 4 possible values of ti(ϕi) , the one that gives the minimum error is the selected one. For a design with 3 dimensional parameters, Equation (13) becomes a polynomial of degree 10. Even so, it is easy to obtain the 10 roots and detect the correct one proceeding as in the previous case. However, with 4 or more dimensional parameters, it is no longer as easy to determine its corresponding univariate polynomial, nor is it really worth it. It is more practical to operate as explained next. The Equation (13) is solved numerically, starting from an initial approximation, and arriving at a unique solution of the parameter ϕi . To guarantee that the global optimal value of ϕi is obtained, it will be necessary to start from an initial approximation obtained as follows: each sum of Equation (11), which represents the error made in each synthesis position i , is evaluated as a function of the input parameter ϕi along the discretized domain [0,2 π ). In this way, a graph similar to the blue curve represented in Figure 4will be obtained, where two minima of the error function appear, the one indicated on the right being the one with the lowest value. The latter value of ϕi is taken as a starting approximation to solve Equation (13) (in our case, using the MATLAB fsolve command). Mathematics 2021,9, 1581 8 of 17 Mathematics 2021, 9, x FOR PEER REVIEW 8 of 18 being the one with the lowest value. The latter value of 𝜑𝑖is taken as a starting approximation to solve Equation (13) (in our case, using the MATLAB fsolve command). Figure 4. Error function for a point 𝑖 evaluated at [0,2π) To illustrate this concept, in Figure 5 the prescribed point for a synthesis position 𝑖 and the trajectory generated by the mechanism of dimensions {𝑎𝑗} in the current iteration are indicated. The effect of evaluating the sum of the error function (11) and choosing the absolute minimum is equivalent to traversing the generated trajectory and selecting the point of it (the black point) closest to the prescribed one (red point). In this example, the black point indicated in Figure 5 corresponds to the absolute minimum, 𝜑=5.88rad, which is the one previously indicated in Figure 4. Figure 5. Generated trajectory and prescribed point (red). • Second phase: In this phase, the values 𝜑𝑖obtained in the previous phase will be assumed as constants, and the unknowns (𝑎1,𝑎2,…,𝑎8) will be calculated from the subsystem from Equation (12). As an example, in the simplified particular case of the slider-crank mechanism with 2 parameters, Equation (12) becomes the following linear system: Figure 4. Error function for a point ievaluated at [0,2π). To illustrate this concept, in Figure 5the prescribed point for a synthesis position i and the trajectory generated by the mechanism of dimensions aj in the current iteration are indicated. The effect of evaluating the sum of the error function (11) and choosing the absolute minimum is equivalent to traversing the generated trajectory and selecting the point of it (the black point) closest to the prescribed one (red point). In this example, the black point indicated in Figure 5corresponds to the absolute minimum, ϕ= 5.88 rad, which is the one previously indicated in Figure 4. Mathematics 2021, 9, x FOR PEER REVIEW 8 of 18 being the one with the lowest value. The latter value of 𝜑𝑖 is taken as a starting approximation to solve Equation (13) (in our case, using the MATLAB fsolve command). Figure 4. Error function for a point 𝑖 evaluated at [0,2π) To illustrate this concept, in Figure 5 the prescribed point for a synthesis position 𝑖 and the trajectory generated by the mechanism of dimensions {𝑎𝑗} in the current iteration are indicated. The effect of evaluating the sum of the error function (11) and choosing the absolute minimum is equivalent to traversing the generated trajectory and selecting the point of it (the black point) closest to the prescribed one (red point). In this example, the black point indicated in Figure 5 corresponds to the absolute minimum, 𝜑=5.88 rad, which is the one previously indicated in Figure 4. Figure 5. Generated trajectory and prescribed point (red). • Second phase: In this phase, the values 𝜑𝑖 obtained in the previous phase will be assumed as constants, and the unknowns (𝑎1,𝑎2,…,𝑎8) will be calculated from the subsystem from Equation (12). As an example, in the simplified particular case of the slider-crank mechanism with 2 parameters, Equation (12) becomes the following linear system: Figure 5. Generated trajectory and prescribed point (red). •Second phase: In this phase, the values ϕi obtained in the previous phase will be assumed as constants, and the unknowns ( a1 , a2 , . . . , a8 ) will be calculated from the subsystem from Equation (12). As an example, in the simplified particular case of the slider-crank mechanism with 2 parameters, Equation (12) becomes the following linear system:     4N ∑ i=1 cos2ϕi N ∑ i=1 sin2ϕi N ∑ i=1 sin2ϕiN                a1 a4            =       2N ∑ i=1 cosϕi·xd i N ∑ i=1sinϕi·xd i+cosϕi·yd i       (15) However, in the design cases with 3 or more dimensional parameters, the subsystem of equations turns out to be non-linear, making it necessary to apply numerical solving Mathematics 2021,9, 1581 9 of 17 methods. As a starting approximation, the values ( a1 , a2 , . . . , a8 ) that were assumed as constants in the previous phase will be taken. •Next steps: With the new values of aj obtained in the second phase, we go back to the first phase, and thus continue iteratively until convergence. The chosen stopping criterion consists of comparing the current values of the optimization variables (a1,a2. . . a8,ϕ1,ϕ2, . . . ϕN) with those of the previous iteration, so that when the difference is less than a specified tolerance, the iterative process will stop. 2.2.2. Implementing a Multi-Start Strategy The method proposed in Section 3.1 has the disadvantage of being very sensitive to the starting approximation. To avoid this drawback, a multi-start approach based on a genetic algorithm will be used to guide the local optimization method towards a search for the global optimal solution. The proposed multi-start approach obtains a sufficiently large set of starting approximations, representative of a global sweep of the design space aj . In this article, a genetic algorithm is used to locate 100 candidate solutions that serve as initial approximations. It is decided to use the genetic algorithm incorporated in MATLAB, assigning as arguments of the fitness function the values for the 8 dimensional parameters. The latter function assigns the optimal correspondence of input parameters, according to the procedure outlined in the first phase of Section 3.1, and returns a scalar value that quantifies the individual’s fitness as the quadratic sum of the distances between generated and prescribed points. It is important to bear in mind that, considering the way the fitness function is posed, each starting solution for the unprescribed timing problem will not depend on 8 +N variables (8 dimensional + N inputs), but only on the 8 dimensional parameters, which facilitates the exploration of the search space by the genetic algorithm without the need to restrict the input parameters. The complete scheme of this hybrid procedure is shown in Figure 6. As can be seen, it consists of executing a local optimization from the different starting points obtained in the scan of the space of the dimensional parameters aj . In this way, different local minimums will be obtained and the best of them will be selected. To avoid excessive computational cost, the execution time of the genetic algorithm is limited to an acceptable value (i.e., 1 min). Bear in mind that it will not be necessary to obtain the optimal solutions, but that it will be enough to be close to them. On the other hand, the execution time of the local method to be applied later will depend on the number of iterations performed, but it generally consumes a few seconds for each starting point used. 2.2.3. Incorporation of Design Constraints Searching for an optimal design usually implies adapting the generated trajectory to a prescribed one. In addition, some design requirements must be fulfilled. These design constraints are related to several aspects, such as the maximum size of the mechanism, the maximum and minimum lengths of certain bars, the Grashof criterion, the transmission angle limits, and so on. Mathematics 2021,9, 1581 16 of 17 use of penalty functions. In this way, it can be ensured that the crank input mechanism does not exceed a maximum ratio between bar lengths or other additional design requirements at the discretion of the designer. Finally, the effectiveness of the method has been proved by verifying, through various examples, that the slider-crank mechanism allows us to achieve solutions with a precision comparable to other one degree of freedom mechanisms that have a greater number of dimensional parameters, such as the four-bar or the Watt’s mechanism, with the additional advantage of having simpler kinematics. Supplementary Materials: The following are available online at https://www.mdpi.com/article/10 .3390/math9131581/s1. The three videos corresponding to the motion of the optimum mechanisms are available. Author Contributions: Conceptualization, A.H., A.M., M.U. and E.A.; methodology, A.H., A.M. and M.U.; software, A.M.; validation, A.H., A.M., M.U. and E.A.; formal analysis, A.H.; investigation, A.H., A.M., M.U. and E.A.; resources, A.H. and A.M.; data curation, A.M.; writing—original draft preparation, A.H. and A.M.; writing—review and editing, M.U. and E.A.; visualization, A.M.; supervision, A.H.; project administration, A.H. and M.U.; funding acquisition, A.H., M.U. and E.A. All authors have read and agreed to the published version of the manuscript. Funding: The authors wish to acknowledge financial support received from the Spanish government through the Ministerio de Economía y Competitividad (Project DPI2015 − 67626-P (MINECO/FEDER, UE)), the support for the research group through Project Ref. IT949 − 16, provided by the Departamento de Educación, Política Lingüística y Cultura from the regional Basque Government, and the Program BIKAINTEK 2020 (Ref. 012-B2/2020) provided by the Departamento de Desarrollo Económico, Sostenibilidad y Medio Ambiente from the regional Basque Government. Institutional Review Board Statement: Not applicable. Informed Consent Statement: Not applicable. Data Availability Statement: Not applicable. Conflicts of Interest: The authors declare no conflict of interest. References 1. Erdman, A.G.; Sandor, G.N. Mechanism Design: Analysis and Synthesis, 4th ed.; Pearson: London, UK, 2001. 2. Wampler, C.; Morgan, A.P.; Sommese, A.J. Complete Solution of the Nine-Point Path Synthesis Problem for Four-Bar Linkages. J. Mech. Des. 1992,114, 153–159. [CrossRef] 3. Lee, W.-T.; Russell, K. Developments in quantitative dimensional synthesis (1970-present): Four-bar motion generation. Inverse Probl. Sci. Eng. 2017,26, 133–148. [CrossRef] 4. Lee, W.-T.; Russell, K. Developments in quantitative dimensional synthesis (1970–present): Four-bar path and function generation. Inverse Probl. Sci. Eng. 2018,26, 1280–1304. [CrossRef] 5. Alizade, R.I.; Mohan Rao, A.V.; Sandor, G.N. Optimum Synthesis of Four-Bar and Offset Slider-Crank Planar and Spatial Mechanisms Using the Penalty Function Approach with Inequality and Equality Constraints. J. Eng. Ind. 1975 ,97, 785–790. [CrossRef] 6. Rao, A.C. Optimum synthesis of a slider-crank mechanism using geometric programming. Int. J. Numer. Methods Eng. 1980 ,15, 1595–1602. [CrossRef] 7. Plecnik, M.M.; McCarthy, J.M. Five position synthesis of a slider-crank function generator. In Proceedings of the ASME International Conference IDETC/CIE 2011, Washington, DC, USA, 28–31 August 2011; pp. 317–324. 8. Almandeel, A.; Murray, A.P.; Myszka, D.H.; Stumph, H.E. A Function Generation Synthesis Methodology for All Defect-Free Slider-Crank Solutions for Four Precision Points. J. Mech. Robot. 2015,7, 031020–031021. [CrossRef] 9. Liniecki, A. Synthesis of a slider-crank mechanism with consideration of dynamic effects. J. Mech. 1970,5, 337–349. [CrossRef] 10. Davidson, J.K. Analysis and synthesis of a slider-crank mechanism with a flexibly-attached slider. J. Mech. 1970 ,5, 239–247. [CrossRef] 11. Zhou, H.; Ting, K.-L. Adjustable slider–crank linkages for multiple path generation. Mech. Mach. Theory 2002 ,37, 499–509. [CrossRef] 12. Russell, K.; Sodhi, R. On the Design of Slider-Crank Mechanisms. Part I: Multi-Phase Motion Generation. Mech. Mach. Theory 2005,40, 285–299. [CrossRef] 13. Russell, K.; Sodhi, R.S. On the design of slider-crank mechanisms. Part II: Multi-phase path and function generation. Mech. Mach. Theory 2005,40, 301–317. [CrossRef] Mathematics 2021,9, 1581 17 of 17 14. Zhou, H. Dimensional synthesis of adjustable path generation linkages using the optimal slider adjustment. Mech. Mach. Theory 2009,44, 1866–1876. [CrossRef] 15. Sancibrian, R.; Sarabia, E.G.; Sedano, A.; Blanco, J.M. A general method for the optimal synthesis of mechanisms using prescribed instant center positions. Appl. Math. Model. 2016,40, 2206–2222. [CrossRef] 16. Sun, J.; Chu, J. Fourier series representation of the coupler curves of spatial linkages. Appl. Math. Model. 2010 ,34, 1396–1403. [CrossRef] 17. Liu, W.; Sun, J.; Zhang, B.; Chu, J. Wavelet feature parameters representations of open planar curves. Appl. Math. Model. 2018 ,57, 614–624. [CrossRef] 18. Jianwei, S.; Jinkui, C.; Baoyu, S. A unified model of harmonic characteristic parameter method for dimensional synthesis of linkage mechanism. Appl. Math. Model. 2012,36, 6001–6010. [CrossRef] 19. Ding, H.; Huang, P.; Zi, B.; Kecskeméthy, A. Automatic synthesis of kinematic structures of mechanisms and robots especially for those with complex structures. Appl. Math. Model. 2012,36, 6122–6131. [CrossRef] 20. Chi-Yeh, H. A general method for the optimum design of mechanisms. J. Mech. 1967,1, 301–313. [CrossRef] 21. Angeles, J.; Alivizatos, A.; Akhras, A. An unconstrained nonlinear least-square method of optimization of RRRR planar path generators. Mech. Mach. Theory 1988,23, 343–353. [CrossRef] 22. Avilés, R.; Navalpotro, S.; Amezua, E.; Hernández, A. An Energy-Based General Method for the Optimum Synthesis of Mechanisms. J. Mech. Des. 1994,116, 127–136. [CrossRef] 23. Vallejo, J.; Avilés, R.; Hernández, A.; Amezua, E. Nonlinear optimization of planar linkages for kinematic syntheses. Mech. Mach. Theory 1995,30, 501–518. [CrossRef] 24. Sancibrian, R.; Viadero, F.; García, P.; Fernández, A. Gradient-based optimization of path synthesis problems in planar mechanisms. Mech. Mach. Theory 2004,39, 839–856. [CrossRef] 25. Sancibrian, R.; De Juan, A.; Sedano, A.; Iglesias, M.; García, P.; Viadero, F.; Fernandez, A. Optimal Dimensional Synthesis of Linkages Using Exact Jacobian Determination in the SQP Algorithm. Mech. Based Des. Struct. Mach. 2012 ,40, 469–486. [CrossRef] 26. Mariappan, J.; Krishnamurty, S. A generalized exact gradient method for mechanism synthesis. Mech. Mach. Theory 1996 ,31, 413–421. [CrossRef] 27. Cabrera, J.; Simon, A.; Prado, M. Optimal synthesis of mechanisms with genetic algorithms. Mech. Mach. Theory 2002 ,37, 1165–1177. [CrossRef] 28. Acharyya, S.; Mandal, M. Performance of EAs for four-bar linkage synthesis. Mech. Mach. Theory 2009 ,44, 1784–1794. [CrossRef] 29. Bu´skiewicz, J.; Starosta, R.; Walczak, T. On the application of the curve curvature in path synthesis. Mech. Mach. Theory 2009 ,44, 1223–1239. [CrossRef] 30. Kafash, S.H.; Nahvi, A. Optimal synthesis of four-bar path generator linkages using Circular Proximity Function. Mech. Mach. Theory 2017,115, 18–34. [CrossRef] 31. Gogate, G.R.; Matekar, S.B. Optimum synthesis of motion generating four-bar mechanisms using alternate error functions. Mech. Mach. Theory 2012,54, 41–61. [CrossRef] 32. Bulatovi´c, R.R.; Ðor ¯ devi´c, S.R. Control of the optimum synthesis process of a four-bar linkage whose point on the working member generates the given path. Appl. Math. Comput. 2011,217, 9765–9778. [CrossRef] 33. Xiao, R.; Tao, Z. A Swarm Intelligence Approach to Path Synthesis of Mechanism. In Proceedings of the Ninth International Conference on Computer Aided Design and Computer Graphics (CAD-CG’05), Hong Kong, China, 7–10 December 2005; Institute of Electrical and Electronics Engineers (IEEE): Piscataway, NJ, USA, 2005; pp. 451–456. 34. Bulatovic, R.R.; Miodragovic, G.; Boskovic, M.S. Modified Krill Herd (MKH) algorithm and its application in dimensional syn-thesis of a four-bar linkage. Mech. Mach. Theory 2016,95, 1–21. [CrossRef] 35. Ebrahimi, S.; Payvandy, P. Efficient constrained synthesis of path generating four-bar mechanisms based on the heuristic opti-mization algorithms. Mech. Mach. Theory 2015,85, 189–204. [CrossRef] 36. Vasiliu, A.; Yannou, B. Dimensional synthesis of planar mechanisms using neural networks: Application to path generator linkages. Mech. Mach. Theory 2001,36, 299–310. [CrossRef] 37. Sedano, A.; Sancibrian, R.; De-Juan, A.; Viadero, F.; Egaña, F. Hybrid Optimization Approach for the Design of Mechanisms Using a New Error Estimator. Math. Probl. Eng. 2012,2012, 1–20. [CrossRef] 38. Hernández, A.; Muñoyerro, A.; Urízar, M.; Amezua, E. Comprehensive approach for the dimensional synthesis of a four-bar linkage based on path assessment and reformulating the error function. Mech. Mach. Theory 2021,156, 104126. [CrossRef] 39. Laribi, M.A.; Mlika, A.; Romdhane, L.; Zeghloul, S. A combined genetic algorithm-fuzzy logic method (GA-FL) in mechanism synthesis. Mech. Mach. Theory 2004,39, 717–735. [CrossRef] 40. Smaili, A.; Diab, N. Optimum synthesis of hybrid-task mechanisms using ant-gradient search method. Mech. Mach. Theory 2007 , 42, 115–130. [CrossRef] 41. Fernández-Bustos, I.; Aguirrebeitia, J.; Avilés, R.; Angulo, C. Kinematical synthesis of 1-dof mechanisms using finite elements and genetic algorithms. Finite Elements Anal. Des. 2005,41, 1441–1463. [CrossRef]