如何最大程度地相对于某些x



我想对p1_current最大化以下功能,我该怎么做?

pwin_1 + Q1[p1_current, p2_current] - p1_current

作为背景,我从随机价格开始,定义获胜的可能性,并设置一个矩阵:

p2_current = random.randint(0,6)
if p1_current < p2_current:
  pwin_1 = (0.5)*pwin_1 + 0.5
elif p1_current >= p2_current:
  pwin_1 = (0.5)*pwin_1
Q1 = np.array(np.zeros([7,7]))
Q1 = Q1.astype(int)

我对如何执行此操作感到非常困惑,任何帮助将不胜感激!

为此使用minima和maxima。为了获得Python中的功能导数,如图所示

查找导数的代码您也可以使用num py diff函数。

最新更新