Line | |
---|
1 | using System; |
---|
2 | using System.Collections.Generic; |
---|
3 | using System.Linq; |
---|
4 | using System.Text; |
---|
5 | |
---|
6 | namespace BCMToolbox.Statistics |
---|
7 | { |
---|
8 | [Serializable] |
---|
9 | public class StaticBoundessTest |
---|
10 | { |
---|
11 | public readonly bool WeightsBounded = true; |
---|
12 | public readonly bool PotentialsBounded = true; |
---|
13 | |
---|
14 | |
---|
15 | public StaticBoundessTest(INetwork net, int testRuns, int testLength) |
---|
16 | { |
---|
17 | for (int i = 0; i < testRuns; i++) |
---|
18 | { |
---|
19 | net.Initialize(0.10, 0.50); |
---|
20 | for (int j = 0; j < testLength; j++) |
---|
21 | net.Propagate(); |
---|
22 | |
---|
23 | BasicStats bs1 = new BasicStats(net); |
---|
24 | net.Propagate(); |
---|
25 | BasicStats bs2 = new BasicStats(net); |
---|
26 | if (Math.Abs(bs1.AverageWeight - bs2.AverageWeight) > (0.005 * bs1.AverageWeight)) |
---|
27 | WeightsBounded = false; |
---|
28 | |
---|
29 | if (Math.Abs(bs1.AveragePotential - bs2.AveragePotential) > (0.05 * bs1.AveragePotential)) |
---|
30 | PotentialsBounded = false; |
---|
31 | } |
---|
32 | } |
---|
33 | |
---|
34 | public StaticBoundessTest(INetwork net) |
---|
35 | : this(net, 5, 100) |
---|
36 | { |
---|
37 | } |
---|
38 | |
---|
39 | public override string ToString() |
---|
40 | { |
---|
41 | return String.Format("wt bounded: {0} | out bounded: {1}", |
---|
42 | WeightsBounded.ToString(), |
---|
43 | PotentialsBounded.ToString()); |
---|
44 | } |
---|
45 | } |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.