Main Content

Find minimum of function using genetic algorithm

finds a local unconstrained minimum, `x`

= ga(`fun`

,`nvars`

)`x`

, to the objective
function, `fun`

. `nvars`

is the dimension (number
of design variables) of `fun`

.

**Note**

Passing Extra Parameters explains how to pass extra parameters to the objective function and nonlinear constraint functions, if necessary.

subjects the minimization to the constraints defined in `x`

= ga(`fun`

,`nvars`

,`A`

,`b`

,`Aeq`

,`beq`

,`lb`

,`ub`

,`nonlcon`

)`nonlcon`

.
The function `nonlcon`

accepts `x`

and returns
vectors `C`

and `Ceq`

, representing the nonlinear
inequalities and equalities respectively. `ga`

minimizes the
`fun`

such that
`C(x) `

≤` 0`

and
`Ceq(x) = 0`

. (Set `lb=[]`

and
`ub=[]`

if no bounds exist.)

or
`x`

= ga(`fun`

,`nvars`

,`A`

,`b`

,[],[],`lb`

,`ub`

,`nonlcon`

,`IntCon`

)

requires that the variables listed in `x`

= ga(`fun`

,`nvars`

,`A`

,`b`

,[],[],`lb`

,`ub`

,`nonlcon`

,`IntCon`

,`options`

)`IntCon`

take integer
values.

**Note**

When there are integer constraints, `ga`

does not
accept linear or nonlinear equality constraints, only inequality
constraints.

To write a function with additional parameters to the independent variables that can be called by

`ga`

, see Passing Extra Parameters.For problems that use the population type

`Double Vector`

(the default),`ga`

does not accept functions whose inputs are of type`complex`

. To solve problems involving complex data, write your functions so that they accept real vectors, by separating the real and imaginary parts.

For a description of the genetic algorithm, see How the Genetic Algorithm Works.

For a description of the mixed integer programming algorithm, see Integer ga Algorithm.

For a description of the nonlinear constraint algorithms, see Nonlinear Constraint Solver Algorithms.

The **Optimize** Live Editor task provides a visual interface for `ga`

.

[1] Goldberg, David E., *Genetic Algorithms in Search, Optimization &
Machine Learning*, Addison-Wesley, 1989.

[2] A. R. Conn, N. I. M. Gould, and Ph. L. Toint. “A Globally Convergent
Augmented Lagrangian Algorithm for Optimization with General Constraints and Simple
Bounds”, *SIAM Journal on Numerical Analysis*, Volume 28,
Number 2, pages 545–572, 1991.

[3] A. R. Conn, N. I. M. Gould, and Ph. L. Toint. “A Globally Convergent
Augmented Lagrangian Barrier Algorithm for Optimization with General Inequality
Constraints and Simple Bounds”, *Mathematics of
Computation*, Volume 66, Number 217, pages 261–288, 1997.

`gamultiobj`

| Optimize | `optimoptions`

| `particleswarm`

| `patternsearch`