class documentation
class IntegerMixedFunction2(ComposedFunction):
Constructor: IntegerMixedFunction2(function, integer_variable_indices, operator, copy)
compose fitness function with some integer variables using np.round by default.
>>> import numpy as np >>> import cma >>> f = cma.s.ft.IntegerMixedFunction2(cma.ff.elli, [0, 3, 5]) >>> assert f([-0.2, 2]) == f([0.4, 2]) != f([0.8, 2]) >>> f = cma.s.ft.IntegerMixedFunction2(cma.ff.elli, [0]) >>> assert f([-0.2, 2]) == f(np.array([0.4, 2])) != f(np.array([0.8, 2]))
Related: Option 'integer_variables' of cma.CMAOptions sets
'minstd' of integer variables, see
cma.options_parameters.integer_std_lower_bound and rounds the better
solutions, see cma.integer_centering.
| Method | __init__ |
apply operator(x[i]) for i in integer_variable_indices before to call function(x). |
| Instance Variable | copy |
Undocumented |
| Instance Variable | integer |
Undocumented |
| Instance Variable | operator |
Undocumented |
| Method | _flatten |
Undocumented |
| Method | _flatten2 |
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 |
apply operator(x[i]) for i in integer_variable_indices before to call function(x).
If copy, return a copy iff a value is changed.