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

: 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 ﬁtness 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.


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][6][7][8], for dynamic synthesis [9,10], and to serve as an adjustable mechanism [11][12][13][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 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][28][29], differential evolution [30][31][32], ant search [33], krill herd algorithm [34], 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.
• 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.

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.

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.

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.

•
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.

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.

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.

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. The loop-closure equations are the following: From Equation (1) yields: Then, cos is given by Equation (4), where = ±1.
The synthesis equations are as follows: The loop-closure equations are the following: From Equation (1) yields: Then, cosθ is given by Equation (4), where K = ±1.
The synthesis equations are as follows: 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':

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.
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':

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. 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 . 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 a 6 , and a translation in the plane defined by the parameters a 7 and a 8 .
The equations that express the synthesis variables in the global reference system are the following: y i = x i ·sin(a 6 ) + y i ·cos(a 6 ) + a 7 (10)  The equations that express the synthesis variables in the global reference system are the following: 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.

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: 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. Now that all the variables involved in the synthesis problem have been defined, the following classification can be established: • Dimensional variables: a 1 , a 2 , . . . , a 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: θ, 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.

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: 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 a j 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.

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 a j 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 (a 1 , a 2 . . . a 8 , ϕ 1 , ϕ 2 , . . . ϕ N ) = 0. On the other hand, Equation (13) is made up of N equations, as many as points of precision has the trajectory. Each of these equations has the form h(a 1 , a 2 . . . a 8 , ϕ 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.

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 (a 1 , a 2 , . . . , a 8 ) 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 N equations, each with a unique ϕ i .
In the simplest case of the slider-crank mechanism, with 2 dimensional parameters (a 1 = a 2 = a 3 and a 5 = a 6 = a 7 = a 8 = 0), and using the transformation of half-angle tangent, t i = tan ϕ i 2 , Equation (13) becomes a fourth degree polynomial: From the 4 possible values of t i (ϕ 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 4 will 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). 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). 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.

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: To illustrate this concept, in Figure 5 the prescribed point for a synthesis position i and the trajectory generated by the mechanism of dimensions a j 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. 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). 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.

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:

