1. Let {X1, X2, X3, . . .} be a sequence of iid random variables such that
P(X1=1)=p, PX=-1=q1-p
where 0 < p < 1. Define the simple random walk
Ex i=]
with So = 0. Fix an arbitrary positive integer N. We are interested in solving the optimal stopping problem
v= sup E[f(Sz)] N>>0
where f is some given function and the supremum is taken over all stopping times taking values in {0, 1, 2, .. . , N}. Write a program to solve this optimal stopping problem by report- ing both the value of v and the optimal stopping strategy. Here are a couple of examples that you can check your program with.
(a) When p = 0.6,q = 0.4,f(x) = x,and N = 5,we should have = 1. The optimal stopping strategy can be represented by a
matrix):
n=0 n=1
0 * * * 0 0 * * * * 0 0 0 * * * n=3 0 0 0 0 * * 0 0 0 0 0 * n=N=5 1 1 1 1 1 1