This is my definition of constructor
list_of_float_or_int = List[Union[float, int]]
type_constraints = List[Tuple[Union[int, float, None], Union[float, int, None]]]
@jitclass(spec=[
('lb', types.ListType(types.UnionType((types.int64, types.float64)))),
('ub', types.ListType(types.UnionType((types.int64, types.float64)))),
('constraints', types.ListType(
types.ListType(
types.UnionType(
(types.int64, types.float64, types.none)
)
)
)
),
('penalty_parameter', types.int64),
('current_iteration', types.int64),
('wolf_pack_size', types.int64),
('num_of_iterations', types.int64),
# ('constraints_func', types.ListType(types.Function)),
# ('objective_func', types.Function),
])
class GreyWolfOptimizer(object):
def __init__(
self,
wolf_pack_size: int, num_of_iterations: int, num_of_params: int, objective_func: Callable,
ub: list_of_float_or_int,
lb: list_of_float_or_int,
constraints_func: List[Callable],
constraints: type_constraints,
comparator: Callable,
dtype: Type[Union[float, int]] = float,
dtypes: List[Type[Union[float, int]]] = None
):
but when i try to run it I get
- argument 3: Cannot determine Numba type of <class 'function'>
- argument 6: Cannot type list element type <class 'function'>
- argument 8: Cannot determine Numba type of <class 'function'>
- argument 9: Cannot determine Numba type of <class 'type'>
- argument 10: Cannot type list element type <class 'type'>
which makes sense since numba doesn’t know about function
is there a way to solve this?