#
# In these examples "nstep" has been set equal to 100
# to reduce the time for package checking on CRAN.
# A more "realistic" value is nstep=1000. Likewise "qmax"
# has been set equal to 5 which is an unrealistically low
# value for the total number of assets.
#
S <- expression(exp(-kappa*x/(1+gamma*exp(-beta*t))))
attr(S,"parvec") <- c(kappa=10/1.5,gamma=9,beta=1)
lambda1 <- function(tt){
# eps <- sqrt(.Machine$double.eps)
84*(1-tt)
}
# Optimal pricing policy assuming customers arrive singly:
X <- xsolve(S=S,lambda=lambda1,gprob=1,tmax=1,qmax=5,nstep=100,nverb=50)
lambda2 <- function(tt){
# eps <- sqrt(.Machine$double.eps)
36*(1-tt)
}
# Expected values if the customers actually arrive in groups, using the
# (sub-optimal) pricing policy based on the (erroneous) assumption that
# they arrive singly. Note that the two scenarios are ``comparable'' in
# that the expected total number of customers is 42 in each case.
V <- vsolve(S=S,lambda=lambda2,gprob=(5:1)/15,x=X$x,nstep=100,
alpha=0.5,nverb=50)Run the code above in your browser using DataLab