numericalalgorithmsgroup/pybobyqa

ValueError: g contains Nan/Inf values

chMoussa opened this issue · 1 comments

Hello,

I was trying pyBOBYQA on a bounded noisy problem. I installed it a Python 3.8 environment and installing trustregion with pip.

I set the following parameters:

  • objfun_has_noise=True
  • maxfun is set at 10000,
  • user_params is untouched.

But I get the following error ValueError:

File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/pybobyqa/solver.py", line 809, in solve
    solve_main(objfun, x0, args, xl, xu, npt, rhobeg, rhoend, maxfun, nruns, nf, nx, nsamples, params,
  File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/pybobyqa/solver.py", line 212, in solve_main
    exit_info = control.soft_restart(number_of_samples, nruns_so_far, params,
  File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/pybobyqa/controller.py", line 524, in soft_restart
    exit_info = self.geometry_step(knew, self.delta, number_of_samples, params)
  File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/pybobyqa/controller.py", line 281, in geometry_step
    xnew = trsbox_geometry(self.model.xopt(), c, g, H, self.model.sl, self.model.su, adelt)
  File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/pybobyqa/trust_region.py", line 392, in trsbox_geometry
    smin, gmin, crvmin = trsbox(xbase, g, H, lower, upper, Delta, use_fortran=use_fortran)  # minimise L(x)
  File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/pybobyqa/trust_region.py", line 64, in trsbox
    return trustregion.solve(g, H, delta,
  File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/trustregion/interface.py", line 55, in solve
    g = _to_array(g, 'g')
  File "/home/charles/anaconda3/envs/cirq/lib/python3.8/site-packages/trustregion/interface.py", line 16, in _to_array
    raise ValueError('%s contains Nan/Inf values' % lbl)
ValueError: g contains Nan/Inf values

Thanks for picking this up! This is coming from an error in Py-BOBYQA's construction of an approximation to the objective function. I need to add some more error handling to this section.