Lor*_*ins 6 python mathematical-optimization scipy
我有一个要优化的函数,我无法从中得到导数或 Hessian 或 Jacobian(因此标题中的“黑匣子”)。假设我的函数如下所示:
def my_fun(some_int, some_other_int, some_string):
return float(some_int + some_other_int + len(some_string))
Run Code Online (Sandbox Code Playgroud)
请注意,我仅执行强制转换以表明该函数返回浮点数。
搜索空间/约束/边界(或者无论您如何称呼它)将是:
some_int = [1..10] # int interval
some_other_int = [1, 2, 3] # int discrete
some_string = ["methodA", "methodB", "methodC"] #discrete
Run Code Online (Sandbox Code Playgroud)
我应该如何用Python表达这个问题?这是我迄今为止搜索过的内容:
有什么想法吗?