To compute EV profit for all sub-problems, the recurrence relation is:
EV(i, j) = profit of state i attackers and j defenders. profit(ii, jj, i, j) = the incremental profit for moving from state (i, j) to (ii, jj). p(ii,jj) = probability of reaching state ii,jj from i, j EV(i, j) = sum( all next states ii, jj) { p(ii,jj) * profit(ii,jj, i, j) + EV(ii,jj) }This doesn’t consider that you might retreat in the future… to handle that:
EV(i, j) = sum( all next states ii, jj) { p(ii,jj) * profit(ii,jj, i, j) + EV(ii,jj) > retreatThreshold ? EV(ii,jj) : 0 }To compute Pwin for all sub-problems, the recurrence relation is:
Pwin(i, j) = probability of winning Pwin(i, j) = sum (all next states ii, jj) { isRetreat = Pwin(ii, jj) < threshold; isRetreat ? 0 : p(ii,jj) * Pwin(ii,jj) }





