(Not recommended) Create genetic algorithm options structure
gaoptimset
is not recommended. Use
optimoptions
instead. For more information, see Compatibility Considerations.
gaoptimset
options = gaoptimset
options = gaoptimset(@ga)
options = gaoptimset(@gamultiobj)
options = gaoptimset('param1',value1,'param2',value2,...)
options = gaoptimset(oldopts,'param1',value1,...)
options = gaoptimset(oldopts,newopts)
gaoptimset
with no input or output arguments displays a complete
list of parameters with their valid values.
options = gaoptimset
(with no input arguments) creates a structure
called options
that contains the options, or
parameters, for the genetic algorithm and sets parameters to
[]
, indicating default values will be used.
options = gaoptimset(@ga)
creates a structure called
options
that contains the default options for the genetic
algorithm.
options = gaoptimset(@gamultiobj)
creates a structure called
options
that contains the default options for
gamultiobj
.
options = gaoptimset('param1',value1,'param2',value2,...)
creates a
structure called options
and sets the value of
'param1'
to value1
, 'param2'
to
value2
, and so on. Any unspecified parameters are set to their default
values. It is sufficient to type only enough leading characters to define the parameter name
uniquely. Case is ignored for parameter names.
options = gaoptimset(oldopts,'param1',value1,...)
creates a copy of
oldopts
, modifying the specified parameters with the specified
values.
options = gaoptimset(oldopts,newopts)
combines an existing options
structure, oldopts
, with a new options structure,
newopts
. Any parameters in newopts
with nonempty
values overwrite the corresponding old parameters in oldopts
.
The following table lists the options you can set with gaoptimset
.
See Genetic Algorithm Options for a complete description of these options and their
values. Values in {}
denote the default value. {}*
means the default when there are linear constraints, and for MutationFcn
also when there are bounds. You can also view the optimization parameters and defaults by
typing gaoptimset
at the command line. I* indicates that ga
ignores or overwrites the option for
mixed integer optimization problems.
optimoptions
hides the options listed in
italics, but gaoptimset
does not. See Options that optimoptions Hides.
Options for ga
, Integer ga
,
and gamultiobj
Option | Description | Values |
---|---|---|
ConstraintTolerance | Determines the feasibility with respect to nonlinear constraints. Also,
For an options
structure, use | Positive scalar | |
| I* Function that creates the initial population. Specify as a name of a built-in creation function or a function handle. See Population Options. |
|
| I* Function that the algorithm uses to create crossover children. Specify as a name of a built-in crossover function or a function handle. See Crossover Options. |
|
| The fraction of the population at the next generation, not including elite children, that the crossover function creates. | Positive scalar | |
| Level of display. |
|
| Function that computes distance measure of individuals. Specify as a name of a built-in
distance measure function or a function handle. The value applies to
decision variable or design space (genotype) or to function space
(phenotype). The default For an options structure, use a function handle, not a name. |
|
| NM Positive integer
specifying how many individuals in the current generation are guaranteed
to survive to the next generation. Not used in | Positive integer | |
| NM If the fitness function
attains the value of | Scalar | |
| Function that scales the values of the fitness function. Specify as a name of a
built-in scaling function or a function handle. Option unavailable for
|
|
FunctionTolerance | The algorithm stops if the average relative change in the best fitness function value
over For
For an options structure, use
| Positive scalar | |
| I* Function that continues the optimization after
Alternatively, a cell array specifying the hybrid function and its options. See ga Hybrid Function. For | Function name or handle | or 1-by-2 cell array
| |
InitialPenalty | NM I* Initial value of penalty parameter | Positive scalar | |
| Initial population used to seed the genetic algorithm. Has up to
For an options structure, use
| Matrix | |
| Matrix or vector specifying the range of the individuals in the initial population.
Applies to For an options structure, use
| Matrix or vector | |
| I* Initial scores used to determine fitness. Has up to
For an
options structure, use | Column vector for single objective | matrix for multiobjective
| |
| Maximum number of iterations before the algorithm halts. For an options
structure, use | Positive integer | |
| The algorithm stops if the average relative change in the best fitness function value
over For
For an options structure, use
| Positive integer | |
| NM The algorithm stops if there is no improvement in
the objective function for For an
options structure, use | Positive scalar |
| The algorithm stops after running after For an options structure,
use | Positive scalar | |
MigrationDirection | Direction of migration. See Migration Options |
|
MigrationFraction | Scalar from 0 through 1 specifying the fraction of individuals in each subpopulation that migrates to a different subpopulation. See Migration Options | Scalar | |
MigrationInterval | Positive integer specifying the number of generations that take place between migrations of individuals between subpopulations. See Migration Options. | Positive integer | |
| I* Function that produces mutation children. Specify as a name of a built-in mutation function or a function handle. See Mutation Options. |
|
| Nonlinear constraint algorithm. See Nonlinear Constraint Solver Algorithms. Option unchangeable for
For an options structure,
use |
|
| Functions that For an options structure,
use | Function handle or cell array of function handles |
|
| Scalar from 0 through 1 specifying the fraction of individuals to keep on the first
Pareto front while the solver selects individuals from higher fronts, for
| Scalar | |
PenaltyFactor | NM I* Penalty update parameter. | Positive scalar | |
| Function that plots data computed by the algorithm. Specify as a name of a built-in plot function, a function handle, or a cell array of built-in names or function handles. See Plot Options. For an options
structure, use |
|
PlotInterval | Positive integer specifying the number of generations between consecutive calls to the plot functions. | Positive integer | |
| Size of the population. | Positive integer | |
| Data type of the population. Must be |
|
| I* Function that selects parents of crossover and mutation children. Specify as a name of a built-in selection function or a function handle.
|
|
StallTest | NM Stopping test type. |
|
UseParallel | Compute fitness and nonlinear constraint functions in parallel. See Vectorize and Parallel Options (User Function Evaluation) and How to Use Parallel Processing in Global Optimization Toolbox. |
|
| Specifies whether functions are vectorized. See Vectorize and Parallel Options (User Function Evaluation) and Vectorize the Fitness Function. For an options structure, use |
|