lanxicy.com

蘭溪范文 文檔專家

蘭溪范文 文檔專家

A Genetic Algorithm for Function Optimization: A Matlab Implementation

Christopher R. Houck North Carolina State University and Je ery A. Joines North Carolina State University and Michael G. Kay North Carolina State University

A genetic algorithm implemented in Matlab is presented. Matlab is used for the following reasons: it provides many built in auxiliary functions useful for function optimization; it is completely portable; and it is e cient for numerical computations. The genetic algorithm toolbox developed is tested on a series of non-linear, multi-modal, non-convex test problems and compared with results using simulated annealing. The genetic algorithm using a oat representation is found to be superior to both a binary genetic algorithm and simulated annealing in terms of e ciency and quality of solution. The use of genetic algorithm toolbox as well as the code is introduced in the paper. Categories and Subject Descriptors: G.1 Numerical Analysis]: Optimization|Unconstrained Optimization, nonlinear programming, gradient methods General Terms: Optimization, Algorithms Additional Key Words and Phrases: genetic algorithms, multimodal nonconvex functions, Matlab

Algorithms for function optimization are generally limited to convex regular functions. However, many functions are multi-modal, discontinuous, and nondi erenName: Christopher R. Houck Address: North Carolina State University, Box 7906, Raleigh, NC, 27695-7906,USA,(919) 5155188,(919) 515-1543,[email protected] A liation: North Carolina State University Name: Je ery A. Joines Address: North Carolina State University, Box 7906, Raleigh, NC, 27695-7906,USA,(919) 5155188,(919) 515-1543,[email protected] A liation: North Carolina State University Name: Michael G. Kay Address: North Carolina State University, Box 7906, Raleigh, NC, 27695-7906,USA,(919) 5152008,(919) 515-1543,[email protected] A liation: North Carolina State University Sponsor: This research was funded in part by the National Science Foundation under grant number DMI-9322834.

1. INTRODUCTION

2

C. Houck et al.

tiable. Stochastic sampling methods have been used to optimize these functions. Whereas traditional search techniques use characteristics of the problem to determine the next sampling point (e.g., gradients, Hessians, linearity, and continuity), stochastic search techniques make no such assumptions. Instead, the next sampled point(s) is(are) determined based on stochastic sampling/decision rules rather than a set of deterministic decision rules. Genetic algorithms have been used to solve di cult problems with objective functions that do not possess \nice" properties such as continuity, di erentiability, satisfaction of the Lipschitz Condition, etc. Davis 1991; Goldberg 1989; Holland 1975; Michalewicz 1994]. These algorithms maintain and manipulate a family, or population, of solutions and implement a \survival of the ttest" strategy in their search for better solutions. This provides an implicit as well as explicit parallelism that allows for the exploitation of several promising areas of the solution space at the same time. The implicit parallelism is due to the schema theory developed by Holland, while the explicit parallelism arises from the manipulation of a population of points|the evaluation of the tness of these points is easy to accomplish in parallel. Section 2 presents the basic genetic algorithm, and in Section 3 the GA is tested on several multi-modal functions and shown to be an e cient optimization tool. Finally, Section 4 brie y describes the code and presents the list of parameters of the Matlab implementation.

2. GENETIC ALGORITHMS

Genetic algorithms search the solution space of a function through the use of simulated evolution, i.e., the survival of the ttest strategy. In general, the ttest individuals of any population tend to reproduce and survive to the next generation, thus improving successive generations. However, inferior individuals can, by chance, survive and also reproduce. Genetic algorithms have been shown to solve linear and nonlinear problems by exploring all regions of the state space and exponentially exploiting promising areas through mutation, crossover, and selection operations applied to individuals in the population Michalewicz 1994]. A more complete discussion of genetic algorithms, including extensions and related topics, can be found in the books by Davis Davis 1991], Goldberg Goldberg 1989], Holland Holland 1975], and Michalewicz Michalewicz 1994]. A genetic algorithm (GA) is summarized in Fig. 1, and each of the major components is discussed in detail below.

