Passing gene_type=int in the GA class constructor, will result in internal numpy arrays holding 64-bit integer values. This is well known to numpy users:
>>> type(numpy.array([1], dtype=int)[0])
<class 'numpy.int64'>
This, however, has two major problems:
- It contradicts the fact that Python ints are arbitrary precision integers
- It prohibits users from using pygad to explore bigger state-spaces (e.g. bit-vectors of 256-bits, or even larger in my case)
To solve this problem, a one-liner fix is to add object in GA.supported_int_types here. Then, users can pass gene_type=object in the GA constructor and handle Python integers in objective functions without worrying about numpy getting in their way.
Reactions are currently unavailable
Passing gene_type=int in the GA class constructor, will result in internal numpy arrays holding 64-bit integer values. This is well known to numpy users:
This, however, has two major problems:
To solve this problem, a one-liner fix is to add object in GA.supported_int_types here. Then, users can pass gene_type=object in the GA constructor and handle Python integers in objective functions without worrying about numpy getting in their way.