Genetic Algorithm and Art
Biography
geared up formulas to produce 4 possible colors from results ranging from 0-3.
The first dataset for comparing our art was derived from the simple formula is (a + b) mod 4. This formula forces all the simulated results to values between 0 and 3 The genetic algorithm will produce genes that try to converge on a formula that approximates the formula. It is better that the algorithm not converge to the correct answer (a+b) mod 4, because the approximation to the formula is what produces the original art.
Here are some examples of the above code in resulting artworks produced after 1000 generations of converging on the formula.
{
// Fill the whole form with a light gray color to erase old drawing
g.FillRectangle(Brushes.LightGray, TheForm.ClientRectangle);
// go through each x,y coordinate and plug it into the equation
// produced by the genome to derive an integer representing a
// color
for (int i = 0; i < color="blue">
for (int j = 0; j < color="blue">
double calc1 = PerformCalculation(i, j); // do calculation
if (calc1 > 4)
g.DrawLine(Pens.LightBlue, i, j, i+1, j);
else if (calc1 > 3)
g.DrawLine(Pens.Purple, i, j, i, j+1);
else if (calc1 > 2)
g.DrawLine(Pens.Red, i, j, i+1, j);
else if (calc1 > 1)
g.DrawLine(Pens.Yellow, i, j, i, j+1);
else
g.DrawLine(Pens.Navy, i, j, i+1, j);
}
}
The data points for the fitness function ab mod 5 are shown in listing 2a. The first 2 numbers in each triple set are a and b respectively. The last number is the resulting value of the equation ab mod 5.
Comparing the above pieces of artwork done by Micheal Gold, I would rate the most recent one the highest because I believe it has more varity and color combinations than the rest. The more complicated the equation or formula maybe, the better output it will have, even though it may take much longer to process. The final picture also has the best effect than the others as it creates a flow of colors and lines.
References: Micheal Site, Wikipedia
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home