coin-or / rbfopt

RBFOpt library for black-box optimization
Other
188 stars 33 forks source link

TypeError at end of iterations #37

Closed bragostin closed 3 years ago

bragostin commented 3 years ago

First thank you for providing this package to solve these difficult optimization problems! I get the following error message at the end (I think) of iterations:

Traceback (most recent call last):
  File "HTC_Steady.py", line 1733, in <module>
    objval, x, itercount, evalcount, fast_evalcount = alg.optimize()
  File "/home/chbrago/.conda/envs/cadquery/lib/python3.7/site-packages/rbfopt/rbfopt_algorithm.py", line 808, in optimize
    self.optimize_serial(pause_after_iters)
  File "/home/chbrago/.conda/envs/cadquery/lib/python3.7/site-packages/rbfopt/rbfopt_algorithm.py", line 862, in optimize_serial
    self.restart()
  File "/home/chbrago/.conda/envs/cadquery/lib/python3.7/site-packages/rbfopt/rbfopt_algorithm.py", line 1977, in restart
    self.update_log('Initialization', self.node_is_noisy[i], val, gap)
  File "/home/chbrago/.conda/envs/cadquery/lib/python3.7/site-packages/rbfopt/rbfopt_algorithm.py", line 537, in update_log
    ' {:8.2f}'.format(gap*100) +
TypeError: unsupported format string passed to numpy.ndarray.__format__

Any idea what may cause it? I printed the values of the variables involved in this line:

gap =  [1.]
self.best_gap_shown =  inf
obj_value =  [74.12607681]
self.fbest =  [23.86276007]

Might it come from the inf?

bragostin commented 3 years ago

My mistake: my residual was not a float but a [float]. Problem solved.

gnannicini commented 3 years ago

Happy this was a false alarm :-)