# gaoptimset

Specify options for the genetic algorithm.

## Syntax

options = optimset('option1', value1, 'option2', value2, ...)

## Inputs

`optionN`- The name of option N.
`valueN`- The value of option N.

## Outputs

- options
- A struct containing the options.

## Examples

Set the number of generations:

`options = gaoptimset('Generations', 200)`

```
options = struct [
Generations: 200
]
```

Set the population size:

`options = gaoptimset('PopulationSize', 200)`

```
options = struct [
PopulationSize: 200
]
```

## Comments

The default value for Display is 'off'.

The default for Generations is 100 times the number of variables, up to a maxmimum of 1000.

The default for InitialPopulation is uniformly random on the interval (-10,10) for each variable.

The default value for MaxFail is 20000.

PopInitialRange can be specified as a two-element vector applied to each design variable, or as a 2-by-N matrix, where N is the number of design variables.

The default for PopulationSize is 100, which allows the algorithm to choose.

The default value for Seed is 0 (unrepeatable).

TolCon only applies when ga cannot find a feasible solution. In such cases, the function returns the best infeasible solution found within the allowed violation, along with a warning. The algorithm does not attempt to minimize the utilized violation. The TolCon value is applied as a percent of the constraint bound, with an absolute minimum of 1.0e-4, applied when the bound is zero or near zero.

An elite count of 10% of the population is advanced to the next generation. This option is not yet available for modification.