Is there a formula to get the total wins from odds combination?












0












$begingroup$


Here is the problem: given a set of bets, how can I calculate the maximum possible wins of all combinations without looping through them?



I know how to get the number of combinations ($frac{n!}{r!(n - r)!}$) and I know how to get the powerset, so all the single combinations.



In order to calculate the total possible wins, I am currently looping through all the combinations, multiplying the odds together and then adding them all to the total.



As you know, though, combinations add up pretty quickly as I add more bets, so I will soon looping through thousands of combinations and my program slows down.



Now, before I start to optimise those loops and improve the UX, if there was a mathematical formula to calculate the max possible wins, the looping problems will instantly vanish.



I have searched extensively, but I couldn't find anything. I might be lacking the proper mathematical terminology to actually find the answer I am looking for. But this looks like something mathematicians would have already solved, probably in different fields and with a specific name that I can't find.



For this example, I will assume all stakes are 1, so it's easier to handle.



3 bets with odds: 1,40 | 1,45 | 1,55



7 combinations (technically there is another combination where no bets are chosen, but we can skip that, because it wouldn't add anything to the sum):



1,4
1,45
1,55
1,4*1,45
1,4*1,55
1,45*1,55
1,4*1,45*1,55


If you round each calculation to two decimals, you get 14,00 (otherwise, 13,99).



Is there a formula to get to that result without looping through the powerset and calculating everything sequentially?










share|cite|improve this question









$endgroup$

















    0












    $begingroup$


    Here is the problem: given a set of bets, how can I calculate the maximum possible wins of all combinations without looping through them?



    I know how to get the number of combinations ($frac{n!}{r!(n - r)!}$) and I know how to get the powerset, so all the single combinations.



    In order to calculate the total possible wins, I am currently looping through all the combinations, multiplying the odds together and then adding them all to the total.



    As you know, though, combinations add up pretty quickly as I add more bets, so I will soon looping through thousands of combinations and my program slows down.



    Now, before I start to optimise those loops and improve the UX, if there was a mathematical formula to calculate the max possible wins, the looping problems will instantly vanish.



    I have searched extensively, but I couldn't find anything. I might be lacking the proper mathematical terminology to actually find the answer I am looking for. But this looks like something mathematicians would have already solved, probably in different fields and with a specific name that I can't find.



    For this example, I will assume all stakes are 1, so it's easier to handle.



    3 bets with odds: 1,40 | 1,45 | 1,55



    7 combinations (technically there is another combination where no bets are chosen, but we can skip that, because it wouldn't add anything to the sum):



    1,4
    1,45
    1,55
    1,4*1,45
    1,4*1,55
    1,45*1,55
    1,4*1,45*1,55


    If you round each calculation to two decimals, you get 14,00 (otherwise, 13,99).



    Is there a formula to get to that result without looping through the powerset and calculating everything sequentially?










    share|cite|improve this question









    $endgroup$















      0












      0








      0





      $begingroup$


      Here is the problem: given a set of bets, how can I calculate the maximum possible wins of all combinations without looping through them?



      I know how to get the number of combinations ($frac{n!}{r!(n - r)!}$) and I know how to get the powerset, so all the single combinations.



      In order to calculate the total possible wins, I am currently looping through all the combinations, multiplying the odds together and then adding them all to the total.



      As you know, though, combinations add up pretty quickly as I add more bets, so I will soon looping through thousands of combinations and my program slows down.



      Now, before I start to optimise those loops and improve the UX, if there was a mathematical formula to calculate the max possible wins, the looping problems will instantly vanish.



      I have searched extensively, but I couldn't find anything. I might be lacking the proper mathematical terminology to actually find the answer I am looking for. But this looks like something mathematicians would have already solved, probably in different fields and with a specific name that I can't find.



      For this example, I will assume all stakes are 1, so it's easier to handle.



      3 bets with odds: 1,40 | 1,45 | 1,55



      7 combinations (technically there is another combination where no bets are chosen, but we can skip that, because it wouldn't add anything to the sum):



      1,4
      1,45
      1,55
      1,4*1,45
      1,4*1,55
      1,45*1,55
      1,4*1,45*1,55


      If you round each calculation to two decimals, you get 14,00 (otherwise, 13,99).



      Is there a formula to get to that result without looping through the powerset and calculating everything sequentially?










      share|cite|improve this question









      $endgroup$




      Here is the problem: given a set of bets, how can I calculate the maximum possible wins of all combinations without looping through them?



      I know how to get the number of combinations ($frac{n!}{r!(n - r)!}$) and I know how to get the powerset, so all the single combinations.



      In order to calculate the total possible wins, I am currently looping through all the combinations, multiplying the odds together and then adding them all to the total.



      As you know, though, combinations add up pretty quickly as I add more bets, so I will soon looping through thousands of combinations and my program slows down.



      Now, before I start to optimise those loops and improve the UX, if there was a mathematical formula to calculate the max possible wins, the looping problems will instantly vanish.



      I have searched extensively, but I couldn't find anything. I might be lacking the proper mathematical terminology to actually find the answer I am looking for. But this looks like something mathematicians would have already solved, probably in different fields and with a specific name that I can't find.



      For this example, I will assume all stakes are 1, so it's easier to handle.



      3 bets with odds: 1,40 | 1,45 | 1,55



      7 combinations (technically there is another combination where no bets are chosen, but we can skip that, because it wouldn't add anything to the sum):



      1,4
      1,45
      1,55
      1,4*1,45
      1,4*1,55
      1,45*1,55
      1,4*1,45*1,55


      If you round each calculation to two decimals, you get 14,00 (otherwise, 13,99).



      Is there a formula to get to that result without looping through the powerset and calculating everything sequentially?







      combinatorics binomial-coefficients gambling






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Dec 10 '18 at 9:04









      Emanuele FelizianiEmanuele Feliziani

      31




      31






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          No, and if you're talking about sports-betting then your code should also take into account that some combinations aren't permissible and so can't contribute to the final total (if you want an accurate total -- see below). For example, your three selections may have two from the same match, so three singles, two doubles and no trebles are permissible, which is 5 from the seven possible.



          Typically, when writing code for sports-betting sites (I spent 11 years working for a major supplier of sports-betting software) the rule we applied was to underestimate the maximum winnings. Customers are never upset to find out they've won more than they were told, but if you say the maximum is higher than they get when all the selections win, you can expect complaints and possibly even legal action. If you're happy to provide a lower bound then you can take the selection in order of ascending odds (e.g. 1.17, 1.41, 1.88, 2.05, 3.00) and then take the first two as the price for all doubles, the first three for all trebles, etc.



          You still have the issue of what to do when selections aren't allowed to combine as this reduces the number of permissible bets. We used look-up tables: this number of selections (3) has this number of bets(7) if all combos are permitted, this number (5) if one selection does not combine, and this number(3) if two don't.



          Lastly: if you have any kind of starting price you can't display the max winnings at all unless you're willing to estimate for SP.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Many thanks for taking the time to answer my question. For this specific calculation we already know that all bets are possible (otherwise this bit of the program is not reached at all).Also, at the moment, I am required to provide a precise value, not an estimation. As far as I understood, specific legislations require us to provide a precise value, or maybe it's just a business decision. So, I guess I am stuck with looping for now. Thanks again.
            $endgroup$
            – Emanuele Feliziani
            Dec 10 '18 at 9:50













          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3033668%2fis-there-a-formula-to-get-the-total-wins-from-odds-combination%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0












          $begingroup$

          No, and if you're talking about sports-betting then your code should also take into account that some combinations aren't permissible and so can't contribute to the final total (if you want an accurate total -- see below). For example, your three selections may have two from the same match, so three singles, two doubles and no trebles are permissible, which is 5 from the seven possible.



          Typically, when writing code for sports-betting sites (I spent 11 years working for a major supplier of sports-betting software) the rule we applied was to underestimate the maximum winnings. Customers are never upset to find out they've won more than they were told, but if you say the maximum is higher than they get when all the selections win, you can expect complaints and possibly even legal action. If you're happy to provide a lower bound then you can take the selection in order of ascending odds (e.g. 1.17, 1.41, 1.88, 2.05, 3.00) and then take the first two as the price for all doubles, the first three for all trebles, etc.



          You still have the issue of what to do when selections aren't allowed to combine as this reduces the number of permissible bets. We used look-up tables: this number of selections (3) has this number of bets(7) if all combos are permitted, this number (5) if one selection does not combine, and this number(3) if two don't.



          Lastly: if you have any kind of starting price you can't display the max winnings at all unless you're willing to estimate for SP.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Many thanks for taking the time to answer my question. For this specific calculation we already know that all bets are possible (otherwise this bit of the program is not reached at all).Also, at the moment, I am required to provide a precise value, not an estimation. As far as I understood, specific legislations require us to provide a precise value, or maybe it's just a business decision. So, I guess I am stuck with looping for now. Thanks again.
            $endgroup$
            – Emanuele Feliziani
            Dec 10 '18 at 9:50


















          0












          $begingroup$

          No, and if you're talking about sports-betting then your code should also take into account that some combinations aren't permissible and so can't contribute to the final total (if you want an accurate total -- see below). For example, your three selections may have two from the same match, so three singles, two doubles and no trebles are permissible, which is 5 from the seven possible.



          Typically, when writing code for sports-betting sites (I spent 11 years working for a major supplier of sports-betting software) the rule we applied was to underestimate the maximum winnings. Customers are never upset to find out they've won more than they were told, but if you say the maximum is higher than they get when all the selections win, you can expect complaints and possibly even legal action. If you're happy to provide a lower bound then you can take the selection in order of ascending odds (e.g. 1.17, 1.41, 1.88, 2.05, 3.00) and then take the first two as the price for all doubles, the first three for all trebles, etc.



          You still have the issue of what to do when selections aren't allowed to combine as this reduces the number of permissible bets. We used look-up tables: this number of selections (3) has this number of bets(7) if all combos are permitted, this number (5) if one selection does not combine, and this number(3) if two don't.



          Lastly: if you have any kind of starting price you can't display the max winnings at all unless you're willing to estimate for SP.






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Many thanks for taking the time to answer my question. For this specific calculation we already know that all bets are possible (otherwise this bit of the program is not reached at all).Also, at the moment, I am required to provide a precise value, not an estimation. As far as I understood, specific legislations require us to provide a precise value, or maybe it's just a business decision. So, I guess I am stuck with looping for now. Thanks again.
            $endgroup$
            – Emanuele Feliziani
            Dec 10 '18 at 9:50
















          0












          0








          0





          $begingroup$

          No, and if you're talking about sports-betting then your code should also take into account that some combinations aren't permissible and so can't contribute to the final total (if you want an accurate total -- see below). For example, your three selections may have two from the same match, so three singles, two doubles and no trebles are permissible, which is 5 from the seven possible.



          Typically, when writing code for sports-betting sites (I spent 11 years working for a major supplier of sports-betting software) the rule we applied was to underestimate the maximum winnings. Customers are never upset to find out they've won more than they were told, but if you say the maximum is higher than they get when all the selections win, you can expect complaints and possibly even legal action. If you're happy to provide a lower bound then you can take the selection in order of ascending odds (e.g. 1.17, 1.41, 1.88, 2.05, 3.00) and then take the first two as the price for all doubles, the first three for all trebles, etc.



          You still have the issue of what to do when selections aren't allowed to combine as this reduces the number of permissible bets. We used look-up tables: this number of selections (3) has this number of bets(7) if all combos are permitted, this number (5) if one selection does not combine, and this number(3) if two don't.



          Lastly: if you have any kind of starting price you can't display the max winnings at all unless you're willing to estimate for SP.






          share|cite|improve this answer









          $endgroup$



          No, and if you're talking about sports-betting then your code should also take into account that some combinations aren't permissible and so can't contribute to the final total (if you want an accurate total -- see below). For example, your three selections may have two from the same match, so three singles, two doubles and no trebles are permissible, which is 5 from the seven possible.



          Typically, when writing code for sports-betting sites (I spent 11 years working for a major supplier of sports-betting software) the rule we applied was to underestimate the maximum winnings. Customers are never upset to find out they've won more than they were told, but if you say the maximum is higher than they get when all the selections win, you can expect complaints and possibly even legal action. If you're happy to provide a lower bound then you can take the selection in order of ascending odds (e.g. 1.17, 1.41, 1.88, 2.05, 3.00) and then take the first two as the price for all doubles, the first three for all trebles, etc.



          You still have the issue of what to do when selections aren't allowed to combine as this reduces the number of permissible bets. We used look-up tables: this number of selections (3) has this number of bets(7) if all combos are permitted, this number (5) if one selection does not combine, and this number(3) if two don't.



          Lastly: if you have any kind of starting price you can't display the max winnings at all unless you're willing to estimate for SP.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Dec 10 '18 at 9:21









          postmortespostmortes

          2,04121119




          2,04121119












          • $begingroup$
            Many thanks for taking the time to answer my question. For this specific calculation we already know that all bets are possible (otherwise this bit of the program is not reached at all).Also, at the moment, I am required to provide a precise value, not an estimation. As far as I understood, specific legislations require us to provide a precise value, or maybe it's just a business decision. So, I guess I am stuck with looping for now. Thanks again.
            $endgroup$
            – Emanuele Feliziani
            Dec 10 '18 at 9:50




















          • $begingroup$
            Many thanks for taking the time to answer my question. For this specific calculation we already know that all bets are possible (otherwise this bit of the program is not reached at all).Also, at the moment, I am required to provide a precise value, not an estimation. As far as I understood, specific legislations require us to provide a precise value, or maybe it's just a business decision. So, I guess I am stuck with looping for now. Thanks again.
            $endgroup$
            – Emanuele Feliziani
            Dec 10 '18 at 9:50


















          $begingroup$
          Many thanks for taking the time to answer my question. For this specific calculation we already know that all bets are possible (otherwise this bit of the program is not reached at all).Also, at the moment, I am required to provide a precise value, not an estimation. As far as I understood, specific legislations require us to provide a precise value, or maybe it's just a business decision. So, I guess I am stuck with looping for now. Thanks again.
          $endgroup$
          – Emanuele Feliziani
          Dec 10 '18 at 9:50






          $begingroup$
          Many thanks for taking the time to answer my question. For this specific calculation we already know that all bets are possible (otherwise this bit of the program is not reached at all).Also, at the moment, I am required to provide a precise value, not an estimation. As far as I understood, specific legislations require us to provide a precise value, or maybe it's just a business decision. So, I guess I am stuck with looping for now. Thanks again.
          $endgroup$
          – Emanuele Feliziani
          Dec 10 '18 at 9:50




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3033668%2fis-there-a-formula-to-get-the-total-wins-from-odds-combination%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Bundesstraße 106

          Verónica Boquete

          Ida-Boy-Ed-Garten