Iteration Progress Report -- January 21
Austin Rachlin
Pd. 1 Latimer
January 21
PLAN
-
Goal for this iteration
- My major goal is to complete as much of the GA as possible.
-
Expected outcomes for this iteration
- To complete as many of the above tasks as possible.
DESIGN
-
Design for this iteration
- To complete the Genetic Algorithm, do my poster, and make sure that everything is in order for the second semester. Also, if I can, I may begin the graphical output.
-
"High-level" pseudo-code
- Nothing at the moment. My first focus is on other aspects of the project.
CODE
-
Coding for this iteration
- I finished the GA:
import java.util.Random;
/**
* @author arachlin
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
//Global Variables needed
//Matrix of all rules
//Reassign values after roulette wheel
//Matrix of rules selected by roulette wheel
//What type of breeding:
//One-Point Crossover
//int breeding_choice=1;
//Two-Point Crossover
int breeding_choice=2;
//One-to-one
//int breeding_choice=3;
class rule
{
int[] array = new int[128];
int val;
}
public class GA
{
public static Random rand;
static { rand = new java.util.Random();}
public static void main(rule Rule)
{
int tot=0;
rule[] tempRule = new rule[100];
rule[] tempRule2 = new rule[100];
EvalArray(Rule, tot);
Roulette(Rule, tempRule, tempRule2, tot);
for (int i=0; i<100; i++)
{
Mutation(tempRule2[i]);
}
}
//Evaluate the quality of each rule (already done in CA)
//Evaluate the total quality
//Re-evaluate qualities as a proportion of total
public static void EvalArray(rule Rule, int& tot)
{
for (int i=0; i<128; i++)
{
tot+=Rule[i].val;
}
}
//Roulette Wheel
//Use the evaluated quality to assign portions of the wheel
//Random number generator
//Store chosen rules in matrix
public static void Roulette(rule Rule, rule tempRule, rule tempRule2, int tot)
{
int[] rnd = new int[100];
for (int c=0; c<100; c++)
{
rnd[c]=rand()%tot;
}
for (int j=0; j<100; j++)
{
int temp=0;
int i=0;
do
{
temp+=Rule[i].val;
if (temp > rnd[i] || temp == rnd[i])
{
tempRule[j]=Rule[i];
}
i++;
}while (i<100 && temp=one)
{
var1=j;
}
if (tempTot>=two)
{
var2=j;
}
}
Breeding(Rule[var1], Rule[var2], tempRule2, i);
}
}
//Breeding
public static void Breeding(int[] Rule1, int[] Rule2, rule tempRule, n)
{
switch(breeding_choice)
{
case 1:
One_Point_Crossover(Rule1, Rule2, tempRule, n)
break;
case 2:
Two_Point_Crossover(Rule1, Rule2, tempRule, n)
break;
case 3:
One_to_One(Rule1, Rule2, tempRule, n)
break;
}
}
//Crossover
//One-Point
public static void One_Point_Crossover(int[] Rule1, int[] Rule2, rule tempRule, n)
{
int[] t=new array[128];
int point=rand()%128;
for (int i=0; i<128; i++)
{
if (i
-
Testing for success
- Success can be tested by whether the output works.
-
Coding standards
- I am coding in Java and OpenGL.
TESTING
-
Success checks
- GA completion
- Poster completion
- Working program code
- Daily and weekly logs completed
- Iteration progress reports completion
- Streamlined and thorough website
- Beginning of graphical output.