[R] [R-pkgs] mcga 1.1 (machine coded genetic algorithms) package released

Mehmet Hakan Satman mhsatman at yahoo.com
Fri Dec 24 11:12:37 CET 2010


mcga 1.1 (machine coded genetic algorithms) package implements a genetic 
algorithm optimisation tool with machine coded chromosomes.
The machine coded chromosomes stand for chromosomes that are not decoded and 
encoded. The byte representation of 'double' type variables are crossed-over and 
mutated. This is different from the binary coded and real coded genetic 
algorithms. Linux and Windows versions are released but I think it will take a 
day for the Mac release on cran server.

Suppose that V1 ise a 'double' type C++ variable has a value of 3.141592. This 
variable has an image of 'sizeof(double)' bytes on the computer memory. And the 
V2 is an other 'double' type C++ variable  with some value. So,

V1 = b[1], b[2], b[3], ..., b[sizeof(double)]

is the byte representation of V1 where b[i] is a 'byte' variable with 256 
different values. (This means the alphabet of mcga is length of 256). Suppose  
that V2 is represented  as

V2 = a[1], a[2], a[3], ..., a[sizeof(double)]

where a[i] is same as b[i]. After a crossing-over operation a new offspring, say 
that, V3 comes into being:

V3 = a[1] or b[1], a[2] or b[2], ...., a[sizeof(double)] or b[sizeof(double)]

where V3 is totally a combination of V1 and V2 and can have values near to V1 
and V2 or near to average. This result is similar when compared to real valued 
chromosomes.

Increasing or decreasing a randomly selected byte of V3 stands for the mutation 
operator. In mcga, we randomly change a byte like this:

________________________________

void GA::Mutate(Chromosome *c1){
    char *cptr=(char *)c1->values;
    int mutatepoint=(rand() % (this->chsize * sizeof(double)));
    cptr+=mutatepoint;

        if(((float)rand()/RAND_MAX)<0.5){
            (*cptr)+=1;
        }else{
            (*cptr)-=1;
        }

}
________________________________
Changing a byte of a double value can make a small or extremely high difference. 
This is the mutation operator of mcga.


 This chromosome coding strategy has some advantages:

1) This is extremely fast when compared to binary coded ga's when the 
optimization function is real valued.
2) Parameters are not bounded by a narrow range. Each single parameter of the 
goal function can have values between the min(double) and the max(double) on the 
machine.
3) A large population can handle a bigger amount of the search space in a faster 
way, when compared to other encodings.

I know this is like 'genetic programming' but i think mcga only changes the 
encoding/decoding strategy, it is just a genetic algorithm. More simulations and 
comparisons should be done for measuring the performance. I am not sure whether 
this strategy was published anywhere before now. Comments and advices are 
welcome.

Regards.

Dr.Mehmet Hakan Satman
Istanbul University, Faculty of Economics, Department of Econometrcis
http://www.mhsatman.com


      
	[[alternative HTML version deleted]]

_______________________________________________
R-packages mailing list
R-packages at r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages



More information about the R-help mailing list