Академический Документы
Профессиональный Документы
Культура Документы
,
_
,
_
n n
Z
n
a
,
where a > 0 is a fixed parameter of the algorithm (the quantity a/n is sometimes called the gain),
n
Z is
an unbiased estimator of ) ( ' f
n
, and
'
>
<
. if
; if
; if
) (
(The function ( ) projects the current parameter value onto the feasible set. Algorithms that iterate as
described above are called stochastic approximation algorithms.) Denote by * the global minimizer of f.
If the only local minimizer of f is *, then under very general conditions
n
*
MS&E 223 Lecture Notes #11
Simulation Making Decisions via Simulation
Peter J. Haas Spring Quarter 2003-04
Page 2 of 9
as n with probability 1. (Otherwise the algorithm can converge to some other local minimizer.) For
large n, it can be shown that
n
has approximately a normal distribution. Thus, if the procedure is run m
independent times (where m = 5 to 10) with n iterations for each run, generating i.i.d. replicates
n,1
, ... ,
n,m
, then a point estimator for * is
m
=
m
1
n, j m
j 1
n
0 i
i
n
0 i
i
) Y ( q
) Y ( p
.
L
n
is called a likelihood ratio and represents the likelihood of seeing the observations under the
distribution p relative to the likelihood of seeing the observations under distribution q. We claim that
(1)
n 0 1 n n n 0 1 n
E[g (Y , Y , , Y )L ] E[g (X , X , , X )] K K
To see this, observe that
n 0 1 n n
E[g (Y , Y , , Y )L ] K = ( )
0 n
n
i
i 0
n 0 n 0 0 n n
n
s S s S
i
i 0
p(s )
g (s , , s ) P Y s , , Y s
q(s )
_
,
L K K
=
0 n
n
n
i
i 0
n 0 n i
n
s S s S i 0
i
i 0
p(s )
g (s , , s ) q ( s )
q(s )
_
,
L K
=
0 n
n
n 0 n i
s S s S i 0
g (s , , s ) p(s )
L K
= E[g
n
(X
0
, ... , X
n
)]
Thus, we can simulate Ys instead of Xs, as long as the performance measure g is multiplied by the
likelihood ratio correction factor.
This idea can be applied in great generality. For example, if X and Y are real-valued random variables
with density functions f
X
and f
Y
respectively, then (1) holds with
L
n
=
n
X i
i 0
n
Y i
i 0
f ( Y)
f ( Y)
.
As another example, if X
0
, X
1
, ... , X
n
are observations of a discrete-time Markov chain with initial
distribution and transition matrix P and Y
0
, Y
1
, ... , Y
n
are observations of a discrete-time Markov chain
with initial distribution % and transition matrix P
~
, then (1) holds with
MS&E 223 Lecture Notes #11
Simulation Making Decisions via Simulation
Peter J. Haas Spring Quarter 2003-04
Page 4 of 9
(2) L
n
=
( )
( )
n
0 i 1 i
i 1
n
0 i 1 i
i 1
Y P(Y , Y)
Y P(Y , Y)
%
%
.
Remark: The relation in (1) continues to hold if n is replaced by a random time N.
Remark: L
n
can easily be computed in a recursive manner.
Likelihood ratios can be computed in the context of GSMPs in an analogous way. The idea is to initially set
the running likelihood ratio equal to 1. Then, whenever there is a state transition from
n
S to
n 1
S
+
caused
by the occurrence of the events in
*
n
E , the running likelihood ratio is multiplied by
* *
n 1 n n n 1 n n
p(S ;S , E )/p(S ;S , E )
+ +
% . Moreover, for each new clock reading
i
X generated for an event
i
e , the
running likelihood is multiplied by
* *
i n 1 i n n i n 1 i n n
f ( X; S , e , S , E ) / f ( X; S , e , S , E )
+ +
%
. (Here f and f
%
denote the
densities of the new clock-setting distributions.) Similar multiplications are required initially to account for
any differences in the initial distribution.
Application of Likelihood Ratios to Gradient Estimation
Likelihood ratio techniques can be used to yield an estimate of ) ( ' f based on simulation at the single
parameter value . Suppose that we have the representation f() = E
to indicate
that the distribution of the random variable X depends on .
Example: Consider an M/M/1 queue with interarrival rate and service rate . A performance measure
of above form is obtained by letting X be the average waiting time for the first k customers and setting c(x,
) = a + bx. This cost function reflects the tradeoff between operating costs due to an increase in the
service rate and the costs due to increased waiting times for the customers. We assume that > , so
that the queue is stable for all possible choices of .
As discussed above, we have
[ ] [ ]
h
f ( h) E c(X, h) E c(X, h)L(h)
+
+ + + ,
where L(h) is an appropriate likelihood ratio. Noting that L(0) = 1 and assuming that we can interchange
the expectation and limit operations, we have
h 0 h 0
f ( h) f ( ) c(X, h)L(h) c(X, )L(0)
f '( ) lim limE
h h
+ + 1
1
]
MS&E 223 Lecture Notes #11
Simulation Making Decisions via Simulation
Peter J. Haas Spring Quarter 2003-04
Page 5 of 9
( )
[ ]
h 0
h 0
c(X, h)L(h) c(X, )L(0) d
E lim E c(X, h)L(h)
h dh
E c'(X, ) c(X, )L'(0)
1 + 1
+
1
1
]
]
+
(Here c' c/ .) To estimate r() = ' f (), generate i.i.d. replicates
1 n
X , , X K and compute the
estimator
r
n
() = [ ]
n
i i
i 1
1
c'(X , ) c(X , )L'(0)
n
+
.
Confidence intervals can be formed in the usual way. In the context of the Robbins-Monro algorithm
(where computing confidence intervals is not an issue), we often take n to be small, even perhaps taking n
= 1, because in practice it is often more efficient to execute many R-M iterations with relatively noisy
derivative estimates than to execute fewer iterations with more precise derivative estimates.
Example: For the M/M/1 queue discussed above, denote by
1 k
V , , V K the k service times generated in the
course of simulating the k waiting times. Then the likelihood ratio L(h) is given by
L(h) =
+
k
1 i
V
k
1 i
V ) h (
i
i
e
e ) h (
=
,
_
+
k
1 i
hV
i
e
h
,
so that
,
_
k
1 i
i
V
1
) 0 ( ' L and ( )
1
1
]
1
,
_
,
_
+ +
n
1 j
k
1 i
ij j
V
1
bX a a
n
1
) ( r
,
where
j
X is the average of the k waiting times generated during the j
th
simulation and
ij
V is the i
th
service
time generated during the j
th
simulation. Confidence intervals for ) ( ' f can be formed in the usual way.
Remark: The Gradient information is useful even outside the context of stochastic optimization, because it
can be used to explore the sensitivity of system performance to specified parameters.
Remark: There are other methods that can be used to estimate gradients, such as infinitesimal
perturbation analysis (IPA). See Chapter 9 in the Handbook of Simulation for further discussion.
Remark: The main drawback to the likelihood-ratio approach is that the variance of the likelihood ratio
increases with the length of the simulation. Thus the estimates can be very noisy for long simulation runs,
and many simulation replications must be performed to get reasonable estimates.
MS&E 223 Lecture Notes #11
Simulation Making Decisions via Simulation
Peter J. Haas Spring Quarter 2003-04
Page 6 of 9
2. Small Number of Alternatives: Ranking and Selection
Now lets look at the case of a finite number of alternatives. Law and Kelton discuss the case of two
competing alternatives in section 10.2. We focus on the more typical case where there are a number of
alternatives to be compared. Unless stated otherwise, we will assume that bigger is better, i.e., our goal
is to maximize some performance measure. (Any minimization problem can be converted to a
maximization problem by maximizing the negative of the original performance measure.)
Suppose that we are comparing k systems, where k is on the order of 3 to 20. Denote by
i
the value of
the performance measure for the i
th
alternative. (E.g.,
i
might be the expected revenue from system i
over one year.) Sometimes we write
(1)
<
(2)
< ... <
(k)
, so that
(k)
is the optimal value of the
performance measure
The goal is to select the best system with (high) probability 1 , whenever the performance measure for
the best system is at least better than the others; i.e., whenever
( k) (1)
> for l k. The parameter
is called the indifference zone. If in fact there exist solutions within the indifference zone (e.g., when
( k) (1)
for one or more values of l), the algorithm described below typically selects a good solution
(i.e., a system lying within the indifference zone) with probability 1 .
The inputs to the procedure are observations
ij
Y , where
ij
Y is the j
th
estimate of
i
. For a fixed
alternative i, the observations (
ij
Y : j 1) are assumed to be i.i.d. (i.e., based on independent simulation
runs). Each
ij
Y is required to have (at least approximately) a normal distribution. Thus, an observation
ij
Y
may be
an average of a large enough number of i.i.d. observations of a finite-horizon performance
measure so that the CLT is applicable
an estimate of a steady-state performance measure based on a large enough number of
regenerative cycles
an estimate of a steady-state performance measure based on a large enough number of batch
means
The following algorithm (due to Rinott, with modifications by Nelson and Matejcik) will not only select the
best system as defined above, but will also provide simultaneous 100(1 )% confidence intervals
i
J
on the quantities
i i j i j
max
for 1 i k. That is,
i i
P( J for 1 k) 1 . (This is a stronger assertion than
i i
P( J ) 1 for 1
i k as with individual confidence intervals.) This multiple comparisons with the best approach indicates
how close each of the inferior systems is to being the best. This information is useful in identifying other
good solutions; one of them may be needed if the best solution is ruled out because of secondary
MS&E 223 Lecture Notes #11
Simulation Making Decisions via Simulation
Peter J. Haas Spring Quarter 2003-04
Page 7 of 9
considerations (ease of implementation, maintenance costs, etc.). See Handbook of Simulation, Section
8.3.2 for further details.
Algorithm
1. Specify , , and an intial sample size n
0
(n
0
20).
2. For i = 1 to k, take an i.i.d. sample
0
in 2 i 1 i
Y , , Y , Y K
3. For i = 1 to k, compute
0
0
n
1 j
ij n
1
i
Y Y and ( )
0
0
n
1 j
2
i ij 1 n
1
2
i
Y Y s
4. Look of the value of h from Table 8.3 (given at the end of the lecture notes).
5. For i = 1 to k, Take N
i
n
0
additional samples Y
ij
, independent of the first-stage sample, where
N
i
=
,
_
1
1
1
1
,
_
2
i
0
hs
, n max
6. For i = 1 to k, compute
i
i
N
1 j
ij N
1
Y ) i (
7. Select the system with the largest value of (i) as the best
8. Form the simultaneous 100(1 )% confidence intervals for
i
as [a
i
, b
i
], where
a
i
= min(0, (i)
j i
max (j)
)
b
i
= max(0, (i)
j i
max (j)
+ ).
The justification of this algorithm is similar to (but more complicated than) the discussion in Section 10A in
Law and Kelton. See Rinotts 1978 paper in Commun. Statist. A: Theory and Methods for details. (The
algorithm presented here is simpler to execute, however, than the algorithm discussed in Law and Kelton.)
Remark: Improved versions of this procedure can be obtained through the use of common random
numbers. See Handbook of Simulation, Chapter 8.
3. Large Number of Alternatives: Discrete Stochastic Optimization
We wish to solve the problem ) ( f max
, where the value of f() is estimated using simulation and is
a very large set of discrete design alternatives. For example, might be the number of servers at a service
center and f() might be the expected value of the total revenue over a year of operation.
MS&E 223 Lecture Notes #11
Simulation Making Decisions via Simulation
Peter J. Haas Spring Quarter 2003-04
Page 8 of 9
Development of good random search algorithms is a topic of ongoing research. Most of the current
algorithms generate a sequence (
n
: n 0) with
n+1
N(
n
) {
n
}, where N() is a neighborhood of .
A currently-optimal solution
*
n
is maintained. The algorithms differ in the structure of the neighborhood,
the rule used to determine
n+1
from
n
, the rule used to compute
*
n
, and the rule used to stop the
algorithm.
We present a typical algorithm of this type (due to Andradottir) which uses a simulated annealing-type
rule to determine
n+1
from
n
. This rule usually accepts a better solution but, with a small probability,
sometimes accepts a worse solution in order to avoid getting stuck at a local maximum.
Algorithm
1. Fix T, N > 0. Select a starting point
0
, and generate an estimate ) ( f
0
of f(
0
) via simulation. Set
A(
0
) =
0
f ( ) and C(
0
) = 1. Set n = 0 and
0
*
0
.
2. Select a candidate solution
'
n
randomly and uniformly from {
n
}. Generate an estimate ) ( f
'
n
of ) ( f
'
n
via simulation.
3. If ) ( f
'
n
) ( f
n
, then set
n+1
=
'
n
. Otherwise, generate a random variable U distributed uniformly
on [0,1]. If
U
1
1
]
1
T
) ( f
) ( f
exp
n
'
n
then set
n+1
=
'
n
; otherwise, set
n+1
=
n
.
4. Set A(
n+1
) = A(
n+1
) + ) ( f
1 n +
and C(
n+1
) = C(
n+1
) + 1. If A(
n+1
)/ C(
n+1
) > ) ( A
*
n
/ ) ( C
*
n
,
then set
1 n
*
1 n + +
; otherwise, set
*
n
*
1 n
+
.
5. If n N return the final answer
*
1 n+
with estimated objective function value ) ( A
*
1 n+
/ ) ( C
*
1 n+
.
Otherwise, set n = n + 1 and go to Step 2.
In the above algorithm, the neighborhood was defined as N() = {}. If the problem has more
structure, the neighborhood may be defined in a problem-specific manner.
MS&E 223 Lecture Notes #11
Simulation Making Decisions via Simulation
Peter J. Haas Spring Quarter 2003-04
Page 9 of 9