Possibility of passing iteration number to objective function #52
Replies: 2 comments 1 reply
-
Perhaps a more general solution would be helpful to more people while being equal effort to implement: |
Beta Was this translation helpful? Give feedback.
-
This should be doable but I am wondering if it isn't easier to implement by having the evaluate() method as part of a class, so that one can keep track of the number of calls using an instance attribute. There is no restriction that the evaluate() is outside of a class scope, so one can definitely play with that. I'm not opposed to the suggestion, but I would like to:
|
Beta Was this translation helpful? Give feedback.
-
I am parallelizing an optimization where the objective function in its current form keps track of the iteration number in order to use it in filenames and excel-rows because the whole process of optimization should be understandable to the engineers that work with the data.
The cleanest way to preserve this structure would be if the objective function could receive its iteration number, since the algorithm seems to already keep track of this information, while my own code would have to implement this logic using multiprocessing-shared-resources. I would be willing to create a patch for this if we can find a solution that fits the design principles of this library.
My idea for doing this that I believe preserves backwards-compatibility:
-add a default-false parameter to rbfOptions 'pass_iter_count' to let client-code indicate its objective function can handle the information
-have the algorithm always pass its iteration count to objfun
-have the RBFBlackBox-evaluate-method take an optional keyword-arg 'itercount'
-have objfun evaluate the blackbox either as blackbox.evaluate(point) or blackbox.evaluate(point, itercount=itercount) depending on the settings of the blackbox
Beta Was this translation helpful? Give feedback.
All reactions