• Second phase:
In this phase, the values ϕ i obtained in the previous phase will be assumed as constants, and the unknowns (a 1 , a 2 , . . . , a 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: 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 (a 1 , a 2 , . . . , a 8 ) that were assumed as constants in the previous phase will be taken.

• Next steps:
With the new values of a j 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 (a 1 , a 2 . . . a 8 , ϕ 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.

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 a j . 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 a j . 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.

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, x FOR PEER REVIEW 10 of 18 Figure 6. Flowchart of the hybrid optimization scheme.

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.
In general, the optimization problem with certain inequality constraints can be formulated as the minimum error subjected to , is expressed as follows: When an inequality constraint, such as Equation (16), is included in the process, the error function yields In general, the optimization problem with certain inequality constraints can be formulated as the minimum error subjected to g k {a 1 , . . . , a n } ≥ 0 ∀k = 1, 2, . . . , l A typical constraint equation, g k , is expressed as follows: When an inequality constraint, such as Equation (16), is included in the process, the error function yields If, on the one hand, Equation (16) is not fulfilled during the iterations of the optimization process, it is necessary to amplify the value of the error to invalidate the corresponding design a j . This can be done by means of the λ parameter, which acts as a penalty factor, proceeding as follows: If, on the other hand, the condition to be imposed is an equality constraint, then λ will always be a certain predefined value. In this paper, after reviewing similar works in the literature and conducting several trials with different values, the value λ = 50 was established, insofar as it provides good results for all the analyzed design cases.

Results
The following examples will demonstrate the validity of the proposed methodology, showing the results of each design case.

Demonstrative Example 1
The desired trajectory, shown in Figure 7, is formed by two straight lines and two circumference arcs tangent to these lines. Considering the simplicity of the slider-crank, achieving a design that traces this trajectory is challenging. Moreover, this example is interesting because the trajectory combines both straight lines and arcs, which are trajectories commonly used in the path planning synthesis of planar mechanisms. The coordinates of the desired points, x d i , y d i , are given in Table 1. A total of 16 points are defined.
If, on the one hand, Equation (16) is not fulfilled during the iterations of the optimization process, it is necessary to amplify the value of the error to invalidate the corresponding design { }. This can be done by means of the parameter, which acts as a penalty factor, proceeding as follows: If, on the other hand, the condition to be imposed is an equality constraint, then will always be a certain predefined value. In this paper, after reviewing similar works in the literature and conducting several trials with different values, the value = 50 was established, insofar as it provides good results for all the analyzed design cases.

Results
The following examples will demonstrate the validity of the proposed methodology, showing the results of each design case.

Demonstrative Example 1
The desired trajectory, shown in Figure 7, is formed by two straight lines and two circumference arcs tangent to these lines. Considering the simplicity of the slider-crank, achieving a design that traces this trajectory is challenging. Moreover, this example is interesting because the trajectory combines both straight lines and arcs, which are trajectories commonly used in the path planning synthesis of planar mechanisms. The coordinates of the desired points, ( , ), are given in Table 1. A total of 16 points are defined.   The eight dimensional parameters and the 16 input parameters (unprescribed timing) will be optimized, that is, the most complete case possible. Following the previously described technique, this example is solved using the proposed multi-start method, starting from 100 different starting mechanisms. The conditions of the crank-input (based on Grashof's criterion) and a maximum 3:1 ratio between the longest and shortest bar are imposed by means of penalty functions. The best solution, shown in Figure 8, leads to an error equal to 0.0073. The corresponding design parameters are included in Table 2. In the Supplementary Materials, a video showing the motion of this optimum mechanism can be found. The eight dimensional parameters and the 16 input parameters (unprescribed timing) will be optimized, that is, the most complete case possible. Following the previously described technique, this example is solved using the proposed multi-start method, starting from 100 different starting mechanisms. The conditions of the crank-input (based on Grashof's criterion) and a maximum 3:1 ratio between the longest and shortest bar are imposed by means of penalty functions.
The best solution, shown in Figure 8, leads to an error equal to 0.0073. The corresponding design parameters are included in Table 2. In the Supplementary Materials, a video showing the motion of this optimum mechanism can be found.   To illustrate the influence that the starting point has on the final solution obtained, Figure 9 shows, by way of example, the optimal mechanism obtained from another starting point, which does not reach a solution as good as the one shown above, so it would be excluded. particular reference [38], making use of another optimization method and applying it to the four-bar mechanism. It should be taken into account that the four-bar mechanism has an additional dimensional parameter with respect to the slider-crank and thus, in principle, a greater potential to adjust to the prescribed trajectories. Nevertheless, comparing the results of both achieved optimal mechanisms (the error in [38] with the four-bar was 0.0089), it can be seen that they are almost of the same value, even having a slightly smaller error in the current case.  Figure 10a shows the results obtained by other authors [30,34,39,40] for an example of path generation synthesis of a closed path formed by 25 points marked in red. Each of the authors uses a different optimization method, but all of them use the four-bar mechanism. On the other hand, Figure 10b shows the results obtained when solving the same example with the slider-crank under the methodology proposed in this paper.

Demonstrative Example 2
The comparison is made with other studies that analyze the four-bar because, as mentioned in the introduction, the vast majority of path generation synthesis works make use of the four-bar. Even so, as it has been shown in the previous example and it will happen in this one, the method that we propose achieves very similar (or even better) results, despite making use of a more limited mechanism such as the slider-crank.
The optimal solution obtained in this paper with the slider-crank mechanism ( Figure  10b) corresponds to an error of 0.103 and is of similar quality to Bulatović et al. [34]. They obtained an error of 0.0392, which is slightly lower than the one we found, but is of the same order of magnitude. On the other hand, in [34] they also indicated the error achieved by Laribi et al. [39] and Smaili and Diab [40], these being 0.9022 and 0.5504, respectively, so they would be considerably higher. On the other hand, the error obtained by Kafash and Nahvi [30] is not directly comparable with the rest because they use a different error function. However, the trajectory generated by the authors in [30] is graphically represented in Figure 10a. This same example has been used by the authors of this work in a recent work, in particular reference [38], making use of another optimization method and applying it to the four-bar mechanism. It should be taken into account that the four-bar mechanism has an additional dimensional parameter with respect to the slider-crank and thus, in principle, a greater potential to adjust to the prescribed trajectories. Nevertheless, comparing the results of both achieved optimal mechanisms (the error in [38] with the four-bar was 0.0089), it can be seen that they are almost of the same value, even having a slightly smaller error in the current case. Figure 10a shows the results obtained by other authors [30,34,39,40] for an example of path generation synthesis of a closed path formed by 25 points marked in red. Each of the authors uses a different optimization method, but all of them use the four-bar mechanism. On the other hand, Figure 10b shows the results obtained when solving the same example with the slider-crank under the methodology proposed in this paper.

Demonstrative Example 2
The comparison is made with other studies that analyze the four-bar because, as mentioned in the introduction, the vast majority of path generation synthesis works make use of the four-bar. Even so, as it has been shown in the previous example and it will happen in this one, the method that we propose achieves very similar (or even better) results, despite making use of a more limited mechanism such as the slider-crank.
The optimal solution obtained in this paper with the slider-crank mechanism (Figure 10b) corresponds to an error of 0.103 and is of similar quality to Bulatović et al. [34]. They obtained an error of 0.0392, which is slightly lower than the one we found, but is of the same order of magnitude. On the other hand, in [34] they also indicated the error achieved by Laribi et al. [39] and Smaili and Diab [40], these being 0.9022 and 0.5504, respectively, so they would be considerably higher. On the other hand, the error obtained by Kafash and Nahvi [30] is not directly comparable with the rest because they use a different error function. However, the trajectory generated by the authors in [30] is graphically represented in Figure 10a. The corresponding optimal design parameters for the more general case of slider-crank are shown in Table 3. As in the previous example, a video showing the motion of this optimum mechanism is included as Supplementary Materials.  atics 2021, 9 The corresponding optimal design parameters for the more general case of slidercrank are shown in Table 3. As in the previous example, a video showing the motion of this optimum mechanism is included as Supplementary Materials.

Demonstrative Example 3
On this occasion, a path generation problem, previously solved in reference [41] for the Watt mechanism, is presented. Their optimal solution is represented in Figure 11a, together with the set of prescribed points represented in red. The optimal solution obtained with the slider-crank mechanism, represented in Figure 11b, has an equal, and, it could be said, even higher precision, despite being a simpler mechanism that has fewer design parameters involved.

Demonstrative Example 3
On this occasion, a path generation problem, previously solved in reference [41] for the Watt mechanism, is presented. Their optimal solution is represented in Figure 11a, together with the set of prescribed points represented in red. The optimal solution obtained with the slider-crank mechanism, represented in Figure 11b, has an equal, and, it could be said, even higher precision, despite being a simpler mechanism that has fewer design parameters involved.
The optimal design parameters of the slider-crank mechanism are listed in Table 4. The optimal design parameters of the slider-crank mechanism are listed in Table 4. Yet again, a video showing the motion of this optimum mechanism is included as Supplementary Materials.

Discussion
In this paper, a hybrid optimization procedure has been presented to address the dimensional synthesis of path generation using the slider-crank mechanism. On the one hand, a novel approach has been proposed to solve the non-linear equations corresponding to the null gradient condition, which is based on the decoupling of two subsystems of equations, and which simplifies the resolution procedure without prejudice to the precision obtained. On the other hand, the incorporation of the multi-start method manages to give the local optimization method a global character, carrying out a previous sweep of the total space of the dimensional variables to find the most promising starting approxi- Figure 11. (a) Watt's mechanism optimal solution from [41]; (b) optimal solution for slider-crank mechanism.

Discussion
In this paper, a hybrid optimization procedure has been presented to address the dimensional synthesis of path generation using the slider-crank mechanism. On the one hand, a novel approach has been proposed to solve the non-linear equations corresponding to the null gradient condition, which is based on the decoupling of two subsystems of equations, and which simplifies the resolution procedure without prejudice to the precision obtained. On the other hand, the incorporation of the multi-start method manages to give the local optimization method a global character, carrying out a previous sweep of the total space of the dimensional variables to find the most promising starting approximations. To carry out this search, a genetic algorithm is used where only the eight dimensional parameters are involved, thanks to the fact that the fitness function has been programmed to select the optimal input parameters based on the dimensions.
In addition, it should be noted that this methodology is aimed at achieving designs that are valid from a practical point of view. Therefore, the non-existence of branch defects is ensured, and different design restrictions can be incorporated in a simple way through the 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.