Genetic Algorithm and Direct Search Toolbox Previous page   Next Page

Using the Genetic Algorithm at the Command Line

As an alternative to using the Genetic Algorithm Tool, you can run the genetic algorithm function ga from the command line. This section explains how to do so and covers the following topics.

Running the Genetic Algorithm with the Default Options

To run the genetic algorithm with the default options, call ga with the syntax

The input arguments to ga are

The output arguments are

For a description of additional output arguments, see the reference page for ga.

As an example, you can run the example described in Example: Rastrigin's Function from the command line by entering

This returns

Additional Output Arguments

To get more information about the performance of the genetic algorithm, you can call ga with the syntax

Besides x and fval, this returns the following additional output arguments:

See the reference page for ga for more information about these arguments.


Previous page  Generating an M-File Setting Options at the Command Line Next page

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