## Documentation |

The `particleswarm` function
solves unconstrained or bound-constrained optimization problems using
the particle swarm optimization algorithm. `particleswarm` is
not available in the Optimization app. For details and examples, see Particle Swarm.

`gamultiobj` now accepts nonlinear
constraints. For details, see the function reference page.

You can choose a new nonlinear constraint algorithm in `ga` by setting the `NonlinConAlgorithm` option
to `'penalty'`. Frequently, the `'penalty'` algorithm
is faster than the default `'auglag'` algorithm.
For details, see Nonlinear Constraint Solver Algorithms
.

Several default settings in the `ga` function
changed for noninteger problems.

Option | Old Default | New Default |
---|---|---|

EliteCount | 2 | floor(0.05*PopulationSize) |

Generations | 100 | 100*numberOfVariables |

PopInitRange | [0;1] | [-10;10], shifted and scaled to match any
finite bounds |

PopulationSize | 20 | 50 when numberOfVariables <=
5, and 200 otherwise |

Other changes:

`ga`now stops when the average relative change in best fitness value over`StallGenLimit`generations is less than the`TolFun`tolerance. Previously, the stopping criterion was a*weighted*average relative change, where the weighting factor was (1/2)^{n}for the*n*th prior iteration. This change usually causes`ga`to take more iterations. The new`StallTest`option, with default value`'totalChange'`, controls the stopping criterion. Set`StallTest`to`'geometricWeighted'`to recover the previous behavior.When there are linear constraints, the default crossover function is now

`'crossoverintermediate'`. Previously, the default crossover function was`'crossoverscattered'`for all constraint types.The

`gamultiobj`function has the same new default values as`ga`for the`PopInitRange`and`PopulationSize`options.

When using its default options, `ga` generally
runs longer than before, and obtains different (and often better)
results.

If you want `ga` to run as before, set its
options to their old defaults using `gaoptimset`.

The `UseParallel` option now accepts the values `true` and `false`.
The option also accepts the former values `'always'` and `'never'`,
and scalar values `1` and `0`.

The affected solvers are `MultiStart`, `patternsearch`, `ga`,
and `gamultiobj`. Also, the local or hybrid solver `fmincon` has
the same change to its `UseParallel` option.

The default `fmincon` algorithm is now `'interior-point'`.
Previously, the default `fmincon` algorithm for `GlobalSearch` was `'active-set'`.
Similarly, the default `fmincon` algorithm for `MultiStart` was `'active-set'` when
you set `fmincon` as the local solver.

When you do not set an `fmincon` algorithm, `GlobalSearch` and `MultiStart` can
obtain different results than before, and take different iteration
steps. To reproduce their previous behavior, set the `fmincon` `Algorithm` option
to `'active-set'` using `optimoptions`,
and include the option using the `createOptimProblem` function.
For example,

opts = optimoptions('fmincon','Algorithm','active-set'); problem = createOptimProblem('fmincon','options',opts,...);

When `x0` is a scalar, `patternsearch` now
expects your objective function to output a column vector of values.
In addition, any nonlinear constraint functions need to output column
vectors as well.

Previously, `patternsearch` assumed that
scalar problems were in column form, so expected a vectorized objective
function to output a row vector.

The `ga` function
now allows you to specify that certain variables are integer valued.
When you include integer constraints, you can have any objective function,
bounds, and inequality constraints, but you cannot directly include
equality constraints. To try to circumvent this limitation, see No Equality
Constraints.

For details on mixed-integer programming, see the `ga` function
reference page or Mixed
Integer Optimization.

There is a new demo of `ga` for
mixed integer programming. Run the demo at the MATLAB command
line by entering `echodemo weldedBeamDemo`.

For R2011b, error and warning message identifiers have changed in Global Optimization Toolbox.

If you have scripts or functions that use message identifiers
that changed, you must update the code to use the new identifiers.
Typically, message identifiers are used to turn off specific warning
messages, or in code that uses a `try`/`catch` statement
and performs an action based on a specific error identifier.

For example, the `'globaloptim:EQNSOLV:sparseToFull'` identifier
has changed to `'globaloptim:eqnsolv:eqSparseToFull'`.
If your code checks for `'globaloptim:EQNSOLV:sparseToFull'`,
you must update it to check for `'globaloptim:eqnsolv:eqSparseToFull'` instead.

To determine the identifier for a warning, run the following command just after you see the warning:

[MSG,MSGID] = lastwarn;

This command saves the message identifier to the variable `MSGID`.

To determine the identifier for an error, run the following command just after you see the error:

exception = MException.last; MSGID = exception.identifier;

