Accord.Tests.Interop.Math.LbfgsbComparer.Actual C# (CSharp) Méthode

Actual() public méthode

public Actual ( Specification problem ) : Accord.Math.Optimization.OptimizationProgressEventArgs[]
problem Specification
Résultat Accord.Math.Optimization.OptimizationProgressEventArgs[]
        public OptimizationProgressEventArgs[] Actual(Specification problem)
        {
            ActualMessage = String.Empty;

            BoundedBroydenFletcherGoldfarbShanno target =
                new BoundedBroydenFletcherGoldfarbShanno(problem.Variables)
            {
                FunctionTolerance = factr,
                GradientTolerance = pgtol,
                Corrections = m,
                MaxIterations = max_iterations
            };

            for (int i = 0; i < target.LowerBounds.Length; i++)
            {
                if (l != null)
                    target.LowerBounds[i] = l[i];
                if (u != null)
                    target.UpperBounds[i] = u[i];
            }


            target.Function = problem.Function;
            target.Gradient = problem.Gradient;

            actual.Clear();
            target.Progress += new EventHandler<OptimizationProgressEventArgs>(target_Progress);

            target.Minimize((double[])problem.Start.Clone());

            if (target.Status == BoundedBroydenFletcherGoldfarbShannoStatus.GradientConvergence)
                ActualMessage = "CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL";
            else if (target.Status == BoundedBroydenFletcherGoldfarbShannoStatus.FunctionConvergence)
                ActualMessage = "CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH";
            else if (target.Status == BoundedBroydenFletcherGoldfarbShannoStatus.LineSearchFailed)
                ActualMessage = "ABNORMAL_TERMINATION_IN_LNSRCH";

            return actual.ToArray();
        }

Usage Example

        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);
            }
        }
All Usage Examples Of Accord.Tests.Interop.Math.LbfgsbComparer::Actual