I. Introduction

METAHEURISTICS are algorithms designed to solve a wide variety of hard optimization problems in an approximate way, using trial and error techniques. The general characteristics of a metaheuristic are: it is inspired on natural or artificial processes, uses stochastic components (involving random variables), and has a series of parameters that must be adjusted to the specific case ^{[1]}.

Population-based metaheuristics start from an initial set of solutions or proposed individuals to find the optimal value or values of a problem, and there are two general groups of these algorithms: evolutive computing and swarm intelligence. The two main tasks of modern metaheuristics are diversification (exploration) and intensification (exploitation) ^{[2]}. Techniques based on population are good for exploring, but usually are deficient when exploiting ^{[1]}. Several alternatives have been developed in order to solve this weakness, and Memetic Algorithms (MAs) highlight between them for synergically combining the global search dynamics of a population metaheuristic with the refinements of a local search (LS), in order to obtain a hybrid method of solution ^{[3]}, ^{[4]}.

The first MAs were taken with suspicion because of their metaheuristic nature, but in the last decade these techniques have been applied successfully to solve different problems including numerical cases with constraints, and dynamic multi-objective optimization ^{[3]}, ^{[5]}-^{[7]}. In the real world, they have been used in security and cryptanalysis ^{[8]}, control systems ^{[9]}, task scheduling and routing ^{[10]}, and data classification ^{[11]}, among others.

In mechanical engineering, *synthesis* is the design process of machines or mechanical systems ^{[12]}. The purpose of the mechanism determines the type of synthesis to carry out: generation of motion, function or trajectory. In the synthesis for function generation, an input motion to the mechanism is correlated with another for output; in trajectory generation, a point is controlled to track a line in a plane, such that it assumes a prescribed set of sequential positions ^{[13]}. This work addresses the dimensional synthesis of a mechanism: calculate the length of the necessary links for tracking a specific trajectory.

The four-bar mechanism has been widely used in engineering design, since it is the simplest articulated mechanism for controlled movement with a degree of freedom. The synthesis of four-bar mechanisms for trajectory tracking is a well-known numerical problem previously explored in depth, and classical approaches have been used for this synthesis, including graphical and analytical methods; however, they have a limitation regarding the number of points to be tracked, since solutions are extremely complicated for problems with more than four points. For this reason, the design of these mechanisms is a typical case of hard numerical optimization.

Hard optimization problems can't be solved in an optimal way or to a guaranteed limit using deterministic methods and with normal computing resources. Taking into account that most real-world optimization cases are hard problems, it is necessary to develop alternative methods for their solution. In the search of new ideas for improving the performance of metaheuristics several models have been implemented, based on natural or artificial processes.

In this work, the design of a new memetic algorithm (MemMABC) is presented, with its application to the optimal synthesis of a four-bar mechanism for the control of a trajectory delimited by a set of *N* precision points tracked by the coupler. MemMABC is a combination of MABC and a version of the Random Walk algorithm (RW) modified for handling design constraints by implementing the feasibility rules of Deb. Although these building blocks are well-known methods usually they are applied only in an individual way; this is a novel approach to solve constrained problems of numerical optimization by combining synergically two strategies of different nature, applied to a real-world engineering case.

The paper is organized as follows: Section 2 shows the basic model of memetic algorithms and the implementation of local search stages. In Section 3, the MemMABC algorithm is introduced, with an analysis of both its global and local searchers. Section 4 describes the problem of mechanism synthesis, with a brief explanation of the kinematics. A case study with a specific optimization problem is analyzed in Section 5, including the description of the design variables. Section 6 presents the applied algorithm, with special emphasis on its computational implementation. Finally, experimental results are reported in Section 7, while the conclusions of this paper are included in Section 8.

II. Memetic Algorithms

Early work on MAs dates from the 80s ^{[1]}, ^{[14]}; as a consequence of the strengthening in evolutive algorithms, new ideas were implemented in order to improve their performance, once that their limitations were known. In 1989, Moscato ^{[15]} proposed the memetic algorithms, to simulate the cultural evolution process derived from Lamarck's evolution theory and the *meme,* presented by R. Dawkins as the equivalent to the gene in natural evolution. MAs constitute a general method based on the sinergetic combination of algorithms for global and local search, in a new optimization philosophy ^{[16]}. A meme corresponds to recurrent patterns in real world or to specific knowledge, and is coded for the effective solution of problems as the building block of cultural know-how that is transmissible and reproducible ^{[17]}, ^{[18]}.

Three stages can be identified in the evolution of MAs ^{[4]}:

Applications are made by simple combination of an evolutive algorithm and a specialized method of local search.

Multiple memes are used, and the developments include any population-based algorithm as a global search tool.

Explicit mechanisms of learning are incorporated (adaptive MAs), with the use of exact methods in tandem configuration for local search.

MAs of first and second stages are still being developed because of their simplicity and efficiency, with an improvement over the performance of previously applied single metaheuristics.

A. Basic Model of a Memetic Algorithm

Figure 1 shows the block diagram of a basic population metaheuristic, indicating the four points where a local search can be included in order to form a MA ^{[19]}, ^{[20]}:

On the population, to simulate the cultural development that will be transmitted from one generation to another; it can be applied to the whole set of agents or to specific elements, and even to the initial group.

On the parent or selected parents, before reproduction stage.

When new solutions are generated, to produce a better offspring.

On the offspring, before selecting a survivor according to fitness criteria.

From this basic model several versions of MAs have been developed, differing between each other in at least one of the following aspects:

- Population metaheuristic used as a base.

- Selected algorithm for local search (exact method or metaheuristic, number of memes to consider.)

- Conditions for local search (trigger event, frequency, intensity, number of individuals to improve, etc.)

^{[18]},^{[21]}.

Originally MAs were based on evolutive algorithms but nowadays their implementation with swarm intelligence methods is common, using algorithms such as Particle Swarm Optimization (PSO) ^{[11]}, Artificial Bee Colony (ABC) ^{[22]}, Harmony Search (HS) ^{[23]}, and Fire Fly (FF) ^{[24]}.

B. Local Search

Local search algorithms are stochastic or deterministic methods that take as an input a solution generated randomly or by a specific algorithm, looking for transitions with the neighbors to this point at a given time. The goal is to find a better individual and to convert it in the next configuration, maintaining the original element if no improvement is detected ^{[25]}. The concept of vicinity is fundamental for LS since it represents the search area for individual refinement; in the case of combinatorial optimization this area is formed by the set of all solutions that can be reached by a unitary change in the current individual, while in continuous or numerical problems it is a dense set formed by an infinite number of points, and a modification strategy is required to find the neighbors ^{[20]}.

Finding a good balance between the components of global and local search is one of the main design goals in a MA, and can be seen as an optimization process *per se.* From the way a memetic algorithm is compounded and in the implementation of its LS, it is seen that the equality MA = GS + LS is incorrect, since both searches are interrelated and are not designed as independent stages ^{[14]}.

C. Classification of MAs

A MA can be classified as simple (canonical) or adaptive ^{[26]}. Simple MAs are characterized for *a priori* knowledge of the problem domain, that is incorporated to the algorithm design and produces a static behavior; in spite of belonging to the first generation of MAs, canonical hybrids are still popular for their easy implementation, particularly because of the use of genetic algorithms as global searchers.

On the other hand, adaptive MAs acquire information during their execution (learning), so they are able to reconfigure not only their parameters but their operators at run time, in order to adapt themselves to specific circumstances or instances of the problem ^{[18]}. The design of an adaptive MA requires to consider such aspects as the selection of subsets with agents for applying the fine search, the frequency and intensity of LS stages, the selection of procedures for the improvement, and the convergence of the population ^{[6]}, ^{[22]}.

III. MemMABC Algorithm