(1) (2) (3) (4) (5) (6) (7) (8) Supply a population 0 of individuals and respective function values. 1 0 ( i ? 1) i ( i0 ) i ( i) +1 Repeat step 3 until termination Print out best solution found

P N i P selection f unction P P reproduction f unction P i

evaluate P i

Fig. 1. A Simple Genetic Algorithm

A GA for function optimization

3

The use of a genetic algorithm requires the determination of six fundamental issues: chromosome representation, selection function, the genetic operators making up the reproduction function, the creation of the initial population, termination criteria, and the evaluation function. The rest of this section describes each of these issues. For any GA, a chromosome representation is needed to describe each individual in the population of interest. The representation scheme determines how the problem is structured in the GA and also determines the genetic operators that are used. Each individual or chromosome is made up of a sequence of genes from a certain alphabet. An alphabet could consist of binary digits (0 and 1), oating point numbers, integers, symbols (i.e., A, B, C, D), matrices, etc. In Holland's original design, the alphabet was limited to binary digits. Since then, problem representation has been the subject of much investigation. It has been shown that more natural representations are more e cient and produce better solutions Michalewicz 1994]. One useful representation of an individual or chromosome for function optimization involves genes or variables from an alphabet of oating point numbers with values within the variables upper and lower bounds. Michalewicz Michalewicz 1994] has done extensive experimentation comparing real-valued and binary GAs and shows that the real-valued GA is an order of magnitude more e cient in terms of CPU time. He also shows that a real-valued representation moves the problem closer to the problem representation which o ers higher precision with more consistent results across replications. Michalewicz 1994] The selection of individuals to produce successive generations plays an extremely important role in a genetic algorithm. A probabilistic selection is performed based upon the individual's tness such that the better individuals have an increased chance of being selected. An individual in the population can be selected more than once with all individuals in the population having a chance of being selected to reproduce into the next generation. There are several schemes for the selection process: roulette wheel selection and its extensions, scaling techniques, tournament, elitist models, and ranking methods Goldberg 1989; Michalewicz 1994]. A common selection approach assigns a probability of selection, Pj , to each individual, j based on its tness value. A series of N randomi numbers is generated and P compared against the cumulative probability, Ci = j =1 Pj , of the population. The appropriate individual, i, is selected and copied into the new population if Ci?1 < U(0; 1) Ci. Various methods exist to assign probabilities to individuals: roulette wheel, linear ranking and geometric ranking. Roulette wheel, developed by Holland Holland 1975], was the rst selection method. The probability, Pi, for each individual is de ned by: Fi (1) P Individual i is chosen ] = PPopSize ; Fj j =1 where Fi equals the tness of individual i. The use of roulette wheel selection limits

2.2 Selection Function 2.1 Solution Representation

4

C. Houck et al.

the genetic algorithm to maximization since the evaluation function must map the solutions to a fully ordered set of values on <+ . Extensions, such as windowing and scaling, have been proposed to allow for minimization and negativity. Ranking methods only require the evaluation function to map the solutions to a partially ordered set, thus allowing for minimization and negativity. Ranking methods assign Pi based on the rank of solution i when all solutions are sorted. Normalized geometric ranking, Joines and Houck 1994], de nes Pi for each individual by: where: P Selecting the ith individual ] = q0 (1 ? q)r?1 ; (2)

