Genetic Algorithm and Direct Search Toolbox Previous page   Next Page
ga

Find the minimum of a function using the genetic algorithm

Syntax

Description

ga implements the genetic algorithm at the command line to minimize an objective function.

x = ga(fitnessfun, nvars) applies the genetic algorithm to an optimization problem, where fitnessfun is the objective function to minimize and nvars is the length of the solution vector x, the best individual found.

x = ga(fitnessfun, nvars, options) applies the genetic algorithm to an optimization problem, using the parameters in the options structure.

x = ga(problem) finds the minimum for problem, a structure that has three fields:

[x, fval] = ga(...) returns fval, the value of the fitness function at x.

[x, fval, reason] = ga(...) returns reason, a string containing the reason the algorithm stops.

[x, fval, reason, output] = ga(...) returns output, a structure that contains output from each generation and other information about the performance of the algorithm. The output structure contains the following fields:

[x, fval, reason, output, population] = ga(...) returns matrix population, whose rows are the final population.

[x, fval, reason, output, population, scores] = ga(...) returns scores, the scores of the final population.

Example

See Also

gaoptimset, gatool


Previous page  Alphabetical List of Functions gaoptimget Next page

 © 1994-2009 The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS