class documentation
class NeutralVariables(ComposedFunction):
Constructor: NeutralVariables(f, indices, values)
Overwrite some variables with some given fixed values,
thereby removing their effect on the resulting composed function, making them a neutral subspace.
The constructor takes indices and values. Then, x[indices] = values is executed (on a copy) each time before the function is called.
An instance call returns f(self.transform(x)).
Caveat: this has never been thoroughly tested.
>>> from cma import fitness_transformations as ft >>> fun = ft.NeutralVariables(cma.ff.sphere, [2, 3], 0) >>> 1**2 + 2**2 == fun([1,2,3,4]) True
| Method | __init__ |
return f with neutral subspace indices |
| Method | transform |
copy x and set x[indices] = values and return x. |
| Instance Variable | _indices |
Undocumented |
| Instance Variable | _values |
Undocumented |
Inherited from ComposedFunction:
| Method | __call__ |
Undocumented |
| Method | inverse |
evaluate the composition of inverses on x. |
| Instance Variable | list |
Undocumented |
Inherited from Function (via ComposedFunction):
| Method | initialize |
initialization of Function |
| Instance Variable | evaluations |
Undocumented |
| Instance Variable | ftarget |
Undocumented |
| Instance Variable | target |
Undocumented |
| Property | function |
attributes which are searched for to be called if no function was given to __init__. |
| Class Variable | _function |
Undocumented |
| Instance Variable | __callable |
Undocumented |
| Instance Variable | __initialized |
Undocumented |