q = the probability of selecting the best individual; r = the rank of the individual, where 1 is the best: P = the population size q0 = 1?(1q?q)P Tournament selection, like ranking methods, only requires the evaluation function to map solutions to a partially ordered set, however, it does not assign probabilities. Tournament selection works by selecting j individuals randomly, with replacement, from the population, and inserts the best of the j into the new population. This procedure is repeated until N individuals have been selected. Genetic Operators provide the basic search mechanism of the GA. The operators are used to create new solutions based on existing solutions in the population. There are two basic types of operators: crossover and mutation. Crossover takes two individuals and produces two new individuals while mutation alters one individual to produce a single new solution. The application of these two basic types of operators and their derivatives depends on the chromosome representation used. Let X and Y be two m-dimensional row vectors denoting individuals (parents) from the population. For X and Y binary, the following operators are de ned: binary mutation and simple crossover. Binary mutation ips each bit in every individual in the population with probability pm according to equation 3. x0i = 1 ? xi ; if U(0; 1) < pm (3) xi ; otherwise Simple crossover generates a random number r from a uniform distribution from 1 to m and creates two new individuals (X 0 and Y 0 ) according to equations 4 and 5. xi ; if i < r (4) yi ; otherwise y if i < r yi0 = xii;; otherwise (5) Operators for real-valued representations, i.e., an alphabet of oats, were developed by Michalewicz Michalewicz 1994]. For real X and Y , the following opx0i =

2.3 Genetic Operators

A GA for function optimization

5

erators are de ned: uniform mutation, non-uniform mutation, multi-non-uniform mutation, boundary mutation, simple crossover, arithmetic crossover, and heuristic crossover. Let ai and bi be the lower and upper bound, respectively, for each variable i. Uniform mutation randomly selects one variable, j, and sets it equal to an uniform random number U(ai ; bi): (6) x0i = U(aii;;bi); if i = j x otherwise Boundary mutation randomly selects one variable, j, and sets it equal to either its lower or upper bound, where r = U(0; 1): 8 < ai ; if i = j; r < 0:5 x0i = : bi; if i = j; r 0:5 (7) xi; otherwise Non-uniform mutation randomly selects one variable, j, and sets it equal to an non-uniform random number: 8 < xi + (bi ? xi)f(G) if r1 < 0:5, (8) x0i = : xi ? (xi + ai)f(G) if r1 0:5, xi ; otherwise where G (9) f(G) = (r2 (1 ? Gmax ))b ; r1; r2 = a uniform random number between (0,1), G = the current generation, Gmax = the maximum number of generations, b = a shape parameter. The multi-non-uniform mutation operator applies the non-uniform operator to all of the variables in the parent X. Real-valued simple crossover is identical to the binary version presented above in equations 4 and 5. Arithmetic crossover produces two complimentary linear combinations of the parents, where r = U(0; 1): X 0 = rX + (1 ? r)Y (10) 0 = (1 ? r)X + rY Y (11) Heuristic crossover produces an linear extrapolation of the two individuals. This is the only operator that utilizes tness information. A new individual, X 0 , is created using equation 12, where r = U(0; 1) and X is better than Y in terms of tness. If X 0 is infeasible, i.e., feasibility equals 0 as given by equation 14, then generate a new random number r and create a new solution using equation 12, otherwise stop. To ensure halting, after t failures, let the children equal the parents and stop.

6

C. Houck et al.

X 0 = X + r(X ? Y ) Y0 = X

0 0 feasibility = 1; if xi ai ; xi bi 8i 0; otherwise

(12) (13) (14)

