Thursday, April 14, 2022

Bellman Bets (Stochastic Stakes)

[Bellman Bets (Stochastic Stakes)](https://en.wikipedia.org/wiki/Stochastic_dynamic_programming)

Bellman Bets (Stochastic Stakes)

Weekend racing usually presents some value opportunities for our Convex Bettor at the expense of deciding in which markets to compete! Using our WCMI metric, we can select a subset of five (for example) open races and indulge ourselves in a limited form of session handicapping without risking too much of our bankroll. Having selected our 'WCMI-5' races for handicapping, we can calculate a set of near-optimal stakes using stochastic dynamic programming.

Let us assume that we have the following parameters:

  • Number of Races = 5
  • Initial Bankroll = $50
  • Target Bankroll = $250
  • Win Probability (Avg) = 0.35
  • Decimal Odds (Avg) = 3.50
  • Current Race = 1

We should proceed as follows:

A. Access and read the Wikipedia Stochastic Dynamic Programming article.

B. Download 'GamblersRuin.java' as referenced in the article. Edit the file and make the following changes:

  1. On line 27.
    // package jsdp.app.standalone.stochastic;
  2. On lines 144-5.
    int bettingHorizon = 5; // Planning horizon length double targetWealth = 250; // Target wealth
  3. On line 151.
    double pmf[][] = {{0.0, 0.65}, {3.5, 0.35}};
  4. On lines 184-5.
    int initialPeriod = 1; double initialWealth = 50;
  5. On line 191.
    System.out.println("Success = " + String.format("%7.5f", ruin.f(initialState))); ```
  6. On line 196.
    System.out.println("Stake = " + ruin.cacheActions.get(ruin.new State(1, 50.0)));
  7. Save the file to a local directory (for example, C:\bellman). From the command-line (assuming you have java installed and accessible), change to the local directory and run the following commands:
    >javac.exe GamblersRuin.java >java.exe GamblersRuin
  8. You should get the following outputs:
    >Success = 0.28434 >Stake = 9.0

C. Interpret output as follows:

  • Using an optimal set of bets, you have approximately a 28% chance of success in reaching the goal of $250 across the five markets; and
  • Bet on the first market should be $9.

D. Repeat steps 1-8 after each race to generate updated success probabilities and stakes.

  • For example, if you lose the $9 stake in the first race, then:
    • set int initialPeriod = 2; and double initialWealth = 41; (step 4),
    • set System.out.println("Second Stake (If Loss) = "+ruin.cacheActions.get(ruin.new State(2, 41))); (step 6), and
    • re-run both commands (step 7).
  • For example, if you win $72.5 ((9.0 * 3.5) + 41) in the first race, then:
    • set int initialPeriod = 2; and double initialWealth = 72.5; (step 4),
    • set System.out.println("Second Stake (If Win) = "+ruin.cacheActions.get(ruin.new State(2, 72.5))); (step 6), and
    • re-run both commands (step 7).

Notes

  • This post is inspired by Richard E. Bellman's work on Stochastic Dynamic Programming.
  • Thanks to 'Professor Roberto Rossi' for the excellent, original Java code.
  • If the output shows a bet of $0, then reduce the initialPeriod value by 1 and try again (step 4). This $0 result usually indicates that a stake of less than $1 was calculated!
  • No professional Java developers were injured in generating the above list of instructions for neophytes.

Enjoy!