[RBFOpt] Passing additional arguments into RBFOpt objective function

Giacomo Nannicini giacomo.n at gmail.com
Wed Sep 23 20:14:46 EDT 2020


You cannot specify additional arguments, but you can easily create an
object with a method that accepts only one argument and calls the
original function with the additional argument(s).
For example:

class Wrapper:
  def __init__(self, arg):
    self.arg = arg

  def obj_function_for_rbfopt(self, x):
     return original_function(x, self.arg)


----


You can then create an object A of this class and use
A.obj_function_for_rbfopt as your objective function.

On Wed, Sep 23, 2020 at 7:53 PM Gupta, Sachin <ssg6 at njit.edu> wrote:
>
> Hello,
>
> I am becoming familiar with using RBFOpt and have a question about passing additional arguments into the objective function. I would like to pass arguments to the objective function that are not being varied for the optimization but are necessary to execute the simulation and return the objective value (similar to the problem described here, which is solved with scipy's args input). These additional arguments may be objects from other libraries. Is there a way to successfully pass these arguments without them being part of the decision variables?
>
> Best regards,
> Sachin Gupta
> New Jersey Institute of Technology
> _______________________________________________
> RBFOpt mailing list
> RBFOpt at list.coin-or.org
> https://list.coin-or.org/mailman/listinfo/rbfopt



More information about the RBFOpt mailing list