Products & Services Solutions Academia Support User Community Company

Learn more about Genetic Algorithm and Direct Search Toolbox   

Performing a Genetic Algorithm Optimization

Calling the Function ga at the Command Line

To use the genetic algorithm at the command line, call the genetic algorithm function ga with the syntax

[x fval] = ga(@fitnessfun, nvars, options)

where

The results are given by

Using the function ga is convenient if you want to

Using the Genetic Algorithm from the Command Line provides a detailed description of using the function ga and creating the options structure.

Using the Optimization Tool

To open the Optimization Tool, enter

optimtool('ga')

at the command line, or enter optimtool and then choose ga from the Solver menu.

You can also start the tool from the MATLAB Start menu as pictured:

To use the Optimization Tool, you must first enter the following information:

You can enter constraints or a nonlinear constraint function for the problem in the Constraints pane. If the problem is unconstrained, leave these fields blank.

To run the genetic algorithm, click the Start button. The tool displays the results of the optimization in the Run solver and view results pane.

You can change the options for the genetic algorithm in the Options pane. To view the options in one of the categories listed in the pane, click the + sign next to it.

For more information,

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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