The Artificial Bee Colony is a swarm intelligence algorithm introduced by Karaboga as a method for numerical optimization ^{[27]}, inspired on the behavior of bee hives in two natural processes: the recruitment of bees for the exploitation of food sources and the abandonment of exhausted sources. In ABC, the bees in a hive are divided in three groups: employed, onlookers and scouts, and each group represents an evaluation stage. There is an employed bee assigned to each source, and from this point the bee calculates a new solution and keeps the best of both. The number of onlookers is the same as the employed bees, and their assignation to sources is determined by the performance of such sources.

The onlookers also calculate new solutions from their assigned source. Finally, when a source can't improve after a specified number of cycles, it is abandoned and replaced by a new one found by a scout bee.

Several versions of ABC have been developed; the modification proposed in ^{[28]}, MABC, has an adaptation for constrained numerical optimization with a tournament-type selection based on the feasibility rules of Deb ^{[29]}. These criteria improve the process for selecting solutions at each iteration, by choosing the most feasible individual instead of the one with the best value for the objective function:

Between two feasible solutions, the best objective function value is preferred.

Between a feasible solution and another infeasible, the feasible is selected.

Between two infeasible solutions, the lowest sum of constraint violations (CVS) is preferred.

In this development a novel canonical MA, MemMABC, was designed taking as a base the MABC
algorithm for global searching, with a modification to include a LS activated by
time; Algorithm 1, A1, shows this memetic. The
trigger for the LS stages is controlled by the variable *Frequency,*
which indicates the period between an event of LS and the next one, in terms of a
number of cycles or generations (line 39, A1).
Although the iterations in original ABC and MABC are controlled by the number of
cycles, MemMABC uses a variation to stop after a fixed number of objective function
evaluations. This implementation permits a fair comparison ^{[30]} of MemMABC with other algorithms, specifically with MABC
for the purposes of this work.

Algorithm 2, A2, shows the implementation of
the local search method in MemMABC. It is a version of RW, modified to handle
constraints by implementing the rules of Deb (line 21, A2). RW was chosen because of their easy implementation, since
this method does not require the derivative of the objective function to calculate
its gradient or its Hessian. Another modification was introduced to the original RW
in order to reduce the computing effort and execution time, taking into account the
complexity and high dimensionality of some real-world problems. RW requires the
random generation of a number set *R* with values in the interval
[-1,1], whose cardinality corresponds to the number of design variables,
*n.* The values in *R* are transformed into search
directions, so it is necessary to avoid a bias toward the diagonals of the unit
hypercube surrounding the initial search point ^{[31]}. The random numbers generated are accepted only if
*R* < 1, with *R* being computed as

But when the problem to solve has a high dimensionality the algorithm can take several
iterations to find a valid combination. This can be avoided if the elements on
*R* are downsized when generated, using a constant divider (line
10, A2). The resultant array is a subset of
*R,* so it is a valid combination. Finally, the LS depth or
intensity is controlled by the parameter *MaxEvs,* who indicates the
maximum number of evaluations for each activation.

IV. Analysis of the Four-Bar Mechanism

A planar four-bar mechanism is formed by a reference bar (*r _{1}
* ), a crank or input bar (

*r*), a coupler (

_{2}*r*), and a rocker or output bar (

_{3}*r*), as is shown in Figure 2. Two coordinate systems are proposed in order to analyze this mechanism: a system fixed to the real world

_{4}*(OXY)*and another for self reference (

*OX*), where

_{r}Y_{r}*(x*is the distance between the origin of both systems,

_{0}, y_{0})*θ*is the rotation angle of the reference system and

_{0}*d*corresponds to the angles for the bars in the mechanism; finally, the coordinate pair

_{:}θ_{i}(i=2,3,4)*(r*indicates the length of the support bars to position the coupler

_{cx},r_{cy})*C.*

A. Kinematics of the mechanism

