예제 #1
0
        public void DefaultBatchTest()
        {
            foreach (var problem in problems)
            {
                LbfgsbComparer cmp = new LbfgsbComparer();

                var expected = cmp.Expected(problem);
                var actual   = cmp.Actual(problem);

                check(actual, expected);
            }
        }
예제 #2
0
        private static void compute(List <Specification> problems, LbfgsbComparer cmp)
        {
            foreach (var problem in problems)
            {
                string actualStr   = String.Empty;
                string expectedStr = String.Empty;

                cmp.l = null;
                cmp.u = null;

                OptimizationProgressEventArgs[] actual = null;

                try { actual = cmp.Actual(problem); }
                catch (Exception ex)
                {
                    actualStr = ex.Data["Code"] as string;
                    if (actualStr == null)
                    {
                        throw;
                    }
                }

                var expected = cmp.Expected(problem);
                expectedStr = cmp.NativeCode;

                if (actualStr == String.Empty)
                {
                    actualStr = cmp.ActualMessage;
                }

                Assert.AreEqual(expectedStr, actualStr);


                check(actual, expected);
            }
        }