Difference between revisions of "Zombie Panda Breeders"

From CDOT Wiki
Jump to: navigation, search
(RSA Key Generator)
Line 46: Line 46:
 
carry = 0;
 
carry = 0;
 
}
 
}
 +
}
 +
}
 +
</pre></big>
 +
 +
 +
=== <u>Mutation Simulator</u> ===
 +
 +
 +
Attempted by: Zack Bloom
 +
 +
 +
This is a project I had made on my own. It is a simple mutation simulator.
 +
 +
This type of project gets used in genetic algorithms, and can be considered a primitive engine of one.
 +
 +
The goal of a genetic algorithm is to find an observable optimum solution within a population by breeding over many generations.
 +
 +
The main difference between my Mutation Simulator and a genetic algorithm, is that my mutation simulator lacks a metric to judge the fitness of each offspring within a population.
 +
 +
 +
The general idea of how this works is with this diagram (minor differences can be found within my program)
 +
 +
[[Image:GA.png]]
 +
 +
These are the two methods I was planning to parallelize
 +
 +
<big><pre>
 +
void Offspring::mutate(float mutationChance)
 +
{
 +
for (int i = 0; i < amountOfGenes; i++){
 +
geneticMakeup[i].mutate(mutationChance);
 +
}
 +
}
 +
</pre></big>
 +
 +
 +
 +
OR
 +
 +
 +
 +
<big><pre>
 +
void Population::breed(int index, float mutationChance)
 +
{
 +
int aOrB;
 +
for (int i = 0; i < organisms[index]->amountOfGenes; i++)
 +
{
 +
aOrB = rand() % 2;
 +
if (aOrB == 0)//
 +
organisms[index+1]->geneticMakeup[i] = organisms[index]->geneticMakeup[i];
 +
else //
 +
organisms[index]->geneticMakeup[i] = organisms[index+1]->geneticMakeup[i];
 +
organisms[index]->mutate(mutationChance);
 +
organisms[index+1]->mutate(mutationChance);
 
}
 
}
 
}
 
}
 
</pre></big>
 
</pre></big>

Revision as of 18:50, 4 October 2012

Welcome to the team page for Zombie Panda Breeders.

We are a team focused on parallelizing C/C++ applications using CUDA for the Parallel Programming course (GPU610/DPS915) at Seneca for the Fall 2012 semester.


The team consists of:

Andrei Kopytov

Zack Bloom

Assignment 1

RSA Key Generator

Attempted by: Andrei Kopytov

This is an open source project hosted on code.google.com. The source was written from scratch in C++ to implement RSA encryption.

It currently supports prime number generation, key generation and encryption/decryption of files or strings.

The project can be found here: http://code.google.com/p/rsa/

My goal for this project will be to parallelize the longMultiply() function inside the BigInt class.

/* Multiplies two unsigned char[] the long way. */
void BigInt::longMultiply(unsigned char *a, unsigned long int na, unsigned char *b, unsigned long int nb, unsigned char *result)
{
	std::fill_n(result, na + nb, 0);
	unsigned char mult(0);
	int carry(0);
	
	for (unsigned long int i(0L); i < na; i++)
	{
		for (unsigned long int j(0L); j < nb; j++)
		{
			mult = a[i] * b[j] + result[i + j] + carry;
			result[i + j] = static_cast<int>(mult) % 10;
			carry = static_cast<int>(mult) / 10;
		}
		if (carry)
		{
			result[i + nb] += carry;
			carry = 0;
		}
	}
}


Mutation Simulator

Attempted by: Zack Bloom


This is a project I had made on my own. It is a simple mutation simulator.

This type of project gets used in genetic algorithms, and can be considered a primitive engine of one.

The goal of a genetic algorithm is to find an observable optimum solution within a population by breeding over many generations.

The main difference between my Mutation Simulator and a genetic algorithm, is that my mutation simulator lacks a metric to judge the fitness of each offspring within a population.


The general idea of how this works is with this diagram (minor differences can be found within my program)

GA.png

These are the two methods I was planning to parallelize

void Offspring::mutate(float mutationChance)
{
	for (int i = 0; i < amountOfGenes; i++){
		geneticMakeup[i].mutate(mutationChance);
	}
}


OR


void Population::breed(int index, float mutationChance)
{
	int aOrB;
	for (int i = 0; i < organisms[index]->amountOfGenes; i++)
	{
		aOrB = rand() % 2;
		if (aOrB == 0)//
			organisms[index+1]->geneticMakeup[i] = organisms[index]->geneticMakeup[i];
		else //
			organisms[index]->geneticMakeup[i] = organisms[index+1]->geneticMakeup[i];
		organisms[index]->mutate(mutationChance);
		organisms[index+1]->mutate(mutationChance);
	}
}