简体   繁体   English

如何将 Excel 求解器与 IF 语句一起使用?

[英]How do I use Excel Solver with IF statements?

I have a table of tennis players where I've worked out the probability of them winning their respective matches in three different ways, eg % previous 10 games won, % first serves in play etc etc. I've assigned a weighting to each of these probabilities to create a blended probability which I convert into predicted odds.我有一张网球运动员表,我计算出他们以三种不同方式赢得各自比赛的概率,例如前 10 场比赛获胜的百分比、比赛中一发的百分比等。我已经为每个人分配了权重这些概率创建一个混合概率,我将其转换为预测赔率。 I then compare these predicted odds to the actual odds that are available from bookmakers to derive the 'edge'.然后,我将这些预测赔率与博彩公司提供的实际赔率进行比较,以得出“优势”。 A positive edge means the bookmaker is offering better odds than they should and there is 'value' in placing a bet.积极的优势意味着博彩公司提供的赔率高于应有的赔率,并且投注具有“价值”。 There are a three potential scenarios:有三种可能的情况:

  1. Edge >= Edge threshold, player wins then I win £100 x actual odds边缘 >= 边缘阈值,玩家获胜,然后我赢得 100 英镑 x 实际赔率
  2. Edge >= Edge threshold, player loses then I lose £100边缘 >= 边缘阈值,玩家输了,我就输了 100 英镑
  3. Edge < Edge threshold, I don't bet so neither win nor lose Edge < Edge 阈值,我不赌所以不输也不输

I want to work out what the optimal combination of the three probabilities AND the edge threshold that generates the highest level of profit.我想找出产生最高利润水平的三个概率和边缘阈值的最佳组合。 I tried to use Excel Solver to do this but apparently it can't cope with IF statements.我尝试使用 Excel Solver 来执行此操作,但显然它无法处理 IF 语句。 I've read in a few places that you can convert IF statements into complex formulas that get around this problem but I haven't been able find an example that's clear enough to follow.我在几个地方读到过,您可以将 IF 语句转换为复杂的公式来解决这个问题,但我找不到一个足够清晰的示例。 What are the potential solutions?有哪些潜在的解决方案?

For reference here is a sample of the table:作为参考,这里是一个表格示例:


+-----+---------------+---------------+---------------+---------------------+----------------+--------------+--------+-----------+-------------+
| 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 |
+-----+---------------+---------------+---------------+---------------------+----------------+--------------+--------+-----------+-------------+

Here are the weightings:以下是权重:

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

Predicted odds are calculated using the following formula:预测赔率使用以下公式计算:

=1/Blend prob

The edge is calculated using the following formula:使用以下公式计算边缘:

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

The current edge threshold is 20.当前边缘阈值为 20。

The IF statement to calculate the Overall P&L is:计算总损益的 IF 语句是:

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

I set up Solver as follows:我设置求解器如下:

  1. Objective: Max of a cell that summed the Overall P&L cells目标:将整体损益单元格相加的单元格的最大值
  2. Variables: i ) the weightings cells above as fixed values and ii) a cell with the edge threshold as a fixed value变量:i)将上述权重单元格作为固定值,ii)将边缘阈值作为固定值的单元格
  3. Constants: A cell that sums the weightings - set at 1 (100%) and the Edge threshold as an integer常量:将权重相加的单元格 - 设置为 1 (100%),边缘阈值设置为 integer
  4. Method: Tried GRG Nonlinear and Evolutionary (the latter is one that is supposed to be able to handle 'non-smooth' problems, ie IF statements)方法:尝试了 GRG 非线性和进化(后者应该能够处理“非平滑”问题,即 IF 语句)

So I have tested your sample data using Solver with the following set up:因此,我使用Solver测试了您的样本数据,设置如下:

尝试2

The Variables range is C29:C32 (the three weightings and the threshold);变量范围是C29:C32 (三个权重和阈值);

The constraints are:约束是:

  • C29:C31<=1 as they are probabilities; C29:C31<=1因为它们是概率;
  • C32<=100 must set an upper bound for this variable so I picked 100 which should be safe? C32<=100必须为这个变量设置一个上限,所以我选择了100 ,这应该是安全的吗?
  • C33=1 which is the sum of the three weightings which should be 100% exact? C33=1是三个权重之和,应该 100% 准确?

Use Evolutionary method I have obtained the following:使用进化方法我得到了以下结果:

  • Max Profit: 2210 ;最大利润: 2210
  • Probability 1: 37.5%概率1: 37.5%
  • Probability 2: 9.1%概率2: 9.1%
  • Probability 3: 53.4%概率3: 53.4%
  • Threshold: 18门槛: 18

I think the WIN/LOSS result plays a significant role in this exercise but what would be the reasonable constraints for this range except binary ?我认为 WIN/LOSS 结果在这个练习中起着重要作用,但是除了binary之外,这个范围的合理限制是什么?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM