heal-research / SimSharp

Sim# is a .NET port of SimPy, process-based discrete event simulation framework
MIT License
126 stars 30 forks source link

TimeoutNormalPositive #30

Closed AltL90 closed 4 years ago

AltL90 commented 4 years ago

I don't thinks (TimeoutNormalPositive) works correctly. It has two input variables TimeMu and TimeSigma. The way I understood it is ==> TimeOut = TimeMu +- TimeSigma If so why my program delivers something else?

My program is just the simple shop example, but without the packer. It shows how much time would it take the machine to produce all of the products.

In the Program TimeMu = 30 s and TimeSigma = 10 s Take a look at result Line 18 (Machine production time: 00:00:08.6190997)

program program.txt results res.txt

abeham commented 4 years ago

Difficult to say, can you be more specific in what you think is wrong? The presence of a single value of 8.6 seconds is not really an indication that something is wrong. What makes you think 8.6s would be an outlier? There is a 1.6% chance to obtain a value that is at most 8.6 if you sample from N(30, 10). With 240 samples as you have in your data, there is a 97.9% chance to obtain at least one value that is 8.6 or less.

Here is the density estimation of your samples overlaid with 5 density estimations from actual normal distributions. Note that your peak is shifted to the right, because NormalPositive is implemented using rejection sampling and thus resampling until a positive value is obtained. As you see below, a normal distribution would even return negative values given these distribution parameters.

image

AltL90 commented 4 years ago

Apparently I misunderstood I thought that N(30, 10) that I will get values between 30+10 = 40 and 30-10= 20 what I realy needed is TimeoutTriangular with min, max, mean Thanks for the clearification and sorry

abeham commented 4 years ago

Btw, please use the latest version (3.3.1 at this time), at least if you intend to use RandLogNormal2 or TimeoutLogNormal2.

AltL90 commented 4 years ago

will do!! thanks