Genetic Operations for Grammar-Based Genetic Programming

An implementation of the representation-dependent gene level operations of grammar-based genetic programming with genes which are derivation trees of a context-free grammar: Initialization of a gene with a complete random derivation tree, decoding of a derivation tree. Crossover is implemented by exchanging subtrees. Depth-bounds for the minimal and the maximal depth of the roots of the subtrees exchanged by crossover can be set. Mutation is implemented by replacing a subtree by a random subtree. The depth of the random subtree and the insertion node are configurable. For details, see Geyer-Schulz (1997, ISBN:978-3-7908-0830-X).


# The R script xegaGpGene.R

The directory xegaGpGene contains the implementation 
of the functions of the gene layer of with derivation trees
of a context free grammar as genes for  
a genetic algorithm. 

The easiest installation is by using install.packages from R.

1. Linux:
Start R in the directory where you have stored xegaGpGene_0.0.1.0.tar.gz

> install.packages("xegaGpGene_0.0.1.0.tar.gz")

1. Windows:
Start R in the directory where you have stored xegaGpGene_0.0.1.0.zip

> install.packages("xegaGpGene_0.0.1.0.zip")

The R script xegaGpGene.R generates

1. the man pages of the package.
2. the pdf documentation of the package.
3. the compilation and installation of the package.
   (You  must adapt the variables path and pName
    in the script xegaGpGene.R:

    path<-"~/dev/iaa/genetic/xega/"
    pName<-"xegaGpGene"

    to the directory where you copy the package.)

You need to install the R-package devtools for this R script.

There are two ways to use the code:

1. Change into the R directory which contains the code, start R and load all code files:

source("xegaGpGene.R")

Note that the package xegaGpGene provides the functions
of the gene layer of derivation-tree coded genes
the genetic algorithm sga of the family sgX.

Use the pdf-Manual! 

2. Adapt the path in xegaGpGene.R and install the library xegaGpGene:

Rscript xegaGpGene.R

Restart R and

library(xegaGpGene)

You get all elements of the package by

xegaGpGene::

and pressing the tabulator.

You get the man page by e.g 

?InitGene

or 

help(InitGene)

All examples given on a man page can be executed by

example(InitGene)

Note that man pages and examples are only available, if you install 
the package as a library.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("xegaGpGene")

1.0.0.3 by Andreas Geyer-Schulz, a year ago


https://github.com/ageyerschulz/xegaGpGene


Browse source code at https://github.com/cran/xegaGpGene


Authors: Andreas Geyer-Schulz [aut, cre] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports stats, xegaBNF, xegaDerivationTrees, xegaSelectGene

Suggests testthat


Imported by xega.


See at CRAN