class documentation

class IntegerMixedFunction(ComposedFunction):

View In Hierarchy

compose fitness function with some integer variables.

>>> import cma
>>> f = cma.s.ft.IntegerMixedFunction(cma.ff.elli, [0, 3, 6])
>>> assert f([0.2, 2]) == f([0.4, 2]) != f([1.2, 2])

It is advisable to set minstd of integer variables to 1 / (2 * len(integer_variable_indices) + 1), in which case in an independent model at least 33% (1 integer variable) -> 39% (many integer variables) of the solutions should have an integer mutation on average. Option integer_variables of cma.CMAOptions implements this simple measure.

Method __init__ apply operator(x[i]) for i in integer_variable_indices before to call function(x)
Instance Variable copy_arg Undocumented
Instance Variable integer_variable_indices Undocumented
Instance Variable operator Undocumented
Method _flatten 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, function, integer_variable_indices, operator=np.floor, copy_arg=True):

apply operator(x[i]) for i in integer_variable_indices before to call function(x)

copy_arg =

Undocumented

integer_variable_indices =

Undocumented

operator =

Undocumented

def _flatten(self, x):

Undocumented