IpoptSolve() приватный Метод

private IpoptSolve ( IntPtr ipopt_problem, double x, double g, double &obj_val, double mult_g, double mult_x_L, double mult_x_U, IntPtr p_user_data ) : IpoptReturnCode
ipopt_problem System.IntPtr
x double
g double
obj_val double
mult_g double
mult_x_L double
mult_x_U double
p_user_data System.IntPtr
Результат IpoptReturnCode
Пример #1
0
        public void IpoptSolve_SpecifiedStartGuess_YieldsExpectedOptimalVariables()
        {
            var    actual = new[] { 10.0, 10.0, 10.0 };
            double obj;

            var expected = new[] { 24.0, 12.0, 12.0 };

            IpoptAdapter.IpoptSolve(_instance, actual, null, out obj, null, null, null, IntPtr.Zero);
            CollectionAssert.AreEqual(expected, actual, new DoubleComparer(1.0e-5));
        }
Пример #2
0
        public void IpoptSolve_SpecifiedStartGuess_ReturnsSucceededStatus()
        {
            var    x = new[] { 10.0, 10.0, 10.0 };
            double obj;

            const IpoptReturnCode expected = IpoptReturnCode.Solve_Succeeded;
            var actual = IpoptAdapter.IpoptSolve(_instance, x, null, out obj, null, null, null, IntPtr.Zero);

            Assert.AreEqual(expected, actual);
        }
Пример #3
0
        public IpoptReturnCode SolveProblem(double[] x, out double obj_val, double[] g, double[] mult_g,
                                            double[] mult_x_L, double[] mult_x_U)
#endif
        {
            if (!IsInitialized)
            {
                obj_val = PositiveInfinity;
                return(IpoptReturnCode.Problem_Not_Initialized);
            }
            return(IpoptAdapter.IpoptSolve(m_problem, x, g, out obj_val, mult_g, mult_x_L, mult_x_U, IntPtr.Zero));
        }
Пример #4
0
        public void IpoptSolve_SpecifiedStartGuess_YieldsExpectedOptimalObjectiveValue()
        {
            const double expected = -3456.0;

            var    x = new[] { 10.0, 10.0, 10.0 };
            double actual;

            IpoptAdapter.IpoptSolve(_instance, x, null, out actual, null, null, null, IntPtr.Zero);

            Assert.AreEqual(expected, actual, 1.0e-3);
        }
Пример #5
0
        public void SetIntermediateCallback_CallbackFunctionDefined_CallbackFunctionCalled()
        {
            const bool expected = true;

            IpoptAdapter.SetIntermediateCallback(_instance, _hs037.intermediate);
            _hs037.hasIntermediateBeenCalled = false;

            var    x = new[] { 10.0, 10.0, 10.0 };
            double obj;

            IpoptAdapter.IpoptSolve(_instance, x, null, out obj, null, null, null, IntPtr.Zero);
            var actual = _hs037.hasIntermediateBeenCalled;

            Assert.AreEqual(expected, actual);
        }