Evolutionary systems & genetic algorithms

From GenerativeArt

(Difference between revisions)
Jump to: navigation, search
(Genetic Variation Operations)
Current revision (22:11, 9 September 2013) (view source)
(Further Evolutionary Art Development by Karl Sims: Added a link to NEvAr)
 
The following cycle of genetic competition lies at the core of evolutionary computing:
The following cycle of genetic competition lies at the core of evolutionary computing:
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/01.jpg|caption=Genetic Competition}}
+
 
 +
{{SingleImage|imageWidthPlusTen=726|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/01.png|caption=Genetic Competition}}
 +
 
* A number of individuals (chromosomes or sets of genes) are in the population (gene pool) and each has a fitness score.
* A number of individuals (chromosomes or sets of genes) are in the population (gene pool) and each has a fitness score.
* Those individuals, or optionally only those that exceed a minimum fitness score, are added back into the population
* Those individuals, or optionally only those that exceed a minimum fitness score, are added back into the population
-
Minimum Requirements for an Evolutionary System
+
 
 +
== Minimum Requirements for an Evolutionary System ==
Even the most basic evolutionary system has these four components:
Even the most basic evolutionary system has these four components:
* A way to select genotypes based on their scores and then modify or recombine them for expression
* A way to select genotypes based on their scores and then modify or recombine them for expression
* A way to express genotypes to create phenotypes
* A way to express genotypes to create phenotypes
-
* A way to assign each genotype a score based on an evaluation of the corresponding phenotype
+
* A way to assign each genotype a fitness score based on an evaluation of the corresponding phenotype
 +
 
 +
 
 +
== Methods for Providing Fitness Scores ==
 +
 
 +
In various industrial applications fitness can be automatically evaluated using objective measures.  For example, competing genetically based investment tools can be evaluated simply by comparing their rate of return on investment.  Automated fitness scores in the arts, sometime called Computational Aesthetic Evaluation, is an exceedingly difficult unsolved problem.  A viable alternative is for the artist himself to score phenotypical expressions creating an Interactive Evolutionary System.  However, with the artist "in the loop" the population size and the number of generations are both severely limited.
 +
== Types of Genetic Representations ==
-
== Types of Genotype Representations ==
+
Another significant challenge for evolutionary artists is the design of the genotype.  There are at least 4 types of genotype representation that can be differentiated based on the mechanisms they use.  Each has a different complexification capacity, i.e. some representations lead to more complexity than others. 
-
There are at least 3 types of genotype representation that can be differentiated based on the mechanism used and the complexity of the resulting expression:
+
* '''''Fixed Parametric''''' - A genotype that uses a fixed number of parameters that map into phenotypical characteristics in a one-to-one manner. The complexification capacity of this system is highly constrained.
-
* A genotype can provide a fixed number of parameters
+
**For example, consider a system for creating drawings of insects. There might be a gene for head size, another for body color, another for leg length, and so on. While such a system may draw a wide variety of insects it will never draw a spider because unless there is a “number of legs” gene all results will have six legs.
-
* A genotype can provide an extensible number of parameters
+
* '''''Extensible Parametric''''' - A slightly more complicated genotype that uses a variable number of parameters that map into phenotypical characteristics in a one-to-one manner. The complexification capacity of this system is still fairly constrained. 
-
* A gentotype can provide construction machines of a fixed or extensible number
+
**An extension of the previous example might allow an arbitrary number of genes for legs.  By allowing each gene to draw a single leg this system would be able to draw insects, spiders, and even centipedes and millipedes. But it would not be capable of drawing fish or birds because it lacks fin and wing genes.
 +
* '''''Direct Mechanical''''' - This type of genotype describes one or more machines that in turn construct the phenotype. The complexification capacity of this kind of system is potentially much greater than the previous two.
 +
**In our example this genetic system doesn’t describe a drawing, but rather describes a machine that can draw. Such a representation will, in theory, allow most anything to be drawn. In addition, during reproduction the genes themselves may mutate making the child different than the parent. For example, a machine that creates thin pencil lines may mutate into a machine that makes brushed ink marks. Such a system may seem to be of unlimited potential, i.e. unlimited complexification capacity. But such a system is only capable of a single layer of emergence. The machines immediately and directly draw the picture, and that is that.
 +
* '''''Reproductive Mechanical''''' - Such a system is similar to the previous one, with the significant addition that within a single individual a machine may also create another machine, reproduce itself, or contribute to an emergent machine at a higher level of complexity and scale. This genetic representation offers the greatest complexification potential.
 +
