Accord.Tests.Math.CobylaTest.ConstructorTest6_3 C# (CSharp) Method

ConstructorTest6_3() private method

private ConstructorTest6_3 ( ) : void
return void
        public void ConstructorTest6_3()
        {
            bool thrown = false;

            try
            {
                var function = new NonlinearObjectiveFunction(2, x => -x[0] - x[1]);

                NonlinearConstraint[] constraints = 
                {
                    new NonlinearConstraint(2, x =>  x[1] - x[0] * x[0]),
                    new NonlinearConstraint(4, x =>  1.0 - x[0] * x[0] - x[1] * x[1]),
                };

                Cobyla cobyla = new Cobyla(function, constraints);

                Assert.IsTrue(cobyla.Minimize());
                double minimum = cobyla.Value;
            }
            catch (Exception)
            {
                thrown = true;
            }

            Assert.IsTrue(thrown);
        }