Optimization progress event arguments.
Inheritance: System.EventArgs
        private static void check(OptimizationProgressEventArgs[] actual, Info[] expected)
        {
            Assert.AreEqual(expected.Length, actual.Length);
            for (int i = 0; i < expected.Length; i++)
            {
                var a = (BoundedBroydenFletcherGoldfarbShannoInnerStatus)actual[i].Tag;
                var e = expected[i];

                Assert.AreEqual(e.Iteration, actual[i].Iteration);
                Assert.AreEqual(e.Value, actual[i].Value);

                for (int j = 0; j < a.Work.Length; j++)
                    Assert.AreEqual(e.Work[j], a.Work[j]);

                for (int j = 0; j < actual[i].Gradient.Length; j++)
                    Assert.AreEqual(e.Gradient[j], actual[i].Gradient[j]);

                for (int j = 0; j < a.Integers.Length; j++)
                    Assert.AreEqual(e.isave[j], a.Integers[j]);

                for (int j = 0; j < a.Doubles.Length; j++)
                {
                    Assert.AreEqual(Double.IsNaN(e.dsave[j]), Double.IsNaN(a.Doubles[j]));
                    if (!Double.IsNaN(e.dsave[j]))
                        Assert.AreEqual(e.dsave[j], a.Doubles[j], 1e-200);
                }

                for (int j = 0; j < a.Booleans.Length; j++)
                    Assert.AreEqual(e.lsave[j], a.Booleans[j] ? 1 : 0);

                String trim = e.csave.Trim();
                Assert.AreEqual(trim, a.Strings);
            }
        }
Esempio n. 2
0
 void target_Progress(object sender, OptimizationProgressEventArgs e)
 {
     actual.Add(e);
 }