The `patternsearch` and `ga` **History
to new window** output functions (`@psoutputhistory` and `@gaoutputgen`)
have been removed. Obtain the same functionality by setting one of
the following:

`Display`option to`'iter'`with`psoptimset`or`gaoptimset`**Level of display**to`iterative`in the**Display to command window**part of the Optimization Tool**Options**pane

Use output functions or plot functions with `GlobalSearch` and `MultiStart` to
report and plot information on algorithm progress during runs. You
can also stop the solvers according to criteria you set. For more
information, see Output Functions
for GlobalSearch and MultiStart and Plot Functions
for GlobalSearch and MultiStart.

In order to make exit flags have more uniform meaning across
solvers, two `GlobalSearch` and `MultiStart` exit
flags have different meanings than in R2010a:

Exit Flag | Meaning |
---|---|

-1 | GlobalSearch or MultiStart stopped
by an output function or plot function (regardless of local solver
exit flag) |

-8 | No solution found; all local solver runs had exit flag -1 or
smaller |

The demo titled "Using the Genetic Algorithm with the Parallel Computing Toolbox™" was removed from the toolbox. The demo used more complex parallelization techniques than those in the Optimization Toolbox™ demo titled "Minimizing an Expensive Optimization Problem Using Parallel Computing Toolbox™."

Former Genetic Algorithm and Direct Search Toolbox™ functions are now part of Global Optimization Toolbox software.

Error and warning IDs now use the `globaloptim` name
instead of the `gads` name. For example, to turn
off the `sahybrid:unconstrainedHybridFcn` warning,
instead of

warning('off','gads:sahybrid:unconstrainedHybridFcn')

use the statement

warning('off','globaloptim:sahybrid:unconstrainedHybridFcn')

`GlobalSearch` and `MultiStart` run
a local solver (such as `fmincon`)
from a variety of start points. The goal is to find a global minimum,
or multiple local minima. The chief differences between the solver
objects are:

`GlobalSearch`uses a scatter-search mechanism for generating start points.`MultiStart`uses uniformly distributed start points within bounds, or user-supplied start points.`GlobalSearch`analyzes start points and rejects those that are unlikely to improve the best local minimum found so far.`MultiStart`runs all start points.`MultiStart`gives a choice of local solver:`fmincon`,`fminunc`,`lsqcurvefit`, or`lsqnonlin`.`GlobalSearch`uses`fmincon`.`MultiStart`can be run in parallel, distributing start points to multiple processors.`GlobalSearch`does not run in parallel.

These solver objects come with a variety of new objects, functions, and methods:

`createOptimProblem`— Function for creating optimization problem structure`CustomStartPointSet`and`RandomStartPointSet`— Objects for`MultiStart`multiple start points`GlobalOptimSolution`— Object for holding results of multiple runs of local solver`list`— Method for obtaining start points from a`CustomStartPointSet`or`RandomStartPointSet``run`— Method for running`GlobalSearch`or`MultiStart`objects with optimization problem structures

For more information, see Using GlobalSearch and MultiStart in the Global Optimization Toolbox User's Guide.

A new poll method generates search directions faster and more
reliably in `patternsearch` for
linearly constrained problems. Use this poll method at the command
line by setting the `PollMethod` option to `'GSSPositiveBasis2N'` or `'GSSPositiveBasisNp1'` with `psoptimset`.
With the Optimization Tool, set **Options > Poll > Poll
method** to `GSS Positive basis 2N` or `GSS
Positive basis Np1`.

For more information, see Poll Options in the Global Optimization Toolbox User's Guide.

There is a new demo showing how to use `GlobalSearch` and `MultiStart` to
find a global optimum or several local optima. Run the demo at the MATLAB command
line by entering `echodemo opticalInterferenceDemo`.

The `threshacceptbnd` function has been removed.

Use `simulannealbnd` for
similar functionality. To obtain results using a threshold acceptance
algorithm, write a custom acceptance function for `simulannealbnd`—see `AcceptanceFcn` in Algorithm
Settings.

The `threshacceptbnd` function will be removed
in a future release.

The `threshacceptbnd` function now warns
that it will be removed in a future release. Use `simulannealbnd` for
similar functionality. To obtain results using a threshold acceptance
algorithm, write a custom acceptance function for `simulannealbnd`—see `AcceptanceFcn` in Algorithm
Settings.

There is a new demo showing graphically how `patternsearch` works.
To see the demo, enter `echodemo mtwashdemo` at the MATLAB command
line.

The functions `ga`, `gamultiobj`,
and `patternsearch` can
take advantage of parallel computing. Furthermore, applicable hybrid
functions can use parallel computing. For more information, see the Parallel Processing chapter
in the User's Guide.

