NewEnvXOR {xega} | R Documentation |
Generate the problem environment EnvXOR
Description
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 word a word of the language (as text string).
Should be provided by the user as standard R-file.
Usage
NewEnvXOR()
Value
The problem environment:
-
$name
: The name of the problem environment. -
$f
: The fitness function. For this environment number of correct test cases (correct function) and the inverse of the number of terminal symbols (boolean function with small number of elements).
See Also
Other Problem Environment:
Parabola2DEarly
,
Parabola2D
,
lau15
Examples
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)