The GA must be provided an initial population as indicated in step 1 of Fig. 1. The most common method is to randomly generate solutions for the entire population. However, since GAs can iteratively improve existing solutions (i.e., solutions from other heuristics and/or current practices), the beginning population can be seeded with potentially good solutions, with the remainder of the population being randomly generated solutions. The GA moves from generation to generation selecting and reproducing parents until a termination criterion is met. The most frequently used stopping criterion is a speci ed maximumnumber of generations. Another termination strategy involves population convergence criteria. In general, GAs will force much of the entire population to converge to a single solution. When the sum of the deviations among individuals becomes smaller than some speci ed threshold, the algorithm can be terminated. The algorithm can also be terminated due to a lack of improvement in the best solution over a speci ed number of generations. Alternatively, a target value for the evaluation measure can be established based on some arbitrarily \acceptable" threshold. Several strategies can be used in conjunction with each other. Evaluation functions of many forms can be used in a GA, subject to the minimal requirement that the function can map the population into a partially ordered set. As stated, the evaluation function is independent of the GA (i.e., stochastic decision rules). The Matlab implementation of the algorithm has been tested with respect to e ciency and reliability by optimizing a family of multi-modal non-linear test problems. The family of test problems is taken from Corana, Corana et al. 1987], which compare the use of the simulated annealing algorithm to the simplex method of Nelder-Mead and adaptive random search. In Houck et al. 1995a] we report in detail the e ectiveness of the genetic algorithm for solving the continuous locationallocation problem, and in Houck et al. 1995b] on the use of the genetic algorithm in conjunction with local-improvement heuristics for non-linear function optimization, location-allocation, and the quadratic assignment problem. The Corana family Corana et al. 1987] of parameterized functions,qn, are very simple to compute and contain a large number of local minima. This function is basically a n-dimensional parabola with rectangular pockets removed and where the global minima occurs at the origin (0; 0; : : :; 0). This family is de ned as follows:

3. TESTING AND CONCLUSIONS

2.4 Initialization, Termination, and Evaluation Functions

A GA for function optimization

7

Df dk1;:::;kn Dm Dr qn(x) qn(x) zi =

fx 2 <n : ?a1 x1 a1 ; : : :; ?an xn an ; a 2 <n g + x 2 Df : k1s1 ? t1 <x1 <k1s1 + t1 ; : : :; knsn ? tn <xn <knsn + tn ; k1; : : :; kn 2 Z ; t; s 2 <n ; ti < s2i ; i = 1; : : :; n + dk1 ;:::;kn ? d0;0;:::;0

k1:::;kn 2Z Df ? Dm n X 2 di x i ; x 2 D r ; d 2 < n ; + i=1 n X 2 di zi ; x 2 dk1;:::;kn ; (k1; : : :; kn) 6= 0; i=1 8 < kisi + ti if ki < 0, 0 = 0, : kisi ? ti if kii > 0, if k

For the optimization of the test function two di erent representations were used. A real-valued alphabet was employed in conjunction with the selection, mutation and crossover operators with their respective options as shown in table I. Also, a binary representation was used in conjunction with the selection, mutation and crossover operators with their respective options as shown in table II. A description of the options for each of the functions is provided in the following section, Section 4.

Table I. GAOT Parameters used for Real-Valued Corana Function Optimization Name Parameters Uniform Mutation 4 Non-Uniform Mutation 4 max 3] Multi-Non-Uniform Mutation 6 max 3] Boundary Mutation 4 Simple Crossover 4 Arithmetic Crossover 4 Heuristic Crossover 2 3] Normalized Geometric Selection 0.08

G G

Table II. GAOT Parameters used for Binary Corana Function Optimization Name Parameters Binary Mutation 0.05 Simple Crossover 0.6 Normalized Geometric Selection 0.08

Two di erent evaluation functions were used for both the oat and binary genetic algorithm, the rst simply returned the value of the Corana function at the point

8

C. Houck et al.

as determined by the genetic string. The second evaluation function utilizes a Sequential Quadratic Programming (SQP) (available in Matlab) method to optimize the Corana function starting from the point as determined by the genetic string. This provides the genetic algorithm with a local improvement operator which, as shown in Houck et al. 1995b], can greatly enhance the performance of the genetic algorithm. Many researchers have shown that GAs perform well for a global search but perform very poorly in a localized search Davis 1991; Michalewicz 1994; Houck et al. 1995a; Bersini and Renders 1994]. GAs are capable of quickly nding promising regions of the search space but may take a relatively long time to reach the optimal solution. Both the oat genetic algorithm (FGA) and binary genetic algorithm (BGA) were run 10 times with di erent random seeds. The simulated annealing (SA) results are taken from the 10 replications of these test problems reported in Corana et al. 1987]. The resulting solution value found and the number of function evaluations to obtain that solution are shown in Table III. Since Corana et al. did not use an improvement procedure, both the FGA and BGA were run without the use of SQP. As shown in the table, the FGA outperformed both BGA and SA in terms of computational e ciency and solution quality. With respect to the epsilon of 1e?6 as used in Corana et al. 1987], FGA found the optimal in all three cases in all replications, while SA was unable to nd the optimal two times for the 4 dimensional case and not at all for the 10 dimensional case. The table also shows that the use of the local improvement operator signi cantly increases the power of the genetic algorithm in terms of solution quality and speed of convergence to the optimal.

Table III. Solution Quality and Procedure E ciency Std. # Dim. Method Avg Sol. Std. of Min. Sol. Avg. # of eval. Sol. of eval. FGA 5 75 ?7 2 87 ?7 2 09 ?7 6 90 +3 1 33 +3 FGA-SQP 0 00 +0 0 00 +0 0 00 +0 6 02 +2 1 89 +2 2 BGA 4 51 ?7 3 40 ?7 3 31 ?8 9 60 +3 3 56 +3 BGA-SQP 8 45 ?15 2 67 ?15 5 40 ?79 8 48 +2 2 61 +2 SA 1 13 ?8 1 42 ?8 4 21 ?10 6 89 +5 1 73 +4 FGA 6 80 ?7 3 35 ?7 1 58 ?7 1 06 +5 5 56 +4 FGA-SQP 0 00 +0 0 00 +0 0 00 +0 3 76 +3 1 27 +3 4 BGA 5 34 ?7 2 99 ?7 3 57 ?9 3 07 +5 7 25 +4 BGA-SQP 2 53 ?9 7 71 ?9 6 80 ?26 3 32 +4 1 78 +4 SA 6 18 ?4 1 40 ?3 8 70 ?8 1 38 +6 1 11 +5 FGA 6 15 ?7 4 01 ?7 1 68 ?8 2 31 +5 3 06 +4 FGA-SQP 0 00 +0 0 00 +0 0 00 +0 5 38 +4 3 29 +4 10 BGA 1 74 +2 1 85 +2 2 29 +1 1 47 +6 6 96 +4 BGA-SQP 5 74 +2 1 09 +3 4 23 +0 8 26 +2 1 63 +2 SA 5 40 ?4 0 00 +0 5 40 ?4 1 62 +6 3 65 +4

: : : e e e : e : : : e e e : : : : : : : : : : : : : : : e e e e e e e e e e e e e e e : : : : : : : : : : : : : : : e e e e e e e e e e e e e e e : e : e : e : e : : e e : : : : : : : : : : : e e e e e e e e e e e : : e e : : : e e e : e : : : : e e e e : e : : : : : : e e e e e e : : : : e e e e

Min # of eval. 5 87 +3 3 95 +2 4 56 +3 6 03 + 2 6 56 +5 4 81 +4 1 66 +3 1 93 +5 1 32 +4 1 18 +6 1 77 +5 3 80 +4 1 34 +6 5 27 +2 1 55 +6

: : : e e e : : : : : : : : : : : : e e e e e e e e e e e

The results of this testing show that the use of genetic algorithms for function optimization is highly e cient and e ective. The use of a local improvement

A GA for function optimization

9

procedure, in this case SQP, can greatly enhance the performance of the genetic algorithm. Matlab is a technical computing environment for high-performance numeric computation. Matlab integrates numerical analysis, matrix computation and graphics in an easy-to-use environment. User-de ned Matlab functions are simple text les of interpreted instructions. Therefore, Matlab functions are completely portable from one hardware architecture to another without even a recompilation step. The algorithm discussed in Section 2 has been implemented as a Matlab toolbox, i.e., a group of related functions, named GAOT, Genetic Algorithms for Optimization Toolbox. Each module of the algorithm is implemented using a Matlab function. This provides for easy extensibility, as well as modularity. The basic function is the ga function, which runs the simulated evolution. The basic call to the ga function is given by the following Matlab command.