The Genetic Algorithm Tool and Pattern Search Tool GUIs have
been combined into the Optimization Toolbox Optimization Tool
GUI. To access these GUIs, enter `optimtool` at
the command line and choose the appropriate solver.

The functions `gatool` and `psearchtool` continue
to work, calling `optimtool` with the appropriate
solver selected (`ga` or `patternsearch`).
However, the functions `gatool` and `psearchtool` are
no longer listed in the documentation.

The Optimization Tool GUI now includes the functions `gamultiobj`, `simulannealbnd`,
and `threshacceptbnd`. Therefore, all Genetic
Algorithm and Direct Search Toolbox™ solvers are supported
in Optimization Tool. To access these GUIs, enter `optimtool` at
the command line and choose the appropriate solver.

`ga` and `gamultiobj` can
now create populations satisfying bounds and linear constraints, with
well-dispersed populations, using the function `gacreationlinearfeasible`.

The previous creation function, `gacreationuniform`,
is accessible by using `gaoptimset` to
set `CreationFcn` to `@gacreationuniform`.
The new default behavior is to use `gacreationlinearfeasible` when
there are linear constraints, and `gacreationuniform` when
there are bounds or no constraints.

The default value of `StallTimeLimit` in `ga` used
to be `20`. It was changed to `Inf` in
order to avoid time-outs when using computationally intensive fitness
functions.

Change `StallTimeLimit` to `20` using `gaoptimset` to
get the previous behavior.

Multiobjective optimization, with linear and bound constraints,
is now available through the new function `gamultiobj`.
This function determines optimal Pareto fronts from specified criteria,
including Pareto fronts that are nonconvex, disconnected, or both.

Optimization Toolbox also contains multiobjective functionality, but cannot reliably generate optimal Pareto fronts if these are nonconvex or disconnected.

Two new demos illustrate this feature. See New Demos following.

The new function `gamultiobj` also supports
multiobjective optimization with custom data types, including binary.

To determine multiobjective optimizations more accurately, you
can now combine the new function `gamultiobj` with
the existing function `fgoalattain` from Optimization Toolbox.

The functions `ga` and `patternsearch` now
accept vectorized function inputs with nonlinear constraints. The
new function `gamultiobj` does
as well.

Two accompanying demos illustrate the use of the new multiobjective
genetic algorithm function `gamultiobj`:

`gamultiobjfitnessgamultiobjfitness`uses`gamultiobj`to solve a simple problem with one decision variable and two objectives.`gamultiobjoptionsdemogamultiobjoptionsdemo`shows how to set options for multiobjective optimization with a simple genetic algorithm problem.

The following functions have been added for simulated annealing and threshold acceptance:

simulannealbnd | Perform unconstrained or bound-constrained minimization of a function of several variables using simulated annealing. The default algorithm uses adaptive annealing, but options can be changed to use Boltzmann annealing, fast annealing, and other variants. |

threshacceptbnd | Perform unconstrained or bound-constrained minimization of a function of several variables using threshold acceptance. |

saoptimset | Create or modify optimization options for |

saoptimget | Access options for |

If you are viewing this documentation in the Help browser, the following demos are available:

Minimization Using Simulated Annealing And Threshold Acceptance AlgorithmsMinimization Using Simulated Annealing And Threshold Acceptance Algorithms

Simulated Annealing and Threshold Acceptance OptionsSimulated Annealing and Threshold Acceptance Options

Custom Data Type Optimization Using Simulated AnnealingCustom Data Type Optimization Using Simulated Annealing

The third output argument returned by the `ga` function
is now a numeric value. This change is consistent with other optimization
solvers in MATLAB and makes
it easier to programmatically determine the reason the solver stopped.
As in previous versions, the fourth output argument is a structure
with the field `message` containing a string that
indicates the reason the solver stopped.

The new syntax is as follows:

[x,fval,exitflag,output] = ga(fitnessfcn, ...)

For
more information, including a description of the messages that correspond
to the numeric values for each `exitflag` value,
see the `ga` function
reference page in the Genetic Algorithm and Direct Search
Toolbox™ User's Guide for more information.

In previous versions, the third output argument returned by `ga` is
a string describing the reason the solver stopped.

[x,fval,reason] = ga(fitnessfcn, ...)

If
you used the third output argument of the `ga` function
programmatically in a previous release, for example, to compare the
value to a string, this code will now produce an error.

The new syntax is more efficient both with speed and memory. This is done by changing the way linear and bound constraints are stored and passed to a search function. The following describes the new calling syntax:

function [successSearch,xBest,fBest,funccount] = searchfcntemplate(fun,x,A,b,Aeq,beq,lb,ub, ... optimValues,options)

