.. _method-soga:

""""
soga
""""


Single-objective Genetic Algorithm (a.k.a Evolutionary Algorithm)



**Topics**


package_jega, global_optimization_methods


.. toctree::
   :hidden:
   :maxdepth: 1

   method-soga-fitness_type
   method-soga-replacement_type
   method-soga-convergence_type
   method-soga-max_iterations
   method-soga-max_function_evaluations
   method-soga-scaling
   method-soga-population_size
   method-soga-log_file
   method-soga-print_each_pop
   method-soga-initialization_type
   method-soga-crossover_type
   method-soga-mutation_type
   method-soga-seed
   method-soga-convergence_tolerance
   method-soga-model_pointer


**Specification**

- *Alias:* None

- *Arguments:* None


**Child Keywords:**

+-------------------------+--------------------+------------------------------+-----------------------------------------------+
| Required/Optional       | Description of     | Dakota Keyword               | Dakota Keyword Description                    |
|                         | Group              |                              |                                               |
+=========================+====================+==============================+===============================================+
| Optional                                     | `fitness_type`__             | Select the fitness type for JEGA methods      |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `replacement_type`__         | Select a replacement type for JEGA methods    |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `convergence_type`__         | Select the convergence type for JEGA methods  |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `max_iterations`__           | Number of iterations allowed for optimizers   |
|                                              |                              | and adaptive UQ methods                       |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `max_function_evaluations`__ | Number of function evaluations allowed for    |
|                                              |                              | optimizers                                    |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `scaling`__                  | Turn on scaling for variables, responses, and |
|                                              |                              | constraints                                   |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `population_size`__          | Set the initial population size in JEGA       |
|                                              |                              | methods                                       |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `log_file`__                 | Specify the name of a log file                |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `print_each_pop`__           | Print every population to a population file   |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `initialization_type`__      | Specify how to initialize the population      |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `crossover_type`__           | Select a crossover type for JEGA methods      |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `mutation_type`__            | Select a mutation type for JEGA methods       |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `seed`__                     | Seed of the random number generator           |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `convergence_tolerance`__    | Stopping criterion based on objective         |
|                                              |                              | function or statistics convergence            |
+----------------------------------------------+------------------------------+-----------------------------------------------+
| Optional                                     | `model_pointer`__            | Identifier for model block to be used by a    |
|                                              |                              | method                                        |
+----------------------------------------------+------------------------------+-----------------------------------------------+

.. __: method-soga-fitness_type.html
__ method-soga-replacement_type.html
__ method-soga-convergence_type.html
__ method-soga-max_iterations.html
__ method-soga-max_function_evaluations.html
__ method-soga-scaling.html
__ method-soga-population_size.html
__ method-soga-log_file.html
__ method-soga-print_each_pop.html
__ method-soga-initialization_type.html
__ method-soga-crossover_type.html
__ method-soga-mutation_type.html
__ method-soga-seed.html
__ method-soga-convergence_tolerance.html
__ method-soga-model_pointer.html



**Description**


``soga`` stands for Single-objective Genetic Algorithm, which is a
global optimization method that supports general constraints and a
mixture of real and discrete variables. ``soga`` is part of the JEGA
library.

*Constraints*
``soga`` can utilize linear constraints.

*Configuration*

The genetic algorithm configurations are:


* fitness
* replacement
* convergence
* initialization
* crossover
* mutation
* population size

The pool of potential members is the current population and the
current set of offspring.  Choice of fitness assessors is strongly
related to the type of replacement algorithm being used and can have a
profound effect on the solutions selected for the next generation.


*Stopping Criteria*

The ``soga`` method respects the ``max_iterations`` and
``max_function_evaluations`` method independent controls to provide
integer limits for the maximum number of generations and function
evaluations, respectively.

The algorithm also stops when convergence is reached. This involves
repeated assessment of the algorithm's progress in solving the
problem, until some criterion is met.


*Expected Outputs*
The ``soga`` method respects the ``output`` method independent control
to vary the amount of information presented to the user during
execution.

The final results are written to the Dakota tabular output. Additional
information is also available - see the ``log_file`` and
``print_each_pop`` keywords.

*Expected HDF5 Output*

If Dakota was built with HDF5 support and run with the
:dakkw:`environment-results_output-hdf5` keyword, this method
writes the following results to HDF5:


- :ref:`hdf5_results-best_params`
- :ref:`hdf5_results-best_obj_fncs` (when :dakkw:`responses-objective_functions`) are specified)
- :ref:`hdf5_results-best_constraints`
- :ref:`hdf5_results-calibration` (when :dakkw:`responses-calibration_terms` are specified)



**Theory**


The basic steps of the ``soga`` algorithm are as follows:


1. Initialize the population

2. Evaluate the population (calculate the values of the objective function and constraints for each population member)

3. Loop until converged, or stopping criteria reached


  1. Perform crossover

  2. Perform mutation

  3. Evaluate the new population

  4. Assess the fitness of each member in the population

  5. Replace the population with members selected to continue in the next generation

  6. Test for convergence