class documentation

class FBoundTransform(ComposedFunction):

View In Hierarchy

shortcut for ComposedFunction([f, BoundTransform(bounds).transform]), see also below.

Maps the argument into bounded or half-bounded (feasible) domain before evaluating f.

Example with lower bound at 0, which becomes the image of -0.05 in BoundTransform.transform:

>>> import cma, numpy as np
>>> f = cma.fitness_transformations.FBoundTransform(cma.ff.elli,
...                                                 [[0], None])
>>> assert all(f[1](np.random.randn(200)) >= 0)
>>> assert all(f[1]([-0.05, -0.05]) == 0)
>>> assert f([-0.05, -0.05]) == 0

A slightly more verbose version to implement the lower bound at zero in the very same way:

>>> import cma
>>> felli_in_bound = cma.s.ft.ComposedFunction(
...    [cma.ff.elli, cma.BoundTransform([[0], None]).transform])
Method __init__ bounds[0] are lower bounds, bounds[1] are upper bounds
Instance Variable bound_tf Undocumented

Inherited from ComposedFunction:

Method __call__ Undocumented
Method inverse evaluate the composition of inverses on x.
Instance Variable list_of_inverses Undocumented

Inherited from Function (via ComposedFunction):

Method initialize initialization of Function
Instance Variable evaluations Undocumented
Instance Variable ftarget Undocumented
Instance Variable target_hit_at Undocumented
Property function_names_to_evaluate_first_found attributes which are searched for to be called if no function was given to __init__.
Class Variable _function_names_to_evaluate_first_found Undocumented
Instance Variable __callable Undocumented
Instance Variable __initialized Undocumented
def __init__(self, fitness_function, bounds):

bounds[0] are lower bounds, bounds[1] are upper bounds

bound_tf =

Undocumented