using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BCMToolbox.Statistics { [Serializable] public class StaticBoundessTest { public readonly bool WeightsBounded = true; public readonly bool PotentialsBounded = true; public StaticBoundessTest(INetwork net, int testRuns, int testLength) { for (int i = 0; i < testRuns; i++) { net.Initialize(0.10, 0.50); for (int j = 0; j < testLength; j++) net.Propagate(); BasicStats bs1 = new BasicStats(net); net.Propagate(); BasicStats bs2 = new BasicStats(net); if (Math.Abs(bs1.AverageWeight - bs2.AverageWeight) > (0.005 * bs1.AverageWeight)) WeightsBounded = false; if (Math.Abs(bs1.AveragePotential - bs2.AveragePotential) > (0.05 * bs1.AveragePotential)) PotentialsBounded = false; } } public StaticBoundessTest(INetwork net) : this(net, 5, 100) { } public override string ToString() { return String.Format("wt bounded: {0} | out bounded: {1}", WeightsBounded.ToString(), PotentialsBounded.ToString()); } } }