x,endPop,bPop,traceInfo] = ga(bounds,evalFN,evalParams,params,startPop,... termFN,termParams,selectFN,selectParams,xOverFNs,xOverParams,mutFNs,mutParams)

4. GAOT: A MATLAB IMPLEMENTATION

Output parameters |x is the best solution string, i.e. nal solution, |endPop(optional) is the nal population, |bPop(optional) is a matrix of the best individuals and the corresponding generation they were found, |traceInfo(optional) is a matrix of maximum and mean functional value of the population for each generation. Input parameters |bounds is a matrix of upper and lower bounds on the variables, |evalFN is the evaluation function, usually a .m le, |evalParams(optional) is a row matrix of any parameters to the evaluation function defaults to NULL], |params(optional) is a vector of options, i.e. epsilon prob param disp param] where epsilon is the change required to consider two solutions di erent and prob params is 0 if you want to use the binary version of the algorithm, or 1 for the oat version. disp param controls the display of the progress of the algorithm, 1 displays the current generation and the the value of the best solution in the population, while 0 prevents any output during the run. This parameter defaults to 1e?6 1 0]. |startPop(optional) is a matrix of solutions and their respective functional values. The starting population defaults to a randomly created population created with initialize, |termFN(optional) is the name of the termination function which defaults to 'maxGenTerm'], |termParams(optional) is a row matrix of parameters which defaults to 100],

10

C. Houck et al.

|selectFN(optional) is the name of the selection function which defaults to 'normGeomSelect'], |selectParams(optional) is a row matrix of parameters for the selection function which defaults to 0.08], |xOverFNs(optional) is a blank separated string of the names of the cross-over functions which defaults to 'arithXover heuristicXover simpleXover'] for the oat version and 'simpleXover] for the binary version. |xOverParams(optional) is a matrix of the crossover parameters which default to 2 0;2 3;2 0] for the oat version and 0.6] for the binary |mutFNs(optional) is a blank separated string of mutation operators which default to 'boundaryMutation multiNonUnifMutation nonUnifMutation unifMutation'] for the oat version and 'binaryMutation'] for the binary version. |mutParams(optional) is a matrix of mutation parameters which defaults to 4 0;6 100 3;4 100 3;4 0] for the oat version and 0.05] for the binary. GA performs the simulated evolution using the evalFN to determine the tness of the solution strings. The GA uses the operators xOverFNs and mutFNs to alter the solution strings during the search. The program has been run successfully on a DecStation 3100, a DecStation 5000/25, Motorolla 604 and an HP 715. The system maintains a high degree of modularity and exibility as a result of the decision to pass the selection, evaluation, termination functions to the GA as well as a list of genetic operators. Thus, the base genetic algorithm is able to perform evolution using any combination of selection, crossover, mutation, evaluation and termination functions that conform to the functional speci cations as outlined below or can easily be used with the default parameters. The evaluation function is the driving force behind the GA. The evaluation function is called from the GA to determine the tness of each solution string generated during the search. An example evaluation function is given below:

function val,x] = gaDemo1Eval(x,parameters) val = x(1) + 10*sin(5*x(1))+7*cos(4*x(2));

4.1 Evaluation Function

To run the ga using this test function use either of the following function calls from Matlab.

bstX = ga( 0 10; 0 -10],'gaDemo1Eval') bstX = ga( 0 10; 0 -10],'x(1) + 10*sin(5*x(1))+7*cos(4*x(2))');

where gaDemo1Eval.m is contains the evaluation function as given above. Usually, a .m le will be more convenient to use as the evaluation function will be more complex than the simple example provided. This function call will use all of the default parameters of the ga and return only the best solution found during the course of the simulated evolution. Note that the evaluation function must take two parameters, x and options. x is a row vector of n + 1 elements where the rst n elements are the parameters of interest. The n + 1'th element is the value of this solution. The parameters matrix is a row matrix of

A GA for function optimization

current_generation, evalParams]

11

The evaluation function must return both the value of the string, val and the string itself, x. This is done so that an evaluation can repair or improve the string if desired. This allows for the use of local improvement procedures as discussed in Section 3. An evaluation function is unique to the optimization of the problem at hand therefore, every time the ga is used for a di erent problem, an evaluation function must be developed to determine the tness of the individuals. The remainder of this section describes the other modules of the genetic toolbox. While GAOT allows for easy modi cation of any of these modules, the defaults as given work well for a wide class of optimization problems as shown in Houck et al. 1995b]. Operators provide the search mechanism of the GA. The operators are used to create new solutions based on existing solutions in the population. There are two basic types of operators, crossover and mutation. Crossover takes two individuals and produces two new individuals while mutation alters one individual to produce a single new solution. The ga function calls each of the operators to produce new solutions. The function call for crossovers is as follows:

c1,c2] = crossover(p1,p2,bounds,params)

4.2 Operator Functions

where p1 is the rst parent, solution string function value], p2 is the second parent, bounds is the bounds matrix for the solution space and params is the vector of current generation, operatorParams], where operatorParams is the appropriate row of parameters for this crossover/mutation operator. The rst value of the operatorParams is frequency of application of this operator. For the oat ga, this is the discrete number of times to call this operator every generation, while for the binary ga it is the probability of application to each member of the population. The mutation function call is similar, but only takes one parent and returns one child:

c1] = mutation(p1,bounds,params)

The crossover operator must take all four arguments, the two parents, the bounds of the search space, the information on how much of the evolution has taken place and any other special options required. Similarly, mutations must all take the three arguments and return the resulting child. Table IV shows the operators implemented in Matlab, their corresponding le names, and any options that the operator takes in addition to the rst option, the number of applications per generation. The selection function determines which of the individuals will survive and continue on to the next generation. The ga function calls the selection function each generation after all the new children have been evaluated to create the new population from the old one. The basic function call used in ga for selection is:

4.3 Selection Function

12

C. Houck et al. Table IV. Matlab Implemented Operator Functions

Name Arithmetic Crossover Heuristic Crossover Simple Crossover Boundary Mutation Multi-Non-Uniform Mutation Non-Uniform Mutation Uniform Mutation

File arithXover.m heuristicXover.m simpleXover.m boundary.m multiNonUnifMut.m nonUnifMut.m unifMut.m

Options none number of retries (t) none none max num of generations, shape parameter (b) max num of generations, shape parameter (b) none

newPop] = selectFunction(oldPop,options)

where newPop is the new population selected, oldPop is the current population, and options is a vector for any other optional parameters. Notice that all selection routines must take both parameters, the old population from which to select members from, and any speci c options to that particular selection routine. The function must return the new population. Table V shows the selection routines that have been implemented in GAOT. The le names are provided, as they are the function names to be used in Matlab, and the options for each function is also provided.

Table V. Name Roulette Wheel Normalized Geometric Select Tournament Matlab Implemented Selection Functions File Options roulette.m None normGeomSelect.m Probability of Selecting Best tourn.m Number of individuals in each tournament

Initialization of a population to provide the ga a starting point is usually done by generating random strings within the search space, and this is the default behavior of the ga function. However, it is possible to 'seed' the initial population with individuals, or generate solutions in some other form. The ga allows for this with the optional startPop parameter which provides the ga with an explicit starting population. The termination function determines when to stop the simulated evolution and return the resulting population. The ga function calls the termination function once every generation after the application of all of the operator functions and the evaluation function for the resulting children. The function call is of the format:

