| NewEnvXOR | R Documentation |
NewEnvXOR() generates the problem environment
for the XOR-Problem.
The problem environment provides an abstract interface
to the simple genetic programming algorithm.
ProblemEnv$f(parm) defines the function we want to optimize.
A problem environment is a function factory with the following elements:
name(): A string with the name of the environment.
ProblemEnv$f(word):
Function with the word a word of the language (as a text string).
Should be provided by the user as a standard R-file.
NewEnvXOR()
The problem environment:
$name: The name of the problem environment.
$f: The fitness function.
For this environment,
fitness is defined as the number of correct test cases
(correct function)
and the inverse of the number of terminal symbols.
The second part means that
a boolean function with a fewer number of variables
and logical functions is fitter than one with more
variables and logical functions if both solve
the same number of test cases.
Other Problem Environment:
Parabola2D,
Parabola2DEarly,
lau15
EnvXOR<-NewEnvXOR()
EnvXOR$name()
a2<-"OR(OR(D1, D2), (AND(NOT(D1), NOT(D2))))"
a3<-"OR(OR(D1, D2), AND(D1, D2))"
a4<-"AND(OR(D1,D2),NOT(AND(D1,D2)))"
gp4<-"(AND(AND(OR(D2,D1),NOT(AND(D1,D2))),(OR(D2,D1))))"
EnvXOR$f(a2)
EnvXOR$f(a3)
EnvXOR$f(a4)
EnvXOR$f(gp4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.