Module cma :: Class FFWrapper :: Class TransformSearchSpace
[hide private]
[frames] | no frames]

Class TransformSearchSpace

source code

                     object --+    
                              |    
FFWrapper.FitnessTransformation --+
                                  |
                                 FFWrapper.TransformSearchSpace
Known Subclasses:

f = TransformSearchSpace(f, ConstRandnShift())

constructs the composed function f <- f o shift.

Details: to some extend this is a nice shortcut for:

f = lambda x, *args: f_in(ConstRandnShift()(x), *args)

however the lambda definition depends on the value of f_in even after f has been assigned.

See: ShiftedFitness, RotatedFitness

Instance Methods [hide private]
 
__init__(self, fitness_function, transformation)
TransformSearchSpace(f, s)(x) == f(s(x))
source code

Inherited from FitnessTransformation: __call__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, fitness_function, transformation)
(Constructor)

source code 

TransformSearchSpace(f, s)(x) == f(s(x))

>>> import cma
>>> f0 = lambda x: sum(x)
>>> shift_fct = cma.ConstRandnShift()
>>> f = cma.FF2.TransformSearchSpace(f0, shift_fct)
>>> x = [1, 2, 3]
>>> assert f(x) == f0(shift_fct(x))
Overrides: object.__init__