An implementation of
representation-dependent gene level operations for
genetic algorithms with genes representing permutations:
Initialization of genes, mutation, and crossover.
The crossover operation provided is position-based crossover
(Syswerda, G., Chap. 21 in Davis, L. (1991, ISBN:0-442-00173-8).
For mutation, several variants are included: Order-based mutation
(Syswerda, G., Chap. 21 in Davis, L. (1991, ISBN:0-442-00173-8),
randomized Lin-Kernighan heuristics
(Croes, G. A. (1958)
# The R script xegaPermGene.R
The directory xegaPermGene contains the implementation
of the functions of the gene layer of genes with
a permutation representation of
a genetic algorithm.
At the moment, the package contains code for generating
problem environments for travelling salesman problems (TSPs).
These environments provide some useful heuristics:
greedy, kBestGreedy, rnd2Opt, LinKernighan.
The easiest installation is by using install.packages from R.
1. Linux:
Start R in the directory where you have stored xegaPermGene_0.0.0.1.tar.gz
> install.packages("xegaPermGene_0.0.0.1.tar.gz")
1. Windows:
Start R in the directory where you have stored xegaPermGene_0.0.0.1.zip
> install.packages("xegaPermGene_0.0.0.1.zip")
The R script xegaPermGene.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 sgaGene.R:
path<-"~/dev/iaa/genetic/xega/"
pName<-"xegaPermGene"
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("xegaPermGene.R")
Note that the package xegaPermGene provides the functions
of the gene layer of genes with a permutation representation for
the genetic algorithm sgPerm of the family sgX.
Use the pdf-Manual!
2. Adapt the path in xegaPermGene.R and install the library xegaPermGene:
Rscript xegaPermGene.R
Restart R and
library(xegaPermGene)
You get all elements of the package by
xegaPermGene::
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.