60.2. Genetic Algorithms

|60.2. Genetic Algorithms|               |                                   |                  |                           |
|:----------------------:|---------------|-----------------------------------|------------------|---------------------------|
|[Prev](geqo-intro.html) |[Up](geqo.html)|Chapter 60. Genetic Query Optimizer|[Home](index.html)| [Next](geqo-pg-intro.html)|

---

## 60.2. Genetic Algorithms

 The genetic algorithm (GA) is a heuristic optimization method which operates through randomized search. The set of possible solutions for the optimization problem is considered as a *population* of *individuals*. The degree of adaptation of an individual to its environment is specified by its *fitness*.

 The coordinates of an individual in the search space are represented by *chromosomes*, in essence a set of character strings. A *gene* is a subsection of a chromosome which encodes the value of a single parameter being optimized. Typical encodings for a gene could be *binary* or *integer*.

 Through simulation of the evolutionary operations *recombination*, *mutation*, and *selection* new generations of search points are found that show a higher average fitness than their ancestors. [Figure 60.1](geqo-intro2.html#GEQO-FIGURE) illustrates these steps.

**Figure 60.1. Structure of a Genetic Algorithm**

 According to the comp.ai.genetic FAQ it cannot be stressed too strongly that a GA is not a pure random search for a solution to a problem. A GA uses stochastic processes, but the result is distinctly non-random (better than random).

---

|               [Prev](geqo-intro.html)                | [Up](geqo.html)  |              [Next](geqo-pg-intro.html)              |
|:-----------------------------------------------------|:----------------:|-----------------------------------------------------:|
|60.1. Query Handling as a Complex Optimization Problem|[Home](index.html)| 60.3. Genetic Query Optimization (GEQO) in PostgreSQL|

 // \<![CDATA[ \<-- For SVG support if ('WebSocket' in window) { (function() { function refreshCSS() { var sheets = [].slice.call(document.getElementsByTagName("link")); var head = document.getElementsByTagName("head")[0]; for (var i = 0; i \< sheets.length; ++i) { var elem = sheets[i]; head.removeChild(elem); var rel = elem.rel; if (elem.href && typeof rel != "string" || rel.length == 0 || rel.toLowerCase() == "stylesheet") { var url = elem.href.replace(/(&|\\?)\_cacheOverride=\\d+/, ''); elem.href = url + (url.indexOf('?') \>= 0 ? '&' : '?') + '\_cacheOverride=' + (new Date().valueOf()); } head.appendChild(elem); } } var protocol = window.location.protocol === 'http:' ? 'ws://' : 'wss://'; var address = protocol + window.location.host + window.location.pathname + '/ws'; var socket = new WebSocket(address); socket.onmessage = function(msg) { if (msg.data == 'reload') window.location.reload(); else if (msg.data == 'refreshcss') refreshCSS(); }; console.log('Live reload enabled.'); })(); } // ]]\>