S <- expression(exp(-kappa*x/(1+gamma*exp(-beta*t))))
attr(S,"parlist") <- c(kappa=10/1.5,gamma=9,beta=1)
# Optimal pricing policy assuming customers arrive singly:
lambda1 <- function(tt){
if(tt<0 | tt> 1) stop("Time out of range.
")
84*(1-tt)
}
X1 <- xsolve.cont(type="sip",tmax=1,nstep=1000,qmax=5,lambda=lambda1,
S=S,alpha=0.5, gprob=1,verb=TRUE)
# Optimal pricing policy assuming customers arrive in groups of
# size up to 5, with group size probabilities 1/3, 4/15, 1/5, 2/15,
# and 1/15 respectively.
lambda2 <- function(tt){
if(tt<0 | tt> 1) stop("Time out of range.
")
84*(1-tt)
}
X2 <- xsolve.cont(type="sip",tmax=1,nstep=1000,qmax=5,lambda=lambda2,
S=S,alpha=0.5, gprob=(5:1)/15,verb=TRUE)
# Note that the intensity functions lambda1() and lambda2() are
# such that the expected total number of customers is 42 in each case.Run the code above in your browser using DataLab