| Genetic Algorithm and Direct Search Toolbox™ | ![]() |
| On this page… |
|---|
Optimization Tool vs. Command Line |
There are two ways to specify options for the genetic algorithm, depending on whether you are using the Optimization Tool or calling the functions ga or at the command line:
If you are using the Optimization Tool (optimtool), select an option from a drop-down list or enter the value of the option in a text field.
If you are calling ga or gamultiobj from the command line, create an options structure using the function gaoptimset, as follows:
options = gaoptimset('Param1', value1, 'Param2', value2, ...);
See Setting Options for ga at the Command Line for examples.
In this section, each option is listed in two ways:
By its label, as it appears in the Optimization Tool
By its field name in the options structure
For example:
Population type is the label of the option in the Optimization Tool.
PopulationType is the corresponding field of the options structure.
Plot options enable you to plot data from the genetic algorithm while it is running. When you select plot functions and run the genetic algorithm, a plot window displays the plots on separate axes. Click on any subplot to view a larger version of the plot in a separate figure window. You can stop the algorithm at any time by clicking the Stop button on the plot window.
Plot interval (PlotInterval) specifies the number of generations between consecutive calls to the plot function.
You can select any of the following plot functions in the Plot functions pane:
Best fitness (@gaplotbestf) plots the best function value versus generation.
Expectation (@gaplotexpectation) plots the expected number of children versus the raw scores at each generation.
Score diversity (@gaplotscorediversity) plots a histogram of the scores at each generation.
Stopping (@plotstopping) plots stopping criteria levels.
Best individual (@gaplotbestindiv) plots the vector entries of the individual with the best fitness function value in each generation.
Genealogy (@gaplotgenealogy) plots the genealogy of individuals. Lines from one generation to the next are color-coded as follows:
Red lines indicate mutation children.
Blue lines indicate crossover children.
Black lines indicate elite individuals.
Scores (@gaplotscores) plots the scores of the individuals at each generation.
Max constraint (@gaplotmaxconstr) plots the maximum nonlinear constraint violation at each generation.
Distance (@gaplotdistance) plots the average distance between individuals at each generation.
Range (@gaplotrange) plots the minimum, maximum, and mean fitness function values in each generation.
Selection (@gaplotselection) plots a histogram of the parents.
Custom function enables you to use plot functions of your own. To specify the plot function if you are using the Optimization Tool,
Select Custom function.
Enter @myfun in the text box, where myfun is the name of your function.
To display a plot when calling ga from the command line, set the PlotFcns field of options to be a function handle to the plot function. For example, to display the best fitness plot, set options as follows
options = gaoptimset('PlotFcns', @gaplotbestf);
To display multiple plots, use the syntax
options =gaoptimset('PlotFcns', {@plotfun1, @plotfun2, ...});
where @plotfun1, @plotfun2, and so on are function handles to the plot functions.
The first line of a plot function has the form
function state = plotfun(options, state, flag)
The input arguments to the function are
options — Structure containing all the current options settings.
state — Structure containing information about the current generation. The State Structure describes the fields of state.
flag — String that tells what stage the algorithm is currently in.
Passing Extra Parameters in the Optimization Toolbox™ User's Guide explains how to provide additional parameters to the function.
The state structure, which is an input argument to plot, mutation, and output functions, contains the following fields:
Population — Population in the current generation
Score — Scores of the current population
Generation — Current generation number
StartTime — Time when genetic algorithm started
StopFlag — String containing the reason for stopping
Selection — Indices of individuals selected for elite, crossover and mutation
Expectation — Expectation for selection of individuals
Best — Vector containing the best score in each generation
LastImprovement — Generation at which the last improvement in fitness value occurred
LastImprovementTime — Time at which last improvement occurred
NonlinIneq — Nonlinear inequality constraints, displayed only when a nonlinear constraint function is specified
NonlinEq — Nonlinear equality constraints, displayed only when a nonlinear constraint function is specified
Population options enable you to specify the parameters of the population that the genetic algorithm uses.
Population type (PopulationType) specifies the data type of the input to the fitness function. You can set Population type to be one of the following:
Double Vector ('doubleVector') — Use this option if the individuals in the population have type double. This is the default.
Bit string ('bitstring') — Use this option if the individuals in the population are bit strings.
Custom ('custom') — Use this option to create a population whose data type is neither of the preceding.
If you use a custom population type, you must write your own creation, mutation, and crossover functions that accept inputs of that population type, and specify these functions in the following fields, respectively:
Creation function (CreationFcn)
Mutation function (MutationFcn)
Crossover function (CrossoverFcn)
Population size (PopulationSize) specifies how many individuals there are in each generation. With a large population size, the genetic algorithm searches the solution space more thoroughly, thereby reducing the chance that the algorithm will return a local minimum that is not a global minimum. However, a large population size also causes the algorithm to run more slowly.
If you set Population size to a vector, the genetic algorithm creates multiple subpopulations, the number of which is the length of the vector. The size of each subpopulation is the corresponding entry of the vector.
Creation function (CreationFcn) specifies the function that creates the initial population for ga. You can choose from the following functions:
Uniform (@gacreationuniform) creates a random initial population with a uniform distribution. This is the default if there are no constraints or bound constraints.
Feasible population (@gacreationlinearfeasible) creates a random initial population that satisfies all bounds and linear constraints. It is biased to create individuals that are on the boundaries of the constraints, and to create well-dispersed populations. This is the default if there are linear constraints.
Custom enables you to write your own creation function, which must generate data of the type that you specify in Population type. To specify the creation function if you are using the Optimization Tool,
Set Creation function to Custom.
Set Function name to @myfun, where myfun is the name of your function.
If you are using ga, set
options = gaoptimset('CreationFcn', @myfun);
Your creation function must have the following calling syntax.
function Population = myfun(GenomeLength, FitnessFcn, options)
The input arguments to the function are
Genomelength — Number of independent variables for the fitness function
FitnessFcn — Fitness function
options — Options structure
The function returns Population, the initial population for the genetic algorithm.
Passing Extra Parameters in the Optimization Toolbox User's Guide explains how to provide additional parameters to the function.
Initial population (InitialPopulation) specifies an initial population for the genetic algorithm. The default value is [], in which case ga uses the default Creation function to create an initial population. If you enter a nonempty array in the Initial population field, the array must have no more than Population size rows, and exactly Number of variables columns. In this case, the genetic algorithm calls a Creation function to generate the remaining individuals, if required.
Initial scores (InitialScores) specifies initial scores for the initial population. The initial scores can also be partial.
Initial range (PopInitRange) specifies the range of the vectors in the initial population that is generated by a creation function. You can set Initial range to be a matrix with two rows and Number of variables columns, each column of which has the form [lb; ub], where lb is the lower bound and ub is the upper bound for the entries in that coordinate. If you specify Initial range to be a 2-by-1 vector, each entry is expanded to a constant row of length Number of variables.
See Example — Setting the Initial Range for an example.
Fitness scaling converts the raw fitness scores that are returned by the fitness function to values in a range that is suitable for the selection function. You can specify options for fitness scaling in the Fitness scaling pane.
Scaling function (FitnessScalingFcn) specifies the function that performs the scaling. The options are
Rank (@fitscalingrank) — The default fitness scaling function, Rank, scales the raw scores based on the rank of each individual instead of its score. The rank of an individual is its position in the sorted scores. The rank of the most fit individual is 1, the next most fit is 2, and so on. Rank fitness scaling removes the effect of the spread of the raw scores.
Proportional (@fitscalingprop) — Proportional scaling makes the scaled value of an individual proportional to its raw fitness score.
Top (@fitscalingtop) — Top scaling scales the top individuals equally. Selecting Top displays an additional field, Quantity, which specifies the number of individuals that are assigned positive scaled values. Quantity can be an integer between 1 and the population size or a fraction between 0 and 1 specifying a fraction of the population size. The default value is 0.4. Each of the individuals that produce offspring is assigned an equal scaled value, while the rest are assigned the value 0. The scaled values have the form [0 1/n 1/n 0 0 1/n 0 0 1/n ...].
To change the default value for Quantity at the command line, use the following syntax
options = gaoptimset('FitnessScalingFcn', {@fitscalingtop,
quantity})
where quantity is the value of Quantity.
Shift linear (@fitscalingshiftlinear) — Shift linear scaling scales the raw scores so that the expectation of the fittest individual is equal to a constant multiplied by the average score. You specify the constant in the Max survival rate field, which is displayed when you select Shift linear. The default value is 2.
To change the default value of Max survival rate at the command line, use the following syntax
options = gaoptimset('FitnessScalingFcn',
{@fitscalingshiftlinear, rate})
where rate is the value of Max survival rate.
Custom enables you to write your own scaling function. To specify the scaling function using the Optimization Tool,
Set Scaling function to Custom.
Set Function name to @myfun, where myfun is the name of your function.
If you are using ga at the command line, set
options = gaoptimset('FitnessScalingFcn', @myfun);
Your scaling function must have the following calling syntax:
function expection = myfun(scores, nParents)
The input arguments to the function are
scores — A vector of scalars, one for each member of the population
nParents — The number of parents needed from this population
The function returns expectation, a row vector of scalars of the same length as scores, giving the scaled values of each member of the population. The sum of the entries of expectation must equal nParents.
Passing Extra Parameters in the Optimization Toolbox User's Guide explains how to provide additional parameters to the function.
See Fitness Scaling for more information.
Selection options specify how the genetic algorithm chooses parents for the next generation. You can specify the function the algorithm uses in the Selection function (SelectionFcn) field in the Selection options pane. The options are
Stochastic uniform (@selectionstochunif) — The default selection function, Stochastic uniform, lays out a line in which each parent corresponds to a section of the line of length proportional to its scaled value. The algorithm moves along the line in steps of equal size. At each step, the algorithm allocates a parent from the section it lands on. The first step is a uniform random number less than the step size.
Remainder (@selectionremainder) — Remainder selection assigns parents deterministically from the integer part of each individual's scaled value and then uses roulette selection on the remaining fractional part. For example, if the scaled value of an individual is 2.3, that individual is listed twice as a parent because the integer part is 2. After parents have been assigned according to the integer parts of the scaled values, the rest of the parents are chosen stochastically. The probability that a parent is chosen in this step is proportional to the fractional part of its scaled value.
Uniform (@selectionuniform) — Uniform selection chooses parents using the expectations and number of parents. Uniform selection is useful for debugging and testing, but is not a very effective search strategy.
Roulette (@selectionroulette) — Roulette selection chooses parents by simulating a roulette wheel, in which the area of the section of the wheel corresponding to an individual is proportional to the individual's expectation. The algorithm uses a random number to select one of the sections with a probability equal to its area.
Tournament (@selectiontournament) — Tournament selection chooses each parent by choosing Tournament size players at random and then choosing the best individual out of that set to be a parent. Tournament size must be at least 2. The default value of Tournament size is 4.
To change the default value of Tournament size at the command line, use the syntax
options = gaoptimset('SelectionFcn',...
{@selecttournament,size})
where size is the value of Tournament size.
Custom enables you to write your own selection function. To specify the selection function using the Optimization Tool,
Set Selection function to Custom.
Set Function name to @myfun, where myfun is the name of your function.
If you are using ga at the command line, set
options = gaoptimset('SelectionFcn', @myfun);
Your selection function must have the following calling syntax:
function parents = myfun(expectation, nParents, options)
The input arguments to the function are
expectation — Expected number of children for each member of the population
nParents — Number of parents to select
options — Genetic algorithm options structure
The function returns parents, a row vector of length nParents containing the indices of the parents that you select.
Passing Extra Parameters in the Optimization Toolbox User's Guide explains how to provide additional parameters to the function.
See Selection for more information.
Reproduction options specify how the genetic algorithm creates children for the next generation.
Elite count (EliteCount) specifies the number of individuals that are guaranteed to survive to the next generation. Set Elite count to be a positive integer less than or equal to the population size. The default value is 2.
Crossover fraction (CrossoverFraction) specifies the fraction of the next generation, other than elite children, that are produced by crossover. Set Crossover fraction to be a fraction between 0 and 1, either by entering the fraction in the text box or moving the slider. The default value is 0.8.
See Setting the Crossover Fraction for an example.
Mutation options specify how the genetic algorithm makes small random changes in the individuals in the population to create mutation children. Mutation provides genetic diversity and enable the genetic algorithm to search a broader space. You can specify the mutation function in the Mutation function (MutationFcn) field in the Mutation options pane. You can choose from the following functions:
Gaussian (mutationgaussian) — The default mutation function, Gaussian, adds a random number taken from a Gaussian distribution with mean 0 to each entry of the parent vector. The standard deviation of this distribution is determined by the parameters Scale and Shrink, which are displayed when you select Gaussian, and by the Initial range setting in the Population options.
The Scale parameter determines the standard deviation at the first generation. If you set Initial range to be a 2-by-1 vector v, the initial standard deviation is the same at all coordinates of the parent vector, and is given by Scale*(v(2) - v(1)).
If you set Initial range to be a vector v with two rows and Number of variables columns, the initial standard deviation at coordinate i of the parent vector is given by Scale*(v(i,2) - v(i,1)).
The Shrink parameter controls how the standard deviation shrinks as generations go by. If you set Initial range to be a 2-by-1 vector, the standard deviation at the kth generation, σk, is the same at all coordinates of the parent vector, and is given by the recursive formula
![]()
If you set Initial range to be a vector with two rows and Number of variables columns, the standard deviation at coordinate i of the parent vector at the kth generation, σi,k, is given by the recursive formula
![]()
If you set Shrink to 1, the algorithm shrinks the standard deviation in each coordinate linearly until it reaches 0 at the last generation is reached. A negative value of Shrink causes the standard deviation to grow.
The default value of both Scale and Shrink is 1. To change the default values at the command line, use the syntax
options = gaoptimset('MutationFcn', ...
{@mutationgaussian, scale, shrink})
where scale and shrink are the values of Scale and Shrink, respectively.
Uniform (mutationuniform) — Uniform mutation is a two-step process. First, the algorithm selects a fraction of the vector entries of an individual for mutation, where each entry has a probability Rate of being mutated. The default value of Rate is 0.01. In the second step, the algorithm replaces each selected entry by a random number selected uniformly from the range for that entry.
To change the default value of Rate at the command line, use the syntax
options = gaoptimset('MutationFcn', {@mutationuniform, rate})
where rate is the value of Rate.
Adaptive Feasible (mutationadaptfeasible) randomly generates directions that are adaptive with respect to the last successful or unsuccessful generation. The feasible region is bounded by the constraints and inequality constraints. A step length is chosen along each direction so that linear constraints and bounds are satisfied.
Custom enables you to write your own mutation function. To specify the mutation function using the Optimization Tool,
Set Mutation function to Custom.
Set Function name to @myfun, where myfun is the name of your function.
If you are using ga, set
options = gaoptimset('MutationFcn', @myfun);
Your mutation function must have this calling syntax:
function mutationChildren = myfun(parents, options, nvars, FitnessFcn, state, thisScore, thisPopulation)
The arguments to the function are
parents — Row vector of parents chosen by the selection function
options — Options structure
nvars — Number of variables
FitnessFcn — Fitness function
state — Structure containing information about the current generation. The State Structure describes the fields of state.
thisScore — Vector of scores of the current population
thisPopulation — Matrix of individuals in the current population
The function returns mutationChildren—the mutated offspring—as a matrix whose rows correspond to the children. The number of columns of the matrix is Number of variables.
Passing Extra Parameters in the Optimization Toolbox User's Guide explains how to provide additional parameters to the function.
Crossover options specify how the genetic algorithm combines two individuals, or parents, to form a crossover child for the next generation.
Crossover function (CrossoverFcn) specifies the function that performs the crossover. You can choose from the following functions:
Scattered (@crossoverscattered), the default crossover function, creates a random binary vector and selects the genes where the vector is a 1 from the first parent, and the genes where the vector is a 0 from the second parent, and combines the genes to form the child. For example, if p1 and p2 are the parents
p1 = [a b c d e f g h] p2 = [1 2 3 4 5 6 7 8]
and the binary vector is [1 1 0 0 1 0 0 0], the function returns the following child:
child1 = [a b 3 4 e 6 7 8]
Single point (@crossoversinglepoint) chooses a random integer n between 1 and Number of variables and then
Selects vector entries numbered less than or equal to n from the first parent.
Selects vector entries numbered greater than n from the second parent.
Concatenates these entries to form a child vector.
For example, if p1 and p2 are the parents
p1 = [a b c d e f g h] p2 = [1 2 3 4 5 6 7 8]
and the crossover point is 3, the function returns the following child.
child = [a b c 4 5 6 7 8]
Two point (@crossovertwopoint) selects two random integers m and n between 1 and Number of variables. The function selects
Vector entries numbered less than or equal to m from the first parent
Vector entries numbered from m+1 to n, inclusive, from the second parent
Vector entries numbered greater than n from the first parent.
The algorithm then concatenates these genes to form a single gene. For example, if p1 and p2 are the parents
p1 = [a b c d e f g h] p2 = [1 2 3 4 5 6 7 8]
and the crossover points are 3 and 6, the function returns the following child.
child = [a b c 4 5 6 g h]
Intermediate (@crossoverintermediate) creates children by taking a weighted average of the parents. You can specify the weights by a single parameter, Ratio, which can be a scalar or a row vector of length Number of variables. The default is a vector of all 1's. The function creates the child from parent1 and parent2 using the following formula.
child = parent1 + rand * Ratio * ( parent2 - parent1)
If all the entries of Ratio lie in the range [0, 1], the children produced are within the hypercube defined by placing the parents at opposite vertices. If Ratio is not in that range, the children might lie outside the hypercube. If Ratio is a scalar, then all the children lie on the line between the parents.
To change the default value of Ratio at the command line, use the syntax
options = gaoptimset('CrossoverFcn', ...
{@crossoverintermediate, ratio});
where ratio is the value of Ratio.
Heuristic (@crossoverheuristic) returns a child that lies on the line containing the two parents, a small distance away from the parent with the better fitness value in the direction away from the parent with the worse fitness value. You can specify how far the child is from the better parent by the parameter Ratio, which appears when you select Heuristic. The default value of Ratio is 1.2. If parent1 and parent2 are the parents, and parent1 has the better fitness value, the function returns the child
child = parent2 + R * (parent1 - parent2);
To change the default value of Ratio at the command line, use the syntax
options=gaoptimset('CrossoverFcn',...
{@crossoverheuristic,ratio});
where ratio is the value of Ratio.
Arithmetic (@crossoverarithmetic) creates children that are the weighted arithmetic mean of two parents. Children are always feasible with respect to linear constraints and bounds.
Custom enables you to write your own crossover function. To specify the crossover function using the Optimization Tool,
Set Crossover function to Custom.
Set Function name to @myfun, where myfun is the name of your function.
If you are using ga, set
options = gaoptimset('CrossoverFcn',@myfun);
Your selection function must have the following calling syntax.
xoverKids = myfun(parents, options, nvars, FitnessFcn, unused,thisPopulation)
The arguments to the function are
parents — Row vector of parents chosen by the selection function
options — options structure
nvars — Number of variables
FitnessFcn — Fitness function
unused — Placeholder not used
thisPopulation — Matrix representing the current population. The number of rows of the matrix is Population size and the number of columns is Number of variables.
The function returns xoverKids—the crossover offspring—as a matrix whose rows correspond to the children. The number of columns of the matrix is Number of variables.
Passing Extra Parameters in the Optimization Toolbox User's Guide explains how to provide additional parameters to the function.
Migration options specify how individuals move between subpopulations. Migration occurs if you set Population size to be a vector of length greater than 1. When migration occurs, the best individuals from one subpopulation replace the worst individuals in another subpopulation. Individuals that migrate from one subpopulation to another are copied. They are not removed from the source subpopulation.
You can control how migration occurs by the following three fields in the Migration options pane:
Direction (MigrationDirection) — Migration can take place in one or both directions.
If you set Direction to Forward ('forward'), migration takes place toward the last subpopulation. That is, the nth subpopulation migrates into the (n+1)th subpopulation.
If you set Direction to Both ('both'), the nth subpopulation migrates into both the (n–1)th and the (n+1)th subpopulation.
Migration wraps at the ends of the subpopulations. That is, the last subpopulation migrates into the first, and the first may migrate into the last.
Interval (MigrationInterval) — Specifies how many generation pass between migrations. For example, if you set Interval to 20, migration takes place every 20 generations.
Fraction (MigrationFraction) — Specifies how many individuals move between subpopulations. Fraction specifies the fraction of the smaller of the two subpopulations that moves. For example, if individuals migrate from a subpopulation of 50 individuals into a subpopulation of 100 individuals and you set Fraction to 0.1, the number of individuals that migrate is 0.1 * 50 = 5.
Algorithm settings define algorithmic specific parameters.
Parameters that can be specified for a nonlinear constraint algorithm include
Initial penalty (InitialPenalty) — Specifies an initial value of the penalty parameter that is used by the algorithm. Initial penalty must be greater than or equal to 1.
Penalty factor (PenaltyFactor) — Increases the penalty parameter when the problem is not solved to required accuracy and constraints are not satisfied. Penalty factor must be greater than 1.
Multiobjective options define parameters characteristic of the multiobjective genetic algorithm. You can specify the following parameters:
DistanceMeasureFcn — Defines a handle to the function that computes distance measure of individuals, computed in decision variable or design space (genotype) or in function space (phenotype). For example, the default distance measure function is distancecrowding in function space, or {@distancecrowding,'phenotype'}.
ParetoFraction — Sets the fraction of individuals to keep on the first Pareto front while the solver selects individuals from higher fronts. This option is a scalar between 0 and 1.
A hybrid function is another minimization function that runs after the genetic algorithm terminates. You can specify a hybrid function in Hybrid function (HybridFcn) options. The choices are
[] — No hybrid function.
fminsearch (@fminsearch) — Uses the MATLAB® function fminsearch to perform unconstrained minimization.
patternsearch (@patternsearch) — Uses a pattern search to perform constrained or unconstrained minimization.
fminunc (@fminunc) — Uses the Optimization Toolbox function fminunc to perform unconstrained minimization.
fmincon (@fmincon) — Uses the Optimization Toolbox function fmincon to perform constrained minimization.
You can set a separate options structure for the hybrid function. Use psoptimset or optimset to create the structure, depending on whether the hybrid function is patternsearch or not:
hybridopts = optimset('display','iter','LargeScale','off');Include the hybrid options in the Genetic Algorithm options structure as follows:
options = gaoptimset(options,'HybridFcn',{@fminunc,hybridopts}); hybridopts must exist before you set options.
See Using a Hybrid Function for an example.
Stopping criteria determine what causes the algorithm to terminate. You can specify the following options:
Generations (Generations) — Specifies the maximum number of iterations for the genetic algorithm to perform. The default is 100.
Time limit (TimeLimit) — Specifies the maximum time in seconds the genetic algorithm runs before stopping.
Fitness limit (FitnessLimit) — The algorithm stops if the best fitness value is less than or equal to the value of Fitness limit.
Stall generations (StallGenLimit) — The algorithm stops if the weighted average change in the fitness function value over Stall generations is less than Function tolerance.
Stall time limit (StallTimeLimit) — The algorithm stops if there is no improvement in the best fitness value for an interval of time in seconds specified by Stall time.
Function tolerance (TolFun) — The algorithm runs until the cumulative change in the fitness function value over Stall generations is less than or equal to Function Tolerance.
Nonlinear constraint tolerance (TolCon) — The Nonlinear constraint tolerance is not used as stopping criterion. It is used to determine the feasibility with respect to nonlinear constraints.
See Setting the Maximum Number of Generations for an example.
Output functions are functions that the genetic algorithm calls at each generation. The following options are available:
History to new window (@gaoutputgen) displays the history of points computed by the algorithm in a new window at each multiple of Interval iterations.
Custom enables you to write your own output function. To specify the output function using the Optimization Tool,
Select Custom function.
Enter @myfun in the text box, where myfun is the name of your function.
If you are using ga, set
options = gaoptimset('OutputFcn',@myfun);
To see a template that you can use to write your own output functions, enter
edit gaoutputfcntemplate
at the MATLAB command line.
The output function has the following calling syntax.
[state,options,optchanged] = myfun(options,state,flag,interval)
The function has the following input arguments:
options — Options structure
state — Structure containing information about the current generation. The State Structure describes the fields of state.
flag — String indicating the current status of the algorithm as follows:
'init' — Initial stage
'iter' — Algorithm running
'interrupt' — Intermediate stage
'done' — Algorithm terminated
interval — Optional interval argument
Passing Extra Parameters in the Optimization Toolbox User's Guide explains how to provide additional parameters to the function.
The output function returns the following arguments to ga:
state — Structure containing information about the current generation
options — Options structure modified by the output function. This argument is optional.
optchanged — Flag indicating changes to options
Level of display ('Display') specifies how much information is displayed at the command line while the genetic algorithm is running. The available options are
Off ('off') — No output is displayed.
Iterative ('iter') — Information is displayed at each iteration.
Diagnose ('diagnose') — Information is displayed at each iteration. In addition, the diagnostic lists some problem information and the options that have been changed from the defaults.
Final ('final') — The reason for stopping is displayed.
Both Iterative and Diagnose display the following information:
Generation — Generation number
f-count — Cumulative number of fitness function evaluations
Best f(x) — Best fitness function value
Mean f(x) — Mean fitness function value
Stall generations — Number of generations since the last improvement of the fitness function
When a nonlinear constraint function has been specified, Iterative and Diagnose will not display the Mean f(x), but will additionally display:
Max Constraint — Maximum nonlinear constraint violation
The default value of Level of display is
Off in the Optimization Tool
'final' in an options structure created using gaoptimset
The vectorize option specifies whether the computation of the fitness function is vectorized. Set Set Objective function is vectorized to On to indicate that the fitness function is vectorized. When Objective function is vectorized is Off, the algorithm calls the fitness function on one individual at a time as it loops through the population.
See Vectorizing the Fitness Function for an example.
Specifies whether ga or gamultiobj evaluates populations in parallel, using multiple processes or processors, or evaluates them serially. Set UseParallel to 'always' to evaluate in parallel. Set UseParallel to 'never' to evaluate serially.
![]() | Pattern Search Options | Simulated Annealing and Threshold Acceptance Algorithm Options | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |