public void ValidateMissingStatisticsAsContinuousStatistics() { MissingStatistics boolStat1 = MissingStatistics.GetInstance; ContinuousStatistics cStat = boolStat1.AsContinuousStatistics(); Assert.IsTrue(cStat.IsMissing()); }
public void ValidateContinuousStatisticsAsStatisticsList() { ContinuousStatistics boolStat1 = ContinuousStatistics.GetInstance(5); StatisticsList dStat = boolStat1.AsStatisticsList(); Assert.AreEqual(boolStat1, dStat.AsContinuousStatistics()); }
public void ValidateContinuousStatisticsExplicitInt() { DiscreteStatistics discreteStat2 = DiscreteStatistics.GetInstance(5); ContinuousStatistics boolStat2 = (ContinuousStatistics)discreteStat2; Assert.AreEqual(5, (int)boolStat2); Assert.AreEqual(5, (double)boolStat2); try { DiscreteStatistics discreteStat = DiscreteStatistics.GetMissingInstance; ContinuousStatistics boolStat1 = (ContinuousStatistics)discreteStat; int temp = (int)boolStat1; } catch (ArgumentException) { Console.WriteLine("ContinuousStatistics : Successfully validated the int(0)"); } DiscreteStatistics discreteStat3 = null; try { ContinuousStatistics boolStat3 = (ContinuousStatistics)discreteStat3; int integerCS = (int)boolStat3; Assert.Fail(); } catch (ArgumentException) { Console.WriteLine("BooleanStatistics : Successfully validated the int(booleanstatistics)"); } }
public void ValidateBooleanStatisticsAsContinuousStatistics() { BooleanStatistics boolStat1 = BooleanStatistics.GetInstance(true); ContinuousStatistics cStat = boolStat1.AsContinuousStatistics(); Assert.AreEqual(1, cStat.Value); }
public void ValidateGaussianStatisticsAsContinuousStatistics() { GaussianStatistics boolStat1 = GaussianStatistics.GetInstance(5, 2, 2); ContinuousStatistics cStat = boolStat1.AsContinuousStatistics(); Assert.AreEqual(5, cStat.AsGaussianStatistics().Mean); }
public void ValidateContinuousStatisticsToString() { ContinuousStatistics continousStat1 = ContinuousStatistics.GetInstance(1); ContinuousStatistics continousStat2 = ContinuousStatistics.GetMissingInstance; Assert.AreEqual(continousStat1.Value.ToString((IFormatProvider)null), continousStat1.ToString()); Assert.AreEqual("Missing", continousStat2.ToString()); }
public void ValidateContinuousStatisticsTryParse() { SufficientStatistics result = null; ContinuousStatistics continousStat = ContinuousStatistics.GetInstance(1.25658); Assert.IsTrue(ContinuousStatistics.TryParse("1.25658", out result)); Assert.IsTrue(continousStat.Equals(result)); }
public void ValidateContinuousStatisticsExplicitMissingStatistics() { MissingStatistics missStat = MissingStatistics.GetInstance; ContinuousStatistics boolStat2 = (ContinuousStatistics)missStat; Assert.IsTrue(boolStat2.IsMissing()); MissingStatistics missStat2 = null; Assert.IsNull((ContinuousStatistics)missStat2); }
public void Simulate() { queueSize = 0; env = new Environment(); server = new Resource(env, capacity: 1); statistics = new ContinuousStatistics(env); env.Log("== m/m/1 queuing system =="); env.Process(Source()); env.Run(TimeSpan.FromDays(180)); Console.WriteLine("QueueSize Statistics:"); Console.WriteLine("Min: {0}; Max: {1}; Mean: {2:F2}; StdDev: {3:F2}", statistics.Min, statistics.Max, statistics.Mean, statistics.StdDev); }
public void Simulate() { queueSize = 0; env = new Environment(); server = new Resource(env, capacity: 1); statistics = new ContinuousStatistics(env); env.Log("== m/m/1 queuing system =="); env.Process(Source()); env.Run(TimeSpan.FromDays(180)); Console.WriteLine("QueueSize Statistics:"); Console.WriteLine("Min: {0}; Max: {1}; Mean: {2:F2}; StdDev: {3:F2}", statistics.Min, statistics.Max, statistics.Mean, statistics.StdDev); }
public void Simulate() { completedOrders = 0; env = new Environment(); env.Log("== Kanban controlled production system =="); kanban = new Resource(env, capacity: 15); server = new Resource(env, capacity: 1); stockStat = new ContinuousStatistics(env); env.Process(Source()); env.Run(TimeSpan.FromDays(180)); Console.WriteLine("Stock: {0} ; {1:F3}±{2:F3} ; {3} (Min;Mean±StdDev;Max) kanbans ", stockStat.Min, stockStat.Mean, stockStat.StdDev, stockStat.Max); Console.WriteLine("Produced kanbans: {0:N0}", completedOrders); }
public void Simulate() { completedOrders = 0; env = new Environment(); env.Log("== Kanban controlled production system =="); kanban = new Resource(env, capacity: 15); server = new Resource(env, capacity: 1); stockStat = new ContinuousStatistics(env); env.Process(Source()); env.Run(TimeSpan.FromDays(180)); Console.WriteLine("Stock: {0} ; {1:F3}±{2:F3} ; {3} (Min;Mean±StdDev;Max) kanbans ", stockStat.Min, stockStat.Mean, stockStat.StdDev, stockStat.Max); Console.WriteLine("Produced kanbans: {0:N0}", completedOrders); }
public void ValidateStatisticsListAsContinuousStatistics() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); MissingStatistics missingStat = MissingStatistics.GetInstance; statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(missingStat); ContinuousStatistics cStat = statList.AsContinuousStatistics(); Assert.IsTrue(cStat.IsMissing()); }
public void ValidateContinuousStatisticsExplicitDiscrete() { DiscreteStatistics discreteStat2 = DiscreteStatistics.GetInstance(5); ContinuousStatistics boolStat2 = (ContinuousStatistics)discreteStat2; Assert.AreEqual(5, (int)(DiscreteStatistics)boolStat2); DiscreteStatistics discreteStat = DiscreteStatistics.GetMissingInstance; ContinuousStatistics boolStat1 = (ContinuousStatistics)discreteStat; Assert.AreEqual(discreteStat, (DiscreteStatistics)boolStat1); DiscreteStatistics discreteStat3 = null; Assert.IsNull((ContinuousStatistics)discreteStat3); }
public void TestContinuousStatisticsSimple() { var env = new Environment(); var times = new double[] { 0, 1, 1, 1, 1, 1 }; var values = new double[] { 6, 2, 3, 5, -1, -4 }; var stat = new ContinuousStatistics(env); foreach (var v in times.Zip(values, Tuple.Create)) { if (v.Item1 > 0) env.RunD(v.Item1); stat.Update(v.Item2); } Assert.AreEqual(-4, stat.Min); Assert.AreEqual(6, stat.Max); Assert.AreEqual(3, stat.Mean, 1e-12); Assert.AreEqual(6, stat.Variance, 1e-12); Assert.AreEqual(15, stat.Area); }
public void TestContinuousStatisticsComplex2() { var env = new Environment(); var times = new double[] { 1, 1, 1, 2, 0, 0, 4, 7, 4 }; var values = new double[] { 3, -2, 5, 6, -4, 1, 0, -2, 3 }; var stat = new ContinuousStatistics(env); foreach (var v in times.Zip(values, Tuple.Create)) { if (v.Item1 > 0) env.RunD(v.Item1); stat.Update(v.Item2); } Assert.AreEqual(-4, stat.Min); Assert.AreEqual(6, stat.Max); Assert.AreEqual(0.3684210526315789, stat.Mean, 1e-12); Assert.AreEqual(4.232686980609418, stat.Variance, 1e-12); Assert.AreEqual(7, stat.Area); }
public void ValidateContinuousStatisticsEquals() { SufficientStatistics suffStat = ContinuousStatistics.GetInstance(2); ContinuousStatistics continousStat = ContinuousStatistics.GetMissingInstance; Assert.IsFalse(continousStat.Equals(suffStat)); suffStat = (SufficientStatistics)continousStat; Assert.IsTrue(continousStat.Equals(suffStat)); continousStat = ContinuousStatistics.GetInstance(1.23565); suffStat = (SufficientStatistics)continousStat; Assert.IsTrue(continousStat.Equals(suffStat)); object suffStatObj = (object)continousStat; Assert.IsTrue(continousStat.Equals(suffStat)); }
public void ValidateStatisticsListRemoveRangeAndRemove() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); ContinuousStatistics contStat = ContinuousStatistics.GetInstance(2.333); MissingStatistics missingStat = MissingStatistics.GetInstance; BooleanStatistics boolStat = BooleanStatistics.GetInstance(true); statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(contStat); statList.Add(missingStat); statList.Add(boolStat); Assert.AreEqual(5, statList.Count); statList.RemoveRange(3, 2); Assert.AreEqual(3, statList.Count); statList.Remove(2); Assert.AreEqual(2, statList.Count); }
public void TestContinuousStatisticsComplex() { var env = new Environment(); var times = new double[] { 0, 10, 0, 1, 1, 1, 1 }; var values = new double[] { 0, 6, 2, 3, 5, -1, -4 }; var stat = new ContinuousStatistics(env); foreach (var v in times.Zip(values, Tuple.Create)) { if (v.Item1 > 0) { env.RunD(v.Item1); } stat.Update(v.Item2); } Assert.AreEqual(-4, stat.Min); Assert.AreEqual(6, stat.Max); Assert.AreEqual(0.642857142857, stat.Mean, 1e-12); Assert.AreEqual(2.372448979592, stat.Variance, 1e-12); Assert.AreEqual(9, stat.Area); }
public void TestContinuousStatisticsComplex2() { var env = new Environment(); var times = new double[] { 1, 1, 1, 2, 0, 0, 4, 7, 4 }; var values = new double[] { 3, -2, 5, 6, -4, 1, 0, -2, 3 }; var stat = new ContinuousStatistics(env); foreach (var v in times.Zip(values, Tuple.Create)) { if (v.Item1 > 0) { env.RunD(v.Item1); } stat.Update(v.Item2); } Assert.AreEqual(-4, stat.Min); Assert.AreEqual(6, stat.Max); Assert.AreEqual(0.3684210526315789, stat.Mean, 1e-12); Assert.AreEqual(4.232686980609418, stat.Variance, 1e-12); Assert.AreEqual(7, stat.Area); }
public void ValidateStatisticsListTryParse() { StatisticsList statList = new StatisticsList(); GaussianStatistics gaussStat = GaussianStatistics.GetInstance(2.33, 1.256, 7); DiscreteStatistics discreteStat = DiscreteStatistics.GetInstance(1); ContinuousStatistics contStat = ContinuousStatistics.GetInstance(2.333); MissingStatistics missingStat = MissingStatistics.GetInstance; BooleanStatistics boolStat = BooleanStatistics.GetInstance(true); statList.Add(gaussStat); statList.Add(discreteStat); statList.Add(contStat); statList.Add(missingStat); statList.Add(boolStat); Assert.AreEqual(5, statList.Count); SufficientStatistics result = null; StatisticsList statListSubSequence = (StatisticsList)statList.SubSequence(0, 2); Assert.IsTrue(StatisticsList.TryParse(statList.ToString(), out result)); Assert.IsTrue(StatisticsList.TryParse(statListSubSequence.ToString(), out result)); }
public void ValidateContinuousStatisticsProperties() { ContinuousStatistics continousStat = ContinuousStatistics.GetInstance(1.25658); Assert.AreEqual(1.25658, continousStat.Value); }
public void ValidateContinuousStatisticsGetMissingInstance() { ContinuousStatistics continousStat = ContinuousStatistics.GetMissingInstance; Assert.IsTrue(continousStat.IsMissing()); }
public void ValidateContinuousStatisticsGetHashCode() { ContinuousStatistics boolStat1 = ContinuousStatistics.GetInstance(5); Assert.AreEqual(1075052544, boolStat1.GetHashCode()); }