如何将Excel Solver与IF语句一起使用?

时间:2019-09-26 02:17:56

标签: excel solver

我有一张网球桌,在那里我计算出他们以三种不同方式赢得各自比赛的概率,例如之前的10场比赛所赢得的百分比,比赛中首先发球的百分比等。然后,我将这些预测的赔率与庄家可用来得出“优势”的实际赔率进行比较。积极的优势意味着庄家提供的赔率比他们应有的更好,并且下注具有“价值”。可能存在三种情况:

  1. 边缘> =边缘阈值,玩家赢了,然后我赢了100英镑x实际赔率
  2. 边缘> =边缘阈值,玩家输了然后我输了100英镑
  3. 边缘<边缘阈值,我不敢打赌,所以输赢都不会

我想算出这三种可能性与产生最高利润水平的边缘阈值的最佳组合。我试图使用Excel Solver来执行此操作,但是显然它不能应付IF语句。我已经在一些地方阅读过,您可以将IF语句转换为可以解决此问题的复杂公式,但是我找不到一个足够清晰的示例可以理解。潜在的解决方案是什么?

作为参考,以下是该表的示例:


+-----+---------------+---------------+---------------+---------------------+----------------+--------------+--------+-----------+-------------+
| PKG | Probability 1 | Probability 2 | Probability 3 | Blended probability | Predicted odds | Actuals odds |  Edge  | WIN/ LOSE | Overall P&L |
+-----+---------------+---------------+---------------+---------------------+----------------+--------------+--------+-----------+-------------+
|   1 | 32.4%         | 28.6%         | 74.0%         | 43.4%               |           2.31 |         2.81 |   7.86 |         1 |           0 |
|   2 | 36.2%         | 34.1%         | 61.0%         | 42.8%               |           2.34 |         4.47 |  20.39 |         0 |        -100 |
|   3 | 55.2%         | 58.2%         | 42.0%         | 52.4%               |           1.91 |         4.13 |  28.19 |         1 |         413 |
|   4 | 60.7%         | 64.7%         | 67.0%         | 64.2%               |           1.56 |         1.44 |  -5.17 |         0 |           0 |
|   5 | 33.7%         | 40.1%         | 75.0%         | 48.6%               |           2.06 |         2.32 |   5.57 |         1 |           0 |
|   6 | 48.7%         | 47.8%         | 77.0%         | 56.8%               |           1.76 |         3.41 |  27.46 |         0 |        -100 |
|   7 | 55.2%         | 64.1%         | 79.0%         | 65.9%               |           1.52 |         2.38 |  23.87 |         1 |         238 |
|   8 | 45.6%         | 34.9%         | 30.0%         | 36.6%               |           2.73 |         3.70 |   9.63 |         0 |           0 |
|   9 | 56.9%         | 63.1%         | 49.0%         | 57.0%               |           1.75 |         3.00 |  23.64 |         1 |         300 |
|  10 | 38.6%         | 37.6%         | 25.0%         | 34.1%               |           2.93 |         3.25 |   3.32 |         0 |           0 |
|  11 | 56.4%         | 56.4%         | 63.0%         | 58.4%               |           1.71 |         2.74 |  21.90 |         1 |         274 |
|  12 | 71.3%         | 78.1%         | 38.0%         | 64.1%               |           1.56 |         3.66 |  36.75 |         0 |        -100 |
|  13 | 61.4%         | 67.5%         | 72.0%         | 67.0%               |           1.49 |         1.23 | -14.50 |         1 |           0 |
|  14 | 66.4%         | 73.0%         | 76.0%         | 71.9%               |           1.39 |         1.42 |   1.46 |         0 |           0 |
|  15 | 56.1%         | 64.8%         | 21.0%         | 49.1%               |           2.04 |         1.35 | -25.19 |         1 |           0 |
|  16 | 61.5%         | 53.4%         | 57.0%         | 56.9%               |           1.76 |         1.37 |  21.03 |         0 |        -100 |
|  17 | 32.4%         | 26.2%         | 45.0%         | 33.7%               |           2.97 |         1.45 | -35.14 |         1 |           0 |
|  18 | 69.5%         | 62.5%         | 43.0%         | 58.8%               |           1.70 |         1.77 |   2.19 |         0 |           0 |
|  19 | 65.0%         | 65.3%         | 45.0%         | 59.1%               |           1.69 |         3.66 |  31.81 |         1 |         366 |
|  20 | 73.1%         | 81.9%         | 45.0%         | 68.2%               |           1.47 |         1.12 | -21.03 |         0 |           0 |
|  21 | 52.2%         | 51.4%         | 25.0%         | 43.7%               |           2.29 |         2.59 |   5.14 |         1 |           0 |
|  22 | 30.9%         | 38.2%         | 27.0%         | 32.6%               |           3.06 |         2.26 | -11.61 |         0 |           0 |
|  23 | 61.6%         | 43.1%         | 46.0%         | 49.5%               |           2.02 |         2.82 |  14.11 |         1 |           0 |
|  24 | 58.6%         | 73.4%         | 34.0%         | 57.1%               |           1.75 |         4.21 |  33.38 |         0 |        -100 |
|  25 | 64.4%         | 72.8%         | 61.0%         | 66.7%               |           1.50 |         2.24 |  21.99 |         1 |         224 |
+-----+---------------+---------------+---------------+---------------------+----------------+--------------+--------+-----------+-------------+

以下是权重:

+---------------+-----------+
|     Blend     | Weighting |
+---------------+-----------+
| Probability 1 | 30.0%     |
| Probability 2 | 40.0%     |
| Probability 3 | 30.0%     |
+---------------+-----------+

预测赔率的计算公式如下:

=1/Blend prob

使用以下公式计算边缘:

=(100/Pred odds)-(100/Act odds)

当前边缘阈值为20。

用于计算总体损益的IF语句为:

=IF(WIN/LOSE=1,IF(Edge>=Edge threshold,100*Act odds,0),IF(Edge>=Edge threshold,-100,0))

我按如下所示设置求解器:

  1. 目标:将所有损益表单元相加的单元格的最大值
  2. 变量:i)上面的加权单元格为固定值,ii)边缘阈值为固定值的单元格
  3. 常数:将权重相加的单元格-设置为1(100%),边缘阈值设置为整数
  4. 方法:尝试了GRG非线性和进化论(后者应该能够处理“非平滑”问题,即IF语句)

1 个答案:

答案 0 :(得分:1)

因此,我已使用 Solver 对您的示例数据进行了以下设置:

Attempt2

变量范围为C29:C32(三个权重和阈值);

约束是:

  • C29:C31<=1,因为它们是概率;
  • C32<=100必须为此变量设置一个上限,所以我选择了100应该是安全的?
  • C33=1是三个权重之和,应该是100%准确?

使用进化方法,我获得了以下内容:

  • 最高利润:2210
  • 概率1:37.5%
  • 概率2:9.1%
  • 概率3:53.4%
  • 阈值:18
  

我认为WIN / LOSS结果在此练习中起着重要作用,但是除了binary之外,此范围的合理约束是什么?