done = terminateFunction(options,bestPop,pop)

4.4 Initialization and Termination Functions

where options is a vector of termination options the rst of which is always the current generation. bestPop is a matrix of the best individuals and the respective generation it was found. pop is the current population. Table VI shows the termination routines that have been implemented in GAOT. The le names are provided

A GA for function optimization

13

as they are the function names to be used in Matlab, and the options for each function is also provided.

Table VI. Matlab Implemented Termination Functions Name File Options Terminate at Speci ed Generation maxGenTerm.m nal generation Terminate at Optimal or max gen maxGenOptTerm.m nal generation, optimal value, epsilon

Several Matlab demos are provided as a tutorial to the genetic algorithm toolbox. The rst demo, gademo1, gives a brief introduction to GAs using a simple one variable function. The second demo, gademo2, uses a more complicated example, the 4-dimensional Corana function, to further illustrate the use of the toolbox. The nal demo, gademo3, is a reference to the format used for the operator, selection, evaluation, and termination functions.

5. SUMMARY

4.5 Online Tutorial

A genetic algorithm capable of either using a oating point representation or a binary representation has been implemented as a Matlab toolbox. This toolbox provides a modular, extensible, portable algorithm in an environment rich in mathematical capabilities. The toolbox has been tested on a series of non-linear, nonconvex, multi-modal functions. The results of these tests show that the algorithm is capable of nding better solutions with less function evaluations than simulated annealing.

REFERENCES

Bersini, H. and Renders, B. 1994. Hybridizing genetic algorithms with hill-climbing meth-

ods for global optimization: Two possible ways. In 1994 IEEE International Symposium Evolutionary Computation, Orlando, Fl, pp. 312{317. Corana, A., Marchesi, M., Martini, C., and Ridella, S. 1987. Minimizing multimodal functions of continuous variables with the \simulated annealing" algorithm. ACM Transactions on Mathematical Software 13, 3, 262{280. Davis, L. 1991. The Handbook of Genetic Algorithms. Van Nostrand Reingold, New York. Goldberg, D. 1989. Genetic Algorithms in Search, Optimization, and Machine Learning. Addison-Wesley. Holland, J. 1975. Adaptation in natural and arti cial systems. The University of Michigan Press, Ann Arbor. Houck, C., Joines, J., and Kay, M. 1995a. A comparison of genetic algorithms, random restart, and two-opt switching for solving large location-allocation problems. Computers & Operations Research forthcoming in special issue on evolution computation. Houck, C., Joines, J., and Kay, M. 1995b. The e ective use of local improvement procedures in conjunction with genetic algorithms. Technical Report NCSU-IE Technical Report 95, North Carolina State University. Joines, J. and Houck, C. 1994. On the use of non-stationary penalty functions to solve constrained optimization problems with genetic algorithms. In 1994 IEEE International Symposium Evolutionary Computation, Orlando, Fl, pp. 579{584.

14

C. Houck et al.

Michalewicz, Z. 1994. Genetic Algorithms + Data Structures = Evolution Programs. AI

Series. Springer-Verlag, New York.

更多相關標簽:

- PLC Implementation of a Genetic Algorithm for Controller Optimization
- Towards a Genetic Algorithm for Function Optimization
- A Parallel Genetic Algorithm for Floorplan Area Optimization
- Adaptive elitist-population based genetic algorithm for multimodal function optimization
- Code Book Optimization with a Genetic Algorithm for Vector
- A Niched Pareto Genetic Algorithm for Multiobjective Optimization
- A Genetic Algorithm for Multiobjective Design Optimization in Aerodynamics and
- The+Implementation+and+Comparison+of+Two+Kinds+of+Parallel+Genetic+Algorithm+Using+Matlab
- A micro-genetic algorithm for multiobjective optimization
- Application of genetic algorithm for ship hull form optimization