Monday, September 23, 2013
Idea Genetic System
On the two side of the grand canyon there are two different species of squirl. The Kaibab and the Abert. 5 million years ago they had the same ancestor. After the river created a canyon, the species could no longer get across to mix genes. Speciation occurred as a result of differing environmental conditions. What this means is that the squirls are now two distinct species that are incapable of interbreeding.
I aim to create a genetic system for modifying a series of physical size attributes in a 3d theoretical origin species. After running a fitness function to cull the population the remaining "successful" organisms will breed refill the population and repeat.
The fitness function is based on proximity to an individual whose phenotypes are perfectly proportioned to the phenotypes displayed at other points on the body.
I want to introduce a component of the breeding function that will cause the population to diverge if breeding partners are too far apart. At that point there are then two separate species following divergent evolutionary paths producing drastically different phenotypes
Genetic Algorithm Manipulation in Maya
//Genetic Algorithm structure
/*main()
AllocateMemory()
DoRun()
Spawn()
Loop()
PrintGeneration()
FitnessFunction()
KillOffLower50()
Breed()
SelectOrganism()
*/
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(){
int finalGeneration;
AllocateMemory();
finalGeneration = DoRun();
printf("The final generation was: %d\n", finalGeneration);
phenoOut();
}
#define GENE_POOL 100
#define GENE_COUNT 4
char **currentGen, **nextGen,; //globals
char *modelOrganism;
int *organismFitness;
void AllocateMemory(void){
int organism;
currentGen =
(char**)malloc(sizeof(char*) * GENE_POOL);
nextGen =
(char**)malloc(sizeof(char*) * GENE_POOL);
modelOrganism =
(char*)malloc(sizeof(char) * gene_count);
organismFitness =
(int*)malloc(sizeof(int) * GENE_POOL);
for(organism = 0; organism<GENE_POOL; ++organism){
currentGen[organism] =
(char*)malloc(sizeofchar) * GENE_COUNT);
nextGen[organism] =
(char*)malloc(sizeofchar) * GENE_COUNT);
}
}
#define FALSE 0
#define TRUE 1
int DoRun(void){
int generations=1;
int perfectGen = FALSE;
InitialOrganisms();
while(TRUE){
perfectGen = EvaluateOrganism();
if (perfectGen==TRUE ) return generations;
ProduceNextGen();
++generations;
}
}
#include <stdlib.h>
#define GENO 4
void InitializeOrganism(void){
int organism;
int gene;
//initialize the base organisms
for (organism=0; organism<GENE_POOL; ++organism){
for(gene=0 gene<GENE_COUNT; ++gene){
currentGen[organism][gene] = rand()%GENO;
}
}
//initialize the model organism
for(gene=0; gene<GENE_COUNT; ++gene){
modelOrganism[gene] = rand()%GENO
}
}
//FITNESS FUNCTION NEEDS TO BE DEFINED AS A COMPARISON OF GENES TO EACH OTHER: GENE1 +(-) GENE2 < 3 then ++genefitness
#define MAXIMUM_FITNESS NUMBER_GENES
int totalOfFitness;
int EvaluateOrganism(void){
int organism;
int gene;
int currentOrganismFitnessTally;
totalOfFitness = 0;
for (organism=0; organism<GENE_POOL; ++organism){
//tally up the organism's fitness
for (gene=0; gene<GENE_COUNT; ++gene){
if( currentGen[organism][gene] ==modelOrganism[gene]){
++currentOrganismFitnessTally;
}
}
//Save out the tally data
//add the tally score to generation score
organismFitness[organism] = currentOrganismFitnessTally;
totalOfFitness +=currentOrgansimFitnessTally;
//check if generation is perfect
if (currentOrganismsFitnessTally ==MAXIMUM_FITNESS){
return TRUE;
}
return FALSE;
}
}
#define MUTATION_RATE 0.001
void ProduceNextGen(void){
int organism;
int gene;
int parentOne;
int parenttwo;
int crossoverPoint;
int mutateThisGene;
//dill the nextGen data structure with the Children
for (organism=0;organism<GENE_POOL;++organism){
paretnOne = SelectOneOrganism();
parentTwo = SelectOneOrganism();
crossoverPoint = rand() %GENE_COUNT;
for(gene=0; gene<GENE_COUNT; ++gene;){
//copy over a single gene
mutateThisGene = rand() %(int)(1.0/MUTATUIN_RATE);
if(mutateThisGene == 0){
//This is the gene mutation is true condition
nextGen[organism][gene] = rand() %GENO;
}else{
//This is the true inheritance condition
nextGen[organism][gene] = (currentGen[parentOne][gene] + currentGen[parentTwo][gene])/2;
}
}
}
//copy the children, nextGen into the new currentGen
for (organism=0; organism<GENE_POOL; ++organism){
for(gene=0; gene<GENE_COUNT; ++gene;){
currentGen[organism][gene] = nextGen[organism][gene];
}
}
}
int SelectOneOrganism(void){
int organism;
int runningTotal;
int randomSelectPoint;
running Total = 0;
randomSelectPoint = rand() % (totalOfFitness + 1);
for(organism=0; organism<GENE_POOL; ++organism;){
runningTotal += organismFitness[organism];
if(runningTotal >= randomSelectPoint) return organism;
}
}
void PhenoOut(int x){
int organism;
ofstream pheno_out;
pheno_out.open ("pheno_out.txt");
for(organism=0;organism<GENE_POOL;++organism){
pheno_out << " Organism: ";
pheno_out << organism;
pheno_out << " Gene Head: ";
pheno_out << gene;
pheno_out << " Gene Body: ";
pheno_out << gene;
pheno_out << " Gene Front Legs: ";
pheno_out << gene;
pheno_out << " Gene Rear Legs: ";
}
pheno_close();
return 0;
}
/*main()
AllocateMemory()
DoRun()
Spawn()
Loop()
PrintGeneration()
FitnessFunction()
KillOffLower50()
Breed()
SelectOrganism()
*/
#include <stdio.h>
#include <iostream>
#include <fstream>
using namespace std;
int main(){
int finalGeneration;
AllocateMemory();
finalGeneration = DoRun();
printf("The final generation was: %d\n", finalGeneration);
phenoOut();
}
#define GENE_POOL 100
#define GENE_COUNT 4
char **currentGen, **nextGen,; //globals
char *modelOrganism;
int *organismFitness;
void AllocateMemory(void){
int organism;
currentGen =
(char**)malloc(sizeof(char*) * GENE_POOL);
nextGen =
(char**)malloc(sizeof(char*) * GENE_POOL);
modelOrganism =
(char*)malloc(sizeof(char) * gene_count);
organismFitness =
(int*)malloc(sizeof(int) * GENE_POOL);
for(organism = 0; organism<GENE_POOL; ++organism){
currentGen[organism] =
(char*)malloc(sizeofchar) * GENE_COUNT);
nextGen[organism] =
(char*)malloc(sizeofchar) * GENE_COUNT);
}
}
#define FALSE 0
#define TRUE 1
int DoRun(void){
int generations=1;
int perfectGen = FALSE;
InitialOrganisms();
while(TRUE){
perfectGen = EvaluateOrganism();
if (perfectGen==TRUE ) return generations;
ProduceNextGen();
++generations;
}
}
#include <stdlib.h>
#define GENO 4
void InitializeOrganism(void){
int organism;
int gene;
//initialize the base organisms
for (organism=0; organism<GENE_POOL; ++organism){
for(gene=0 gene<GENE_COUNT; ++gene){
currentGen[organism][gene] = rand()%GENO;
}
}
//initialize the model organism
for(gene=0; gene<GENE_COUNT; ++gene){
modelOrganism[gene] = rand()%GENO
}
}
//FITNESS FUNCTION NEEDS TO BE DEFINED AS A COMPARISON OF GENES TO EACH OTHER: GENE1 +(-) GENE2 < 3 then ++genefitness
#define MAXIMUM_FITNESS NUMBER_GENES
int totalOfFitness;
int EvaluateOrganism(void){
int organism;
int gene;
int currentOrganismFitnessTally;
totalOfFitness = 0;
for (organism=0; organism<GENE_POOL; ++organism){
//tally up the organism's fitness
for (gene=0; gene<GENE_COUNT; ++gene){
if( currentGen[organism][gene] ==modelOrganism[gene]){
++currentOrganismFitnessTally;
}
}
//Save out the tally data
//add the tally score to generation score
organismFitness[organism] = currentOrganismFitnessTally;
totalOfFitness +=currentOrgansimFitnessTally;
//check if generation is perfect
if (currentOrganismsFitnessTally ==MAXIMUM_FITNESS){
return TRUE;
}
return FALSE;
}
}
#define MUTATION_RATE 0.001
void ProduceNextGen(void){
int organism;
int gene;
int parentOne;
int parenttwo;
int crossoverPoint;
int mutateThisGene;
//dill the nextGen data structure with the Children
for (organism=0;organism<GENE_POOL;++organism){
paretnOne = SelectOneOrganism();
parentTwo = SelectOneOrganism();
crossoverPoint = rand() %GENE_COUNT;
for(gene=0; gene<GENE_COUNT; ++gene;){
//copy over a single gene
mutateThisGene = rand() %(int)(1.0/MUTATUIN_RATE);
if(mutateThisGene == 0){
//This is the gene mutation is true condition
nextGen[organism][gene] = rand() %GENO;
}else{
//This is the true inheritance condition
nextGen[organism][gene] = (currentGen[parentOne][gene] + currentGen[parentTwo][gene])/2;
}
}
}
//copy the children, nextGen into the new currentGen
for (organism=0; organism<GENE_POOL; ++organism){
for(gene=0; gene<GENE_COUNT; ++gene;){
currentGen[organism][gene] = nextGen[organism][gene];
}
}
}
int SelectOneOrganism(void){
int organism;
int runningTotal;
int randomSelectPoint;
running Total = 0;
randomSelectPoint = rand() % (totalOfFitness + 1);
for(organism=0; organism<GENE_POOL; ++organism;){
runningTotal += organismFitness[organism];
if(runningTotal >= randomSelectPoint) return organism;
}
}
void PhenoOut(int x){
int organism;
ofstream pheno_out;
pheno_out.open ("pheno_out.txt");
for(organism=0;organism<GENE_POOL;++organism){
pheno_out << " Organism: ";
pheno_out << organism;
pheno_out << " Gene Head: ";
pheno_out << gene;
pheno_out << " Gene Body: ";
pheno_out << gene;
pheno_out << " Gene Front Legs: ";
pheno_out << gene;
pheno_out << " Gene Rear Legs: ";
}
pheno_close();
return 0;
}
Monday, September 9, 2013
Generative Art Project 1
For this project I was interested in using a number of "plateau" objects to alter the flow of the Drip Painting.
Following the artistic process the paint would be poured over a replica human brain, a human hand replica, art tools and finally a shallow paint bucket. The changes to the flow of the paint are reminiscent to how a piece of art work become more than what comes from the mind of the artist. Each thing introduced to the artistic process will change the process. With the same tools and same prompt you and I will create different pieces, with different prompts my images would be completely different. There's no way to know what will happen once our ideas begin to drip from brain to paper.
For the hand I am thinking of making a tape cast of a hand and then covering it with a sculptable material such as Spackle
Subscribe to:
Comments (Atom)



