Ambrosys / glyph

a python 3 library based on deap providing abstraction layers for symbolic regression problems.
GNU Lesser General Public License v3.0
92 stars 16 forks source link

RuntimeError: generator raised StopIteration #67

Closed amorand007 closed 4 years ago

amorand007 commented 4 years ago

Hi I am learning to use this program, however, when running the lorenz.py example I get this error:

Traceback

File "C:\Users\81599\Documents\Python Scripts\Evolutionary Algorithms\Genetic Programming\Glyph\glyph-master\examples\control\control_problem.py", line 58, in odeint raise StopIteration

StopIteration

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File "C:\Users\81599\Documents\Python Scripts\Evolutionary Algorithms\Genetic Programming\Glyph\glyph-master\examples\control\lorenz.py", line 137, in main()

File "C:\Users\81599\Documents\Python Scripts\Evolutionary Algorithms\Genetic Programming\Glyph\glyph-master\examples\control\lorenz.py", line 77, in main app.run()

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\glyph\application.py", line 184, in run self.gp_runner.init(self.args.pop_size)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\glyph\application.py", line 79, in init self._update()

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\glyph\application.py", line 89, in _update self._evals = self.assessment_runner(self.population)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\glyph\assessment.py", line 56, in call for ind, fit in zip(invalid, fitnesses):

File "C:\Users\81599\Documents\Python Scripts\Evolutionary Algorithms\Genetic Programming\Glyph\glyph-master\examples\control\lorenz.py", line 46, in measure popt, rmse_opt = assessment.const_opt_leastsq(self.rmse, individual)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\deprecated\classic.py", line 241, in wrapperfunction return wrapped(*args, **kwargs)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\glyph\assessment.py", line 177, in const_opt_leastsq return const_opt(measure, individual, lsq=True, default_constants=default_constants, f_kwargs=f_kwargs, **kwargs)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\glyph\assessment.py", line 158, in const_opt res = opt(fun=closure, x0=p0, **kwargs)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\scipy\optimize_lsq\least_squares.py", line 881, in least_squares J0 = jac_wrapped(x0, f0)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\scipy\optimize_lsq\least_squares.py", line 875, in jac_wrapped kwargs=kwargs, sparsity=jac_sparsity)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\scipy\optimize_numdiff.py", line 384, in approx_derivative use_one_sided, method)

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\scipy\optimize_numdiff.py", line 454, in _dense_difference df = fun(x) - f0

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\scipy\optimize_numdiff.py", line 348, in fun_wrapped f = np.atleast_1d(fun(x, *args, **kwargs))

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\glyph\assessment.py", line 148, in closure return measure(individual, *consts, **f_kwargs)

File "C:\Users\81599\Documents\Python Scripts\Evolutionary Algorithms\Genetic Programming\Glyph\glyph-master\examples\control\lorenz.py", line 54, in rmse y = self.trajectory(individual, *f_args)

File "C:\Users\81599\Documents\Python Scripts\Evolutionary Algorithms\Genetic Programming\Glyph\glyph-master\examples\control\lorenz.py", line 62, in trajectory return control_problem.integrate(dy, yinit=self.yinit, x=self.x, f_args=f_args)

File "C:\Users\81599\Documents\Python Scripts\Evolutionary Algorithms\Genetic Programming\Glyph\glyph-master\examples\control\control_problem.py", line 25, in integrate y = np.vstack(res).T

File "<__array_function__ internals>", line 6, in vstack

File "C:\ProgramData\Anaconda3\envs\glyph\lib\site-packages\numpy\core\shape_base.py", line 280, in vstack arrs = atleast_2d(*tup)

RuntimeError: generator raised StopIteration

thanks in advance

Ohjeah commented 4 years ago

Thanks for the Bug report.

This should be fixed with #68. Can you please try again using the current master branch?