For more information on how to use the new search function syntax, see Structure of the Search Function in the Genetic Algorithm and Direct Search Toolbox™ User's Guide. To see a template that you can view and edit, type

edit searchfcntemplate

at the Command Window.

In previous versions, a search function required the following calling syntax:

function [successSearch,nextIterate,optimState] = searchfcntemplate(fun,iterate,tol,A,L,U, ... funeval,maxfun,searchoptions,objfcnarg, ... iterlimit,factors)

If you have a search function written for use in a previous release, the function performs correctly in Version 2.0.2 but returns a warning. Custom search functions written in a previous version need to be updated with the new syntax. In later versions, this syntax may cause a warning or error.

The `searchConversion` utility function is
provided to convert your search functions from previous releases to
the new syntax of Version 2.0.2. For more information on obtaining
and using the conversion function, see this technical
support solution.

Previously, the genetic algorithm solver only solved unconstrained
optimization problems, and the pattern search solver solved unconstrained
optimization problems as well as those with linear constraints and
bounds. Now, both solvers have to ability to solve general nonlinear
optimization problems with linear constraints, bounds, and nonlinear
constraints by accepting a nonlinear constraint function. The M-file
for the nonlinear constraint function is accepted as an input argument
at the command line for both the `ga` and `patternsearch` functions,
as well as in the **Constraints** panel of `psearchtool` and `gatool`.

The GPS algorithm is the pattern search algorithm implemented in previous versions of the toolbox. The MADS algorithm is a modification of the GPS algorithm. The algorithms differ in how the set of points forming the mesh is computed. The GPS algorithm uses fixed direction vectors, whereas the new MADS algorithm uses a random selection of vectors to define the mesh.

The following options are available in the `gatool` and
when using the `ga` function
at the command prompt:

The new

**Constraints**panel has a**Nonlinear constraint function**field in addition to fields for linear constraints and bounds for solving constrained optimization problemsNew

**Max constraint**(`@gaplotmaxconstr`) option in the**Plot**pane to plot the maximum nonlinear constraint violation at each generationNew crossover function,

`Arithmetic`(`@crossoverarithmetic`), available in the**Crossover**panel that creates children that are the weighted arithmetic mean of two parentsNew mutation function,

`Adaptive Feasible`(`mutationadaptfeasible`), available in the**Crossover**panel that randomly generates directions that are adaptive with respect to the last successful or unsuccessful generation. This function is the default for constrained problemsNew

**Algorithm settings**panel for selecting algorithm specific parameters, such as the penalty parameters,**Initial penalty**and**Penalty factor**, for a nonlinear constraint algorithmNew

**Hybrid function**,`fmincon`, for constrained problemsNew

**Nonlinear constraint tolerance**parameter in**Stopping criteria**

The following options are available in the `psearchtool` and
when using the `patternsearch` function
at the command prompt:

**Constraints**now has a**Nonlinear constraint function**option to solve for constrained optimization problemsNew

**Max constraint**(`@psplotmaxconstr`) option in the**Plot**pane to plot the maximum nonlinear constraint violation at each generationUpdated

**Poll method**and**Search method**options for selecting the GPS or MADS algorithmsNew

**Algorithm settings**panel for selecting algorithm specific parameters, such as the penalty parameters,**Initial penalty**and**Penalty factor**, for a nonlinear constraint algorithmNew

**Time limit**and**Nonlinear constraint tolerance**parameters in**Stopping criteria**

The Genetic Algorithm and Direct Search Toolbox contains the following new demos for Version 2.0:

Optimization of Non-smooth Objective Function

Constrained Minimization Using the Genetic Algorithm

Constrained Minimization Using the Pattern Search

Optimization of Stochastic Objective Function

Using the Genetic Algorithm and Direct Search Toolbox™

Release | Features or Changes with Compatibility Considerations |
---|---|

R2014b | None |

R2014a | |

R2013b | None |

R2013a | Vectorized scalar patternsearch assumes
row orientation |

R2012b | None |

R2012a | None |

R2011b | Conversion of Error and Warning Message Identifiers |

R2011a | None |

R2010b | Output Functions and Plot Functions for GlobalSearch and MultiStart |

R2010a | |

R2009b | threshacceptbnd Function Deprecated |

R2009a | None |

R2008b | None |

R2008a | |

R2007b | None |

R2007a | ga Output Argument exitflag Returns Numeric Value |

R2006b | New Syntax for Search Method Option in Pattern Search Algorithm Improves Speed and Memory |

R2006a | None |

R14SP3 | None |

Was this topic helpful?

© 1994-2014 The MathWorks, Inc.

© 1994-2015 The MathWorks, Inc.