The kinematics of four-bar mechanisms have been extensively trated, detailed explanations are in ^{[32]} and ^{[33]}. For analyzing the mechanism position loop equation can be established as:

Equation (2) can be expressed in polar notation as:

After applying Euler's equation to (3), the real and imaginary parts are:

Left side of equation system (4) can be expressed in terms of *θ _{4}
* to obtain the angular position

*θ*

_{3}:

The compact form of Freudenstein's equation is obtained by squaring the system (5) and adding its terms, as:

with:

*θ _{3}* can be obtained as a function of the parameters

*A*and

_{1}, B_{1}, C_{1}*θ*, expressing

_{2}*sin*θ

*and*

_{3}*cos*

_{3}in terms of

*tan (*θ

*as follows:*

_{3}/2)

A second-order lineal equation is obtained by substitution on (6):

Solving (11), the angular position *θ _{3}
* is given by:

B. Kinematics of the coupler

Since *C* is the point of interest in the coupler, to determine its position
in the system *OX _{r}Y_{r}
* it has to be established that:

Translated to the global coordinate system, this point is expressed as:

As can be observed, equations (13), (14) and the expressions corresponding to mechanism kinematics are sufficient to calculate the position of *C* along the trajectory.

V. Case Study

The problem addressed in this work is the length synthesis of a four-bar mechanism, designed
for tracking a vertical linear trajectory indicated by a set of *N*
precision points, without prescribed synchronization; that is, the point
*C* of the coupler must *pass over* every point
consecutively, without a pre-established sequence for such positions. The case study
was selected because of its complexity; a measure for this complexity is the
parameter *p*, which stands for the ratio between the feasible zone
and the search space and can be represented by the percentage of feasible solutions
found in an arbitrarily large set of randomly-generated vectors ^{[34]}. As the value of *p*
diminishes, the computational effort required by the solving algorithm increases,
since there are fewer available solutions. In order to evaluate *p*
for this case a million of proposed solutions were taken, and only forty-three of
them were feasible, resulting in a value of *p* = 0.0043%.

Without loss of generality, the constrained optimization problem can be defined as to:

Subject to:

where *n, f (*
*)* is the objective function, *g _{j}
(*

*)*is the set of

*p*inequality constraints and

*h*

_{k}(*)*is the set of

*q*equality constraints.

A. Objective function

As a result of the mechanism synthesis will be calculated the length of the bars, the distance and rotation angle between the coordinate systems, and the angle set for the input bar. In the global coordinate system *OXY* , the precision point

The set of precision points is defined as:

Given a set of values of the mechanism bars and their parameters *x _{0},y_{0}, θ_{0}
* , each position of the coupler can be expressed as a function of the input bar angle:

It is desired to minimize the distance between the calculated and the precision points,
*C ^{i}* and

B. Design constraints

The fulfillment of the performance constraints related to dimensions and mobility criteria of the mechanism is fundamental in its design, since these limits establish the physical reproducibility and esthetic.

*1) Sequence of input angles:* The generation of a trajectory without
prescribed synchronization requires an ascendant or descendant order of the
crank angle values, in correspondence to each precision point. If the angle for
the precision point i is denoted as

where *N* is the number of precision points.

*2) Grashof's law:* It is a fundamental consideration of design, since it defines the criteria to ensure complete mobility for at least one link on a four-bar mechanism. This law establishes that *for a planar four-bar linkage, the sum of the shortest bar and the largest bar cannot be larger than the sum of the remaining bars, if a continual relative rotation between two elements is desired* [12]. If the lengths of the shortest and largest links are denoted as *s* and l respectively, with p and *q* indicating the remaining links, it is established that:

For this synthesis problem, Grashof's law is given by:

Consequently the following restrictions are required:

C. Design variables

Consider the vector of design variables for the four-bar mechanism, established as:

where the first four variables are the mechanism bar lengths, the following two values represent the length of the supporting bars of the coupler, the subsequent three variables indicate the relative position between the coordinate systems, and the last six values correspond to the angle sequence for the input bar.

VI. Optimization Algorithm

Algorithms 1 and 2 correspond to the global and local search sections of the proposed memetic MemMABC, respectively. This algorithm requires six user-defined parameters: the number of sources or possible solutions *SN*, the maximum number of cycles or generations *MCN*, the maximum number of the objective function evaluations Ma*x*E*vs*, the frequency of LS activation *Frequency*, the LS depth *MaxCount*, and the number of consecutive trials for improvement a source is kept before being replaced *TryLimit*, that is calculated as:

where *n* is the number of design variables.

The implementation of the proposed algorithm was programmed in MATLAB R2013a, and the simulations were carried out on a computational platform with the following characteristics: Intel Core i7@2.6 GHZ microprocessor, 8Gb RAM memory and Windows 8 Operating system. All the algorithm simulations were executed with the following parameter values: *SN* = 50, *MCN* = 8,000, *MaxEvs* = 1,000, 000, *Frequency* = 1, 750, *MaxCount* = 40, 000, and *TryLimit* = 750, calculated from (42).

VII. Analysis of Results

Thirty independent runs were executed for the selected case study with both algorithms, MABC
and MemMABC; a statistical analysis of their results is presented in Table I. As can be seen, the minimum value for
the objective function was obtained with MemMABC (*OF* =
0.014667757429261), with a variance of σ^{2} = 0.086822826371684,
significantly lesser than the correspondent evaluation for MABC; since the variance
measures the dispersion of a set of random variables with respect to their
arithmetic mean, this value indicates a steady operation of the algorithm.
Additionally, MemMABC required a 10% less evaluations to find its best result, even
before reaching the stop condition given by
M*ax*E*vs*. The results show the synergy formed by the
combination of these global and local searchers, and the inclusion of a technique
for handling of constraints.

Figure 3 shows a simulation of the best-solution mechanism calculated by MemMABC, and its trajectory over the precision points, marked as *C*
_{1}, *C*
_{2},...,*C*
_{6}. As it can be seen, the mechanism passes over the precision points in its ascending path and the return loop is quite small. Consequently the recovering time is short, a plus if the device is analyzed from an engineering point of view.

A set with five solutions was selected considering the best values of the objective function; Table II present the solution vectors included in that set. As can be seen, all the values fell within the limits marked by design constraints; because of the table size, quantities are represented using only five decimal digits in spite of being calculated in the simulation with a precision of fourteen decimal places. The results generated after the simulations demonstrate the capability of MemMABC for balancing diversification over the area of feasible solutions and intensification for local exploitation.

VIII. Conclusion

A novel proposal of a memetic algorithm for solving real-world engineering design problems is presented in this paper, using a combination of algorithms with Modified Artificial Bee Colony and Random Walk. From the obtained results it is established that: 1) the algorithm improves the performance of MABC, not only in relation to the search for the optimal, but in reference to the stability of the search; 2) considering the point of view of engineering design, this optimization method produces good solutions since they are physically and esthetically reproducible; 3) no extensive computing resources are required for its implementation, and 4) it is a simple algorithm with an easy implementation. It should be mentioned that wide ranges of values for the design variables were used for simulating solutions of the proposed optimization problem, so results can be improved if such ranges are bounded more closely, accordingly to the physical specifications of the real model.

Although in this paper a specific case of synthesis for a four-bar mechanism is addressed, the simplicity of the proposed algorithm facilitates its use for the designing of other types of mechanisms and devices. In this sense, the main difficulty is an adequate interpretation and formulation of the particular problem and its corresponding constraints. The initial configuration of the algorithm requires special attention and is a line that can be the base for future work, considering both the previous tuning of parameters and their control during execution.

Finally, the main future work for this development is its transformation from a canonical memetic to an adaptive algorithm, with the capability to modify itself by incorporating knowledge to this process of self adaptation. This transformation implies the application of new techniques for local search, and to implement the intelligence required to process more than one meme for the learning.