**And this is, in fact, the kind of genetic representation found in nature. There is an upwardly layered increase of complexity as DNA creates proteins, proteins organize to create organelles, organelles organize to create cells, cells organize to create organs, and so on.
For bit-string genetic representations genetic variations are fairly straightforward.
For bit-string genetic representations genetic variations are fairly straightforward.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/02.jpg|caption=Genetic Operations}}
+
 
 +
{{SingleImage|imageWidthPlusTen=636|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/02.jpg|caption=Genetic Operations}}
 +
 
For engineering solutions with structured (non-bitstring) genes the distribution of mutations may be non-uniform, e.g. Gaussian (or Normal). Some studies have shown such techniques provide faster more accurate solutions.
For engineering solutions with structured (non-bitstring) genes the distribution of mutations may be non-uniform, e.g. Gaussian (or Normal). Some studies have shown such techniques provide faster more accurate solutions.
-
[[Image:http://www-viz.tamu.edu/courses/viza658/wiki/genetic/03.jpg]]
 
-
{{SingleImage|imageWidthPlusTen=640|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/03.jpg|caption=Comparision of mutation distributions}}
+
{{SingleImage|imageWidthPlusTen=610|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/03.jpg|caption=Comparision of mutation distributions}}
In addition the rate of mutation may be a genetic variable. This provides some relief in deciding what the mutation rate should be. The optimal mutation rate will then evolve. It's even possible that the mutation rate will self-adjust over time. Typically at the start the mutation rate should be higher (randomization) than it is later (when fine tuning). It's worth noting that some cases have been found in nature where the mutation rate increases in response to increased environmental pressure. This too could be simulated by calculating the mutation rate as a function of both genetics and environmental pressure.
In addition the rate of mutation may be a genetic variable. This provides some relief in deciding what the mutation rate should be. The optimal mutation rate will then evolve. It's even possible that the mutation rate will self-adjust over time. Typically at the start the mutation rate should be higher (randomization) than it is later (when fine tuning). It's worth noting that some cases have been found in nature where the mutation rate increases in response to increased environmental pressure. This too could be simulated by calculating the mutation rate as a function of both genetics and environmental pressure.
(In non-artistic optimization applications genetic algorithms often ramp down the frequency and size of mutations as the system converges on a solution. This is often referred to as "simulated annealing.")
(In non-artistic optimization applications genetic algorithms often ramp down the frequency and size of mutations as the system converges on a solution. This is often referred to as "simulated annealing.")
 +
== An Aside Regarding Bit String Genetic Representations ==
== An Aside Regarding Bit String Genetic Representations ==
Often rather than using standard binary numbers to represent a continuous value an encoding called Gray Code is used. Gray Code will make bit mutations result, on the average, in fewer large changes and more frequent small changes. This is illustrated in the following example coding for the integers 0 through 15.
Often rather than using standard binary numbers to represent a continuous value an encoding called Gray Code is used. Gray Code will make bit mutations result, on the average, in fewer large changes and more frequent small changes. This is illustrated in the following example coding for the integers 0 through 15.
-
Note: In the first chart the tallies for Gray code is missing one line. "2 x 15" should follow "2 x 13".
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/04.jpg|caption=Gray Code}}
+
{{SingleImage|imageWidthPlusTen=455|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/04.png|caption=Gray Code}}
 +
 
In both cases the mean degree of change is 3.75. In the case of binary codes there are as many transitions above the mean as below the mean. But in the case of gray codes 44 transitions are below the mean and 20 transitions are above the mean. Gray code provides a system where mutations result in a greater number of small changes, and a lesser number of large changes.
In both cases the mean degree of change is 3.75. In the case of binary codes there are as many transitions above the mean as below the mean. But in the case of gray codes 44 transitions are below the mean and 20 transitions are above the mean. Gray code provides a system where mutations result in a greater number of small changes, and a lesser number of large changes.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/05.jpg|caption=Binary to Gray Code Conversion}}
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/06.jpg|caption=Gray Code to Binary Conversion}}
+
<span style="font-size:larger">Binary to Gray Code Conversion</span>
 +
1. Number the digits 1, 2, 3 … n
 +
2. Copy B[1] to G[1]
 +
3. For G[2], G[3] … G[n]
 +
        G[i] = XOR(B[i], B[i-1])
-
== Example of Classic Genetic Programming for Problem Solving - Lawrence Fogel ==
+
Example: convert 1011
 +
Binary            Gray
 +
<font color="red">1</font>011      COPY    <font color="red">1</font>
 +
<font color="red">10</font>11      XOR      1<font color="red">1</font>
 +
1<font color="red">01</font>1      XOR      11<font color="red">1</font>
 +
