Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The integer example gives an error #1

Open
dicotom opened this issue Sep 23, 2024 · 3 comments
Open

The integer example gives an error #1

dicotom opened this issue Sep 23, 2024 · 3 comments

Comments

@dicotom
Copy link

dicotom commented Sep 23, 2024

Set: Average time of function evaluating (secs): 9.984970092773438e-06 (total = 0.0009984970092773438)

Best score before optimization: 3.0

____________________ 1.1% GA is running...1 gen from 90...best value = 3.0Traceback (most recent call last):
File "N:/DOWNLOADS/Roi Polanitzer GIT HUB LOTTERY FILES/LOTTERY PREDICTIONS/lotto_genetic_algorithm-main/example2.py", line 13, in
model.run(function=f)
File "C:\Python312\Lib\site-packages\geneticalgorithm2\geneticalgorithm2.py", line 1056, in run
ch2 = self.mut_middle(ch2, pvar1, pvar2)
File "C:\Python312\Lib\site-packages\geneticalgorithm2\geneticalgorithm2.py", line 1186, in mut_middle
x[i] = random.randint(v2, v1)
File "C:\Python312\Lib\random.py", line 336, in randint
return self.randrange(a, b+1)
File "C:\Python312\Lib\random.py", line 301, in randrange
istart = _index(start)
TypeError: 'numpy.float64' object cannot be interpreted as an integer

@NatanLifshitz
Copy link

This used to work, looks like something changed in python itself to cause this.

@NatanLifshitz
Copy link

Yep, this part of the library no longer works as of Python 3.12
https://docs.python.org/3/whatsnew/3.12.html#:~:text=gh%2D91760.)-,Remove,-randrange()%20functionality

@NatanLifshitz
Copy link

Thanks python/cpython#92677

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants