reset; option randseed''; set A := 1..200; # set of admissible prices param T default 100; # time horizon param N default 100; # number of items to sell ####### sales probabilities ######### param p {a in A,t in 0..T-1} := (1-a/200)*t/T; # sales intensity param m := 5; # coefficent binomial distribution param bk{nn in 0..50,k in 0..nn} := if k=0 or k=nn then 1 else bk[nn-1,k] + bk[nn-1,k-1]; # Binomialkoeffizienten param P {k in 0..m,a in A,t in 0..T-1} := if k<=m then bk[m,k] * p[a,t]^k * (1-p[a,t])^(m-k); # Binomialw'keiten param Pkum{k in 0..m,a in A,t in 0..T-1} := sum{i in 0..k} P[i,a,t]; # cumulative distribution (for simulation only) ####### optimal strategy (finite horizon) ####### param delta default 1; # discount factor param V{t in 0..T,n in 0..N}:= if t=T then 0 else max {a in A} # value function sum{i in 0..m} P[i,a,t]*(min(i,n)*a + delta * V[t+1,n-min(i,n)] ); param at{t in 0..T-1,n in 0..N}:= if n>0 then min{a in A: V[t,n] = if t0 then at[t,E[i,t,1]]) # price else if k=4 then (if t0 then min{j in 0..m: Z[i,t]0})) * sum{i in 1..sim:E[i,t,1]>0} E[i,t,3]; param EIt{t in 0..T-1}:=1/sim * sum{i in 1..sim} E[i,t,4]; let sim:=1000; # change from 1 simulation to multiple ones display ENt,EGt,Ept,EIt; end;