10<font color="red">11</font>      XOR      111<font color="red">0</font>
-
Fogel is a graduate of NYU (B.S.E.E. 1948) and began the field of genetic programming in the mid-1960's. Genetic programming was used as a way to optimize solutions to problems with no exact or analytic solution.
+
Note: XOR is the eXclusive-OR function
 +
Inputs    Outputs
 +
  0 0        0
 +
  0 1        1
 +
  1 0        1
 +
  1 1        0
-
<span style="font-size:larger;">The Traveling Salesman problem</span>
+
<span style="font-size:larger">Gray Code to Binary Conversion</span>
-
The goal of this classic optimization problem is to craft a path visiting each location once and only once in the shortest distance possible.  
+
1. Number the digits 1, 2, 3 … n
 +
2. Copy G[1] to B[1]
 +
3. For B[2], B[3] … B[n]
 +
        B[i] = XOR(G[i], B[i-1])
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/07.jpg|caption=Traveling Salesman Problem}}
+
Example: Convert 0100
 +
Gray              Binary
 +
<font color="red">0</font>100      COPY    <font color="red">0</font>
 +
0<font color="red">1</font>00      XOR      0<font color="red">1</font>
 +
01<font color="red">0</font>0      XOR      01<font color="red">1</font>
 +
010<font color="red">0</font>      XOR      011<font color="red">1</font>
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/08.jpg|caption=Routing Problems}}
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/09.jpg|caption=Traveling Salesman Problem Visualized}}
 
-
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/10.jpg|caption=Traveling Salesman Problem Visualized}}
 
William Latham began working using a genetic approach even before using computers.
William Latham began working using a genetic approach even before using computers.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/11.jpg|caption=Genetic Art Examples}}
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/12.jpg|caption=Genetic Art Examples}}
+
{{SingleImage|imageWidthPlusTen=444|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/11.jpg|caption=Genetic Art Examples}}
 +
 
 +
 
 +
{{SingleImage|imageWidthPlusTen=766|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/12.jpg|caption=Genetic Art Examples}}
 +
 
Working with sculptural forms, Latham's genes are variable length assemblies of modules which are connected with various operations for contour, scale, and twist.
Working with sculptural forms, Latham's genes are variable length assemblies of modules which are connected with various operations for contour, scale, and twist.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/13.jpg|caption=}}
+
 
 +
{{SingleImage|imageWidthPlusTen=719|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/13.jpg|caption=}}
 +
 
Each gene can be considered a parameter which contributes a dimension to a gene space. The more alike two individuals genes are the closer together they are in gene space.
Each gene can be considered a parameter which contributes a dimension to a gene space. The more alike two individuals genes are the closer together they are in gene space.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/14.jpg|caption=}}
+
 
-
+
{{SingleImage|imageWidthPlusTen=766|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/14.jpg|caption=Genetic Art Examples}}
 +
 
 +
 
Using evolutionary methods, the artist applies an intuitive fitness function by manually evaluating phenotypes and assigning each a score. As a result the artist steers through the gene space towards an increasingly desirable result. As noted in the example above, attention must be paid to scaling so that the degree of variation is appropriate in each dimension. One approach is to normalize each parameter to values between 0 and 1, apply the variation method, and then re-map the parameter back into its native range.
Using evolutionary methods, the artist applies an intuitive fitness function by manually evaluating phenotypes and assigning each a score. As a result the artist steers through the gene space towards an increasingly desirable result. As noted in the example above, attention must be paid to scaling so that the degree of variation is appropriate in each dimension. One approach is to normalize each parameter to values between 0 and 1, apply the variation method, and then re-map the parameter back into its native range.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/15.jpg|caption=15}}
+
 
 +
{{SingleImage|imageWidthPlusTen=515|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/15.jpg|caption=Genetic Art Examples}}
 +
 
The artist typically uses a selective breeding tool to navigate through the gene space. Latham sculpts forms in the sense that a farmer sculpts increasingly healthy crops by developing hybrid seed.
The artist typically uses a selective breeding tool to navigate through the gene space. Latham sculpts forms in the sense that a farmer sculpts increasingly healthy crops by developing hybrid seed.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/16.jpg|caption=16}}
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/17.jpg|caption=16}}
+
{{SingleImage|imageWidthPlusTen=739|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/16.jpg|caption=Genetic Art Examples}}
 +
 
 +
 
 +
{{SingleImage|imageWidthPlusTen=545|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/17.jpg|caption=Genetic Art Examples}}
 +
 
 +
 
 +
{{SingleImage|imageWidthPlusTen=620|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/18.jpg|caption=Genetic Art Examples}}
 +
 
 +
 
 +
{{SingleImage|imageWidthPlusTen=759|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/19.jpg|caption=Genetic Art Examples}}
 +
 
 +
 
 +
{{SingleImage|imageWidthPlusTen=752|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/20.jpg|caption=Genetic Art Examples}}
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/18.jpg|caption=16}}
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/19.jpg|caption=16}}
+
{{SingleImage|imageWidthPlusTen=759|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/21.jpg|caption=Genetic Art Examples}}
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/20.jpg|caption=16}}
 
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/21.jpg|caption=16}}
+
{{SingleImage|imageWidthPlusTen=488|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/22.jpg|caption=Genetic Art Examples}}
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/22.jpg|caption=16}}
 
