話說現在住的鄰居真的很熱愛裝潢
上次布置了嚇人的鬼怪襯托萬聖節就算了
這兩天看到他們竟然布置好了聖誕節!!
一整個就是很有聖誕氣氛
一個大大的聖誕老人以及雪人在雪地中還有許多的燈光配置
讓人更感受到聖誕節的氣氛
不免俗的還是要入鏡一下...聖誕老公公真的好大一個喔
乾脆我們家門口放幾隻麋鹿跟禮物好了…
雪人竟然跟我一樣大XD
這一次的感恩節真的過得比較輕鬆了一點
其實實際上面並沒有太多的不同
還是一堆的作業跟事情要趕
但是今年我們稍微有去Outlet買一些東西
也跟幾個朋友聚餐吃吃東西… 玩了board game
不過假期真的很快就過去了
轉眼間又要面對學期的結束
還有相對應的作業跟計劃報告
看來接下來兩個星期要皮繃緊一點
才能夠順利的過完這學期
KC
Consider an arbitrary maximization (or minimization) problem where the objective function f(x,r) depends on some parameters r:
The function f *(r) is the problem's optimal-value function — it gives the maximized (or minimized) value of the objective function f(x,r)as a function of its parameters r.
Let x*(r) be the (arg max) value of x, expressed in terms of the parameters, that solves the optimisation problem, so that f*(r)=f(x*(r),r). The envelope theorem tells us how f*(r) changes as a parameter changes, namely:
That is, the derivative of f*(r) with respect to ri is given by the partial derivative of f(x,r) with respect to ri, holding x fixed, and then evaluating at the optimal choice x=x*(r).
http://en.wikipedia.org/wiki/Envelope_theoremThe Pollaczek-Khinchine formula is used in queuing theory to determine the mean time spent waiting in the queue to be serviced (the queuing delay) and the mean end-to-end time through the system. The formula is applicable in a single server situation with arrivals distributed according to a Poisson distribution and a general service time distribution. [Known as a M/G/1 system in Kendall's notation.] The formula was developed by Felix Pollaczek and Aleksandr Khinchin.
The formula states that the mean queuing delay is given by:
The average time in the system, F, is given by:
In the above equations, the variables are defined as:
λs=rate of service
λa=rate of arrival
, which is called "traffic intensity," ranges between 0 and 1, and is the mean fraction of time that the server is busy. [If the arrival rate λa is greater than or equal to the service rate λs, the queuing delay becomes infinite.]
Cs is the coefficient of variation of the service time (the ratio of its standard deviation to its mean). This equals σsλs, where σs is the standard deviation of the service time, as the mean service time is 1/λs. Cs = 0 when service times are constant, and Cs = 1 when service times follow an Exponential distribution.
If ρ equals 0.5, that is the server is busy 50% of the time, and Cs = 1, then
That is, when the server is busy only half the time, the mean queuing time equals the mean service time. That may help explain the long wait at the post office!
As ρ increases, the mean queuing time increases rapidly. If the server is 90% utilized, then the mean queuing delay is nine times the mean service time.
Note that, if the service time is always the same (Cs = 0), then the mean queuing delay is half what it would be if the service time were exponentially distributed (Cs = 1).
In Part II of this Monte Carlo Simulation example, we completed the actual simulation. (If you haven't already, Download the example spreadsheet). We ended up with a column of 5000 possible values (observations) for our single response variable, profit. The last step is to analyze the results. We will start off by creating a histogram in Excel, a graphical method for visualizing the results.
We can glean a lot of information from this histogram:
The histogram tells a good story, but in many cases, we want to estimate the probability of being below or above some value, or between a set of specification limits.
Method 1: Using the Histogram Tool in the Analysis Tool-Pak.
This is probably the easiest method, but you have to re-run the tool each to you do a new simulation. AND, you still need to create an array of bins (which will be discussed below).
Method 2: Using the FREQUENCY function in Excel.
This is the method used in the spreadsheet for the sales forecast example. One of the reasons I like this method is that you can make the histogram dynamic, meaning that every time you re-run the MC simulation, the chart will automatically update. This is how you do it:
Step 1: Create an array of binsThe figure below shows how to easily create a dynamic array of bins. This is a basic technique for creating an array of N evenly spaced numbers.
To create the dynamic array, enter the following formulas:
B6 = $B$2
B7 = B6+($B$3-$B$2)/5
Then, copy cell B7 down to B11
After you create the array of bins, you can go ahead and use the Histogram tool, or you can proceed with the next step.
Step 2: Use Excel's FREQUENCY formula
The next figure is a screen shot from the example Monte Carlo simulation. I'm not going to explain the FREQUENCY function in detail since you can look it up in the Excel's help file. But, one thing to remember is that it is an array function, and after you enter the formula, you will need to press Ctrl+Shift+Enter. Note that the simulation results (Profit) are in column G and there are 5000 data points ( Points: J5=COUNT(G:G) ).
The Formula for the Count column:
FREQUENCY(data_array,bins_array)
a) Select cells J8:J48
b) Enter the array formula: {=FREQUENCY(G:G,I8:I48)}
c) Press Ctrl+Shift+Enter
Creating a Scaled Histogram
If you want to compare your histogram with a probability distribution, you will need to scale the histogram so that the area under the curve is equal to 1 (one of the properties of probability distributions). Histograms normally include the count of the data points that fall into each bin on the y-axis, but after scaling, the y-axis will be the frequency (a not-so-easy-to-interpret number that in all practicality you can just not worry about). The frequency doesn't represent probability!
To scale the histogram, use the following method:
Scaled = (Count/Points) / (BinSize)
a) K8 = (J8/$J$5)/($I$9-$I$8)
b) Copy cell K8 down to K48
c) Press F9 to force a recalculation (may take a while)
Step 3: Create the Histogram Chart
Bar Chart, Line Chart, or Area Chart:
To create the histogram, just create a bar chart using the Bins column for the Labels and the Count or Scaled column as the Values. Tip: To reduce the spacing between the bars, right-click on the bars and select "Format Data Series...". Then go to the Options tab and reduce the Gap. Figure 1 above was created this way.
A More Flexible Histogram Chart
One of the problems with using bar charts and area charts is that the numbers on the x-axis is actually just labels. This can make it very difficult to overlay data that uses a different number of points or to show the proper scale when bins are not all the same size. However, you CAN use a scatter plot to create a histogram. After creating a line using the Bins column for the X Values and Count or Scaled column for the Y Values, add Y Error Bars to the line that extend down to the x-axis (by setting the Percentage to 100%). You can right-click on these error bars to change the line widths, color, etc.