scipy BASINHOP接受测试:什么是新的和旧的

2024-05-19 17:03:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用模拟退火优化天线布置和定向问题。我相信白杨会做我需要的,但我不明白接受测试函数中f_new和f_old的含义。我在文档中没有看到解释。如果有人能告诉我这些夸克的含义那就太好了。我感到困惑的是:

 accept_test : callable, accept_test(f_new=f_new, x_new=x_new, f_old=fold, x_old=x_old), optional

谢谢你

兰加


Tags: 文档testnewfold测试函数optionalold天线
1条回答
网友
1楼 · 发布于 2024-05-19 17:03:36

从文档https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.basinhopping.html#scipy-optimize-basinhopping

accept_test : callable, ``accept_test(f_new=f_new, x_new=x_new, f_old=fold, x_old=x_old)``, optional
    Define a test which will be used to judge whether or not to accept the
    step.  This will be used in addition to the Metropolis test based on
    "temperature" ``T``.  The acceptable return values are True,
    False, or ``"force accept"``. If any of the tests return False
    then the step is rejected. If the latter, then this will override any
    other tests in order to accept the step. This can be used, for example,
    to forcefully escape from a local minimum that ``basinhopping`` is
    trapped in.

您可以从中收集的信息是调用参数a

  1. a是可调用的,因此可以提供一个函数。在
  2. a在进化算法的决策中起作用。可能的返回值为True和False,它们与Metropolis条件(即,对于要接受的步骤,这两个条件必须返回True)和“force accept”。如果您想在大都会拒绝的情况下强制接受,则必须使用后一个选项。在
  3. {{cd6}和当前的cd6}值不能在步骤中使用。在

下面,我建立了一个玩具示例,其中accept_test函数在参数空间中的步骤向右时强制接受

^{pr2}$

相关问题 更多 >