| Interface | Description |
|---|---|
| Op<T> |
Operation interface.
|
| Class | Description |
|---|---|
| Const<T> |
Represents an operation which always returns the same, constant, value.
|
| EphemeralConst<T> |
Implementation of an ephemeral constant.
|
| Program<T> |
This class composes a given operation tree to a new operation.
|
| Var<T> |
Represents the program variables.
|
| Enum | Description |
|---|---|
| MathOp |
This class contains operations for performing basic numeric operations.
|
ProgramGene or ProgramChromosome class. The
extension point for own programs is the Op interface.
public interface Op<T> {
public String name();
public int arity();
public T apply(T[] args);
}
final Op<Double> myop = Op.of("myop", 3, v -> v[0]*v[1] + v[2]);
NOTE: The class MathOp in the
defines a set of mathematical standard operations/functions.
ProgramChromosome we must
distinguish two different kind of operations:
Var,
Const and
EphemeralConst.
Var operation defines a variable of a program, which are set
from the program arguments.
final ISeq<Op<Double>> terminals = ISeq.of(
Var.of("x", 0), Var.of("y", 1), Var.of("z", 2)
);Const operation will always return the same, constant, value
when evaluated.
final Op<Double> one = Const.of(1.0);
final Op<Double> pi = Const.of("π", Math.PI);Supplier function the ephemeral constant is created
with.
final Op<Double> rand1 = EphemeralConst.of(Math::random);
final Op<Double> rand2 = EphemeralConst.of("R", Math::random);© 2007-2017 Franz Wilhelmstötter (2017-08-22 19:30)