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

Fix test function Rosenbrock #66

Open
beastraban opened this issue May 18, 2022 · 1 comment
Open

Fix test function Rosenbrock #66

beastraban opened this issue May 18, 2022 · 1 comment

Comments

@beastraban
Copy link

beastraban commented May 18, 2022

Experiment running with Rosenbrock function yields the following error message:

`Run experiment for 'RandomOptimisation' on function 'Rosenbrock'...
/home/dm/DarkMachines/high-dimensional-sampling/examples/random_optimisation.py:50: RuntimeWarning: invalid value encountered in add
x = x * (r[:, 1] - r[:, 0]) + r[:, 0]
/home/dm/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/functions.py:186: RuntimeWarning: invalid value encountered in less
if np.any(d < 0.0) or np.any(d > 1.0):
/home/dm/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/functions.py:186: RuntimeWarning: invalid value encountered in greater
if np.any(d < 0.0) or np.any(d > 1.0):
Traceback (most recent call last):

File ~/DarkMachines/high-dimensional-sampling/examples/random_optimisation.py:75 in
experiment.run(function, finish_line=1000)

File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:247 in run
self._perform_experiment(function, log_data)

File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:114 in _perform_experiment
self._event_new_samples(x, y)

File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:352 in _event_new_samples
self.best_x, self.best_y = self._find_minima(x, y, self.best_x,

File ~/anaconda3/envs/DarkMachine/lib/python3.8/site-packages/high_dimensional_sampling/experiments.py:317 in _find_minima
return x_candi[indices], y_candi[indices]

IndexError: arrays used as indices must be of integer (or boolean) type
`

For some reason I cannot debug anything in this project, :(

@beastraban
Copy link
Author

beastraban commented May 18, 2022

The problem seems to be in the ranges of the Rosenbrock function being defined as -inf,inf,
whereas the sampling procedure undergoes the following transformation:
'x=x*(r[:,1]-r[:,0])+r[:,0]'
in get_initial_position (line 50) in random_optimization.py

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

1 participant