MichalisPanayides / AmbulanceDecisionGame

This repository presents an attemt to solve the Ambulance Decision Game.
MIT License
0 stars 0 forks source link

Attempt on getting a closed-form formula of state probabilities from the Markov Chain model #28

Open MichalisPanayides opened 4 years ago

MichalisPanayides commented 4 years ago
MichalisPanayides commented 4 years ago

UPDATE:

Markov Chain Tree Theorem: π_i = sum of the weight of all directed spanning trees rooted at that state

MichalisPanayides commented 4 years ago

UPDATE of Everything:

  1. Initial Approach:

    • Used sympy to get symbolic formulas and solved using sympy.solve_linear_system_LU
    • Used sympy.simplify() to simpify expressions image
    • Examples calculated:
      • Markov 1321
      • Markov 1431
      • Markov 1121
      • Markov 1321
      • Markov 2121
      • Markov 1222
    • Markov Chain Tree Theorem: UNNORMALIZED πi = sum of the weight of all directed spanning trees rooted at state i image
      • Verified examples: Markov 1341, MARKOV 1122
    • Examined recursive ratio between adjacent states i and j: πi/ πj
    • Recursive ratio example: image
  2. Attempt of getting π0,0 formula by completing the power:

    • Created modularised functions that return symbolic rate at state (0,0) and recursive ratios (nbs/other/closed_form_formula_of_pi/state_probabilities_example)

    • Adding rows: when having k rows at the model, the rate is equivalent to (one-row model)k: image image image

    • Adding columns: more complicated - after some point terms get harder to predict

  3. Attempt of getting π0,0 formula using combinatorics

    • Tried looking at the spanning trees problem from a combinatorics point of view

    • Turned Markov chain model into a graph theoretic model

    • Possible (λA) (λo) μ terms:

      • p1 + p2 + p3 = C
      • If p1 = 0, then p2 = 0 and p3 = C
    • Managed to get coefficient for terms (λA)p1o)p2 μp3 where one of p1, p2 or p3 was raised to a power of 1 or 0.

    • i.e. coefficients of the form [(λ A)2] [(λ o)3] [μ2] (where p1, p2,p3 > 1) could not be calculated image image

    • As problem gets bigger more cases of spanning trees appear and such cases were not found

    • Matrix-tree theorem: Laplacian of graph can be used to get the number of spanning trees at state i

  4. Successful attempt of getting π0,0 formula using permutation algorithm

    • Translating the problem into a permutation problem:

      • The problem of finding all spanning trees becomes a problem of finding all possible permutations of an array with elements the characters "D", "R" and "L".

      • Arrays that represent valid spanning trees are the ones that don't end in "R" and don't have an "R" followed by an "L" image

      • Note that such algorithm works for cases of parking_capacity = 1 (i.e. one additional row in the Markov chain model)

      • For parking_capacity > 1, apply (one-row model)parking_capacity described earlier

      • Based on that notion closed-form formula is calculate as: image image

Pull requests:

Files:

To be done:

drvinceknight commented 4 years ago

This is exactly what I was hoping you'd write up @11michalis11. :+1: