Skip to content

Commit

Permalink
Merge pull request #487 from Kenneth-T-Moore/genetic
Browse files Browse the repository at this point in the history
Simple genetic algorithm
  • Loading branch information
naylor-b committed Jan 17, 2018
2 parents 493ce70 + 62e10ac commit 691f21c
Show file tree
Hide file tree
Showing 9 changed files with 1,454 additions and 1 deletion.
1 change: 1 addition & 0 deletions openmdao/api.py
Expand Up @@ -67,6 +67,7 @@
except ImportError:
pass
from openmdao.drivers.scipy_optimizer import ScipyOptimizer
from openmdao.drivers.genetic_algorithm_driver import SimpleGADriver

# System-Building Tools
from openmdao.utils.options_dictionary import OptionsDictionary
Expand Down
@@ -0,0 +1,45 @@

****************
Simple GA Driver
****************

The SimpleGADriver is a driver based on a simple genetic algorithm implementation sourced from the lecture
notes for the class 2009 AAE550 taught by Prof. William A. Crossley. The implementation is pure Python.

The SimpleGADriver supports integer design variables, but it is not limited to them. You can use a genetic
algorithm with continuous design variables, but they must be discretized before being encoded into a binary string.
The SimpleGADriver will encode a continuous variable for you, but you must specify the number of bits for
the discretization via the 'bits' option. This number is the base-2 logarithm of the number of points you
want between the min and max value. A higher value means more accuracy for this variable, but it also increases
the number of generations (and hence total evaluations) that will be required to find the minimum. If you do not
specify a value for bits for a continuous variable, then the variable is assumed to be integer, and encoded thusly.

The examples below show a mixed integer problem to illustrate usage of this driver with both integer and
discrete design variables.

.. embed-test::
openmdao.drivers.tests.test_genetic_algorithm_driver.TestFeatureSimpleGA.test_basic

Optimizer Settings
==================

.. embed-options::
openmdao.drivers.genetic_algorithm_driver
SimpleGADriver
options

You can change the number of generations to run the genetic algorithm by setting the "max_gen" option.

.. embed-test::
openmdao.drivers.tests.test_genetic_algorithm_driver.TestFeatureSimpleGA.test_option_max_gen

You can change the population size by setting the "pop_size" option.

.. embed-test::
openmdao.drivers.tests.test_genetic_algorithm_driver.TestFeatureSimpleGA.test_option_pop_size

If you have a model that doesn't contain any distributed components or parallel groups, then the model
evaluations for a new generation can be performed in parallel by turning on the "parallel" option:

.. embed-test::
openmdao.drivers.tests.test_genetic_algorithm_driver.MPIFeatureTests.test_option_parallel
Expand Up @@ -8,3 +8,4 @@ Drivers

scipy_optimizer.rst
pyoptsparse_driver.rst
genetic_algorithm.rst

0 comments on commit 691f21c

Please sign in to comment.