<span style="font-size:larger">Image synthesis</span>
<span style="font-size:larger">Image synthesis</span>
-
Karl Sims uses an old idea to create new art. In this SigGraph paper he describes how mathematical expressions can be treated as an assembly of genes. Ashley Mills offers a simplified explaination of this method here.
+
Karl Sims uses an old idea to create new art. In this SigGraph paper he describes how mathematical expressions can be treated as an assembly of genes. His paper can be found [http://www.karlsims.com/papers/siggraph91.html here.]
Basically the expression is parsed into a tree structure, and then subjected to mutations, or a form of crossover by substituting entire branches of the tree. An equivalent implementation can be done by using text oriented regular expression processing techniques. The resulting phenotype is an image computed pixel by pixel by evaluating each expression substituting the specific (x,y) coordinate.
Basically the expression is parsed into a tree structure, and then subjected to mutations, or a form of crossover by substituting entire branches of the tree. An equivalent implementation can be done by using text oriented regular expression processing techniques. The resulting phenotype is an image computed pixel by pixel by evaluating each expression substituting the specific (x,y) coordinate.
Here is an illustration of the tree structure technique with the expressions added.
Here is an illustration of the tree structure technique with the expressions added.
-
{{SingleImage|imageWidthPlusTen=460|imageURL=http://www-viz.tamu.edu/courses/viza658/wiki/genetic/23.jpg|caption=Illustration of the tree structure technique with the expressions added}}
+
 
 +
{{SingleImage|imageWidthPlusTen=636|imageURL=http://www.viz.tamu.edu/courses/viza658/wiki/genetic/23.jpg|caption=Illustration of the tree structure technique with the expressions added}}
 +
 
As noted by Sims:
As noted by Sims:
* Image processing or video processing can be done by calculating pixel values as a function of (x,y,i,t) where i is the value of the image channel and t is time.
* Image processing or video processing can be done by calculating pixel values as a function of (x,y,i,t) where i is the value of the image channel and t is time.
 +
Worth noting in this realm is the NEvAr system that automates the fitness function by using (more or less) the ratio of two complexity measures, compressibility via JPEG versus compressibility via fractal methods. A paper documenting NEvAr can be found [https://estudogeral.sib.uc.pt/bitstream/10316/7641/1/obra.pdf here.]
== Interactive Genetic Art Installation ==
== Interactive Genetic Art Installation ==
-
In his famous [http://www.genarts.com/galapagos/index.html Galapagos installation], Sims allows the audience to act as the evaluation function by simply "voting with their feet"...i.e. stepping up to the display that suit their fancy.
+
In his famous [http://www.karlsims.com/galapagos/index.html Galapagos installation], Sims allows the audience to act as the evaluation function by simply "voting with their feet"...i.e. stepping up to the display that suit their fancy.
-
 
+
-
Sims is also well known for his [http://www.genarts.com/karl/evolved-virtual-creatures.html Evolved Virtual Creatures]. Using block like modules connected to actuators and neural networks, all in a virtual world with simulated physics, the genes fix the structure and then the resulting creature learns how to move based on a reward system providing feedback.
+
 +
Sims is also well known for his [http://www.karlsims.com/evolved-virtual-creatures.html Evolved Virtual Creatures]. Using block like modules connected to actuators and neural networks, all in a virtual world with simulated physics, the genes fix the structure and then the resulting creature learns how to move based on a reward system providing feedback.
== More Examples ==
== More Examples ==
* Matt Lewis - [http://accad.osu.edu/~mlewis/aed.html Evolutionary Design Links]
* Matt Lewis - [http://accad.osu.edu/~mlewis/aed.html Evolutionary Design Links]
-
* Karl Sims - [http://accad.osu.edu/~mlewis/aed.html Evolutionary Computation for Art and Design Links]
+
* Karl Sims - [http://www.karlsims.com/ Collected Works]
* Craig Reynolds - [http://www.red3d.com/cwr/evolve.html Evolutionary Computation Links]
* Craig Reynolds - [http://www.red3d.com/cwr/evolve.html Evolutionary Computation Links]

Current revision

Personal tools