public override IpoptBoolType eval_jac_g(Int32 n, Double[] x, IpoptBoolType new_x, Int32 m, Int32 nele_jac,
                                          Int32[] iRow, Int32[] jCol, Double[] values, IntPtr p_user_data)
 {
     if (values == null)
     {
         for (var i = 0; i < iRow.Length; i++)
         {
             iRow[i] = this._jacobian.iRow[i];
         }
         for (var i = 0; i < jCol.Length; i++)
         {
             jCol[i] = this._jacobian.jCol[i];
         }
     }
     else
     {
         if (this._refreshJac)
         {
             this._jacobian = this._jacobianHelper.UpdateJacobian(x, this._constraints, this._jacobian);
         }
         //else
         //{
         for (var i = 0; i < values.Length; i++)
         {
             values[i] = this._jacobian.values[i];
         }
         //}
     }
     return(IpoptBoolType.True);
 }
Esempio n. 2
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac,
                                 int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     return(m_eval_jac_g_cb(n, x, new_x == IpoptBoolType.True, m, nele_jac, iRow, jCol, values)
                ? IpoptBoolType.True
                : IpoptBoolType.False);
 }
Esempio n. 3
0
 public IpoptBoolType eval_grad_f(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
 {
     grad_f[0] = -x[1] * x[2];
     grad_f[1] = -x[0] * x[2];
     grad_f[2] = -x[0] * x[1];
     return(IpoptBoolType.True);
 }
 public override IpoptBoolType eval_f(Int32 n, Double[] x, IpoptBoolType new_x, out Double obj_value,
                                      IntPtr p_user_data)
 {
     //Objective function
     obj_value = x.Select((d, i) => Math.Pow((d - this._averageValues[i]) / this._standardDeviations[i], 2)).Sum();
     return(IpoptBoolType.True);
 }
Esempio n. 5
0
        public override IpoptBoolType eval_g(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
        {
            g[0] = x[0] * x[1] * x[2] * x[3];
            g[1] = x[0] * x[0] + x[1] * x[1] + x[2] * x[2] + x[3] * x[3];

            return IpoptBoolType.True;
        }
Esempio n. 6
0
 public IpoptBoolType eval_grad_f(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
 {
     grad_f[0] = -x[1] * x[2];
     grad_f[1] = -x[0] * x[2];
     grad_f[2] = -x[0] * x[1];
     return IpoptBoolType.True;
 }
Esempio n. 7
0
        public override IpoptBoolType eval_g(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
        {
            g[0] = x[0] * x[1] * x[2] * x[3];
            g[1] = x[0] * x[0] + x[1] * x[1] + x[2] * x[2] + x[3] * x[3];

            return(IpoptBoolType.True);
        }
Esempio n. 8
0
        public IpoptBoolType eval_jac_g(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac,
                                        int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
        {
            if (values == null)
            {
                /* set the structure of the jacobian */
                /* this particular jacobian is dense */

                iRow[0] = 0;
                jCol[0] = 0;
                iRow[1] = 0;
                jCol[1] = 1;
                iRow[2] = 0;
                jCol[2] = 2;
            }
            else
            {
                /* return the values of the jacobian of the constraints */

                values[0] = 1.0; /* 0,0 */
                values[1] = 2.0; /* 0,1 */
                values[2] = 2.0; /* 0,2 */
            }

            return(IpoptBoolType.True);
        }
Esempio n. 9
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda,
                                 IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     return(m_eval_h_cb(n, x, new_x == IpoptBoolType.True, obj_factor, m, lambda,
                        new_lambda == IpoptBoolType.True, nele_hess, iRow, jCol, values)
                ? IpoptBoolType.True
                : IpoptBoolType.False);
 }
Esempio n. 10
0
        public override IpoptBoolType eval_grad_f(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
        {
            grad_f[0] = x[0] * x[3] + x[3] * (x[0] + x[1] + x[2]);
            grad_f[1] = x[0] * x[3];
            grad_f[2] = x[0] * x[3] + 1;
            grad_f[3] = x[0] * (x[0] + x[1] + x[2]);

            return(IpoptBoolType.True);
        }
Esempio n. 11
0
        public override IpoptBoolType eval_grad_f(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
        {
            grad_f[0] = x[0] * x[3] + x[3] * (x[0] + x[1] + x[2]);
            grad_f[1] = x[0] * x[3];
            grad_f[2] = x[0] * x[3] + 1;
            grad_f[3] = x[0] * (x[0] + x[1] + x[2]);

            return IpoptBoolType.True;
        }
 public override IpoptBoolType eval_grad_f(Int32 n, Double[] x, IpoptBoolType new_x, Double[] grad_f,
                                           IntPtr p_user_data)
 {
     for (var i = 0; i < x.Length; i++)
     {
         grad_f[i] = 2 * ((x[i] - this._averageValues[i]) / this._standardDeviations[i]) *
                     (1 / this._standardDeviations[i]);
     }
     return(IpoptBoolType.True);
 }
        public override IpoptBoolType eval_g(Int32 n, Double[] x, IpoptBoolType new_x, Int32 m, Double[] g,
                                             IntPtr p_user_data)
        {
            //Contstraints
            var updatedConstraints = this._constraints(x);

            for (var i = 0; i < updatedConstraints.Length; i++)
            {
                g[i] = updatedConstraints[i];
            }
            return(IpoptBoolType.True);
        }
Esempio n. 14
0
        public override IpoptBoolType eval_h(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda,
                                             IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
        {
            if (values == null)
            {
                /* set the Hessian structure. This is a symmetric matrix, fill the lower left
                 * triangle only. */

                /* the hessian for this problem is actually dense */
                int idx = 0; /* nonzero element counter */
                for (int row = 0; row < 4; row++)
                {
                    for (int col = 0; col <= row; col++)
                    {
                        iRow[idx] = row;
                        jCol[idx] = col;
                        idx++;
                    }
                }
            }
            else
            {
                /* fill the objective portion */
                values[0] = 0.0;                            /* 0,0 */

                values[1] = obj_factor * (-x[2] * x[3]);    /* 1,0 */
                values[2] = 0.0;                            /* 1,1 */

                values[3] = obj_factor * (-x[1] * x[3]);    /* 2,0 */
                values[4] = obj_factor * (-x[0] * x[3]);    /* 2,1 */
                values[5] = 0.0;                            /* 2,2 */

                values[6] = obj_factor * (-x[1] * x[2]);    /* 3,0 */
                values[7] = obj_factor * (-x[0] * x[2]);    /* 3,1 */
                values[8] = obj_factor * (-x[0] * x[1]);    /* 3,2 */
                values[9] = 0.0;                            /* 3,3 */

                /* add the portion for the first constraint */
                values[0] += lambda[0] * (6.0 * x[0]);                      /* 0,0 */

                values[2] += lambda[0] * 2.0;                               /* 1,1 */

                /* add the portion for the second constraint */
                values[0] += lambda[1] * (2.0 * x[3]);                      /* 0,0 */

                values[6] += lambda[1] * (2.0 * x[0]);                      /* 3,0 */

                /* add the portion for the third constraint */
                values[9] += lambda[2] * 2.0;                               /* 3,3 */
            }
            return(IpoptBoolType.True);
        }
Esempio n. 15
0
            internal IpoptBoolType Evaluate(int n, IntPtr p_x, IpoptBoolType new_x, double obj_factor, int m, IntPtr p_lambda,
                                            IpoptBoolType new_lambda, int nele_hess, IntPtr p_iRow, IntPtr p_jCol, IntPtr p_values, IntPtr p_user_data)
            {
                var x      = new double[n];
                var lambda = new double[m];
                var iRow   = new int[nele_hess];
                var jCol   = new int[nele_hess];

                if (p_x != IntPtr.Zero)
                {
                    Marshal.Copy(p_x, x, 0, n);
                }
                if (p_lambda != IntPtr.Zero)
                {
                    Marshal.Copy(p_lambda, lambda, 0, m);
                }
                if (p_iRow != IntPtr.Zero)
                {
                    Marshal.Copy(p_iRow, iRow, 0, nele_hess);
                }
                if (p_jCol != IntPtr.Zero)
                {
                    Marshal.Copy(p_jCol, jCol, 0, nele_hess);
                }
                var values = p_values != IntPtr.Zero ? new double[nele_hess] : null;

                var ret = m_eval_h_cb(n, x, new_x == IpoptBoolType.True, obj_factor, m, lambda,
                                      new_lambda == IpoptBoolType.True, nele_hess, iRow, jCol, values);

                if (p_values != IntPtr.Zero)
                {
                    Marshal.Copy(values, 0, p_values, nele_hess);
                }
                if (p_iRow != IntPtr.Zero)
                {
                    Marshal.Copy(iRow, 0, p_iRow, nele_hess);
                }
                if (p_jCol != IntPtr.Zero)
                {
                    Marshal.Copy(jCol, 0, p_jCol, nele_hess);
                }

                return(ret ? IpoptBoolType.True : IpoptBoolType.False);
            }
Esempio n. 16
0
        public override IpoptBoolType eval_jac_g(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac, 
            int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
        {
            if (values == null)
            {
                /* set the structure of the jacobian */
                /* this particular jacobian is dense */

                iRow[0] = 0;
                jCol[0] = 0;
                iRow[1] = 0;
                jCol[1] = 1;
                iRow[2] = 0;
                jCol[2] = 2;
                iRow[3] = 0;
                jCol[3] = 3;
                iRow[4] = 1;
                jCol[4] = 0;
                iRow[5] = 1;
                jCol[5] = 1;
                iRow[6] = 1;
                jCol[6] = 2;
                iRow[7] = 1;
                jCol[7] = 3;
            }
            else
            {
                /* return the values of the jacobian of the constraints */

                values[0] = x[1] * x[2] * x[3]; /* 0,0 */
                values[1] = x[0] * x[2] * x[3]; /* 0,1 */
                values[2] = x[0] * x[1] * x[3]; /* 0,2 */
                values[3] = x[0] * x[1] * x[2]; /* 0,3 */

                values[4] = 2 * x[0];         /* 1,0 */
                values[5] = 2 * x[1];         /* 1,1 */
                values[6] = 2 * x[2];         /* 1,2 */
                values[7] = 2 * x[3];         /* 1,3 */
            }

            return IpoptBoolType.True;
        }
Esempio n. 17
0
        public override IpoptBoolType eval_jac_g(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac,
                                                 int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
        {
            if (values == null)
            {
                /* set the structure of the jacobian */
                /* this particular jacobian is dense */

                iRow[0] = 0;
                jCol[0] = 0;
                iRow[1] = 0;
                jCol[1] = 1;
                iRow[2] = 0;
                jCol[2] = 2;
                iRow[3] = 0;
                jCol[3] = 3;
                iRow[4] = 1;
                jCol[4] = 0;
                iRow[5] = 1;
                jCol[5] = 1;
                iRow[6] = 1;
                jCol[6] = 2;
                iRow[7] = 1;
                jCol[7] = 3;
            }
            else
            {
                /* return the values of the jacobian of the constraints */

                values[0] = x[1] * x[2] * x[3]; /* 0,0 */
                values[1] = x[0] * x[2] * x[3]; /* 0,1 */
                values[2] = x[0] * x[1] * x[3]; /* 0,2 */
                values[3] = x[0] * x[1] * x[2]; /* 0,3 */

                values[4] = 2 * x[0];           /* 1,0 */
                values[5] = 2 * x[1];           /* 1,1 */
                values[6] = 2 * x[2];           /* 1,2 */
                values[7] = 2 * x[3];           /* 1,3 */
            }

            return(IpoptBoolType.True);
        }
Esempio n. 18
0
            internal IpoptBoolType Evaluate(int n, IntPtr p_x, IpoptBoolType new_x, int m, int nele_jac,
                                            IntPtr p_iRow, IntPtr p_jCol, IntPtr p_values, IntPtr p_user_data)
            {
                var x    = new double[n];
                var iRow = new int[nele_jac];
                var jCol = new int[nele_jac];

                if (p_x != IntPtr.Zero)
                {
                    Marshal.Copy(p_x, x, 0, n);
                }
                if (p_iRow != IntPtr.Zero)
                {
                    Marshal.Copy(p_iRow, iRow, 0, nele_jac);
                }
                if (p_jCol != IntPtr.Zero)
                {
                    Marshal.Copy(p_jCol, jCol, 0, nele_jac);
                }
                var values = p_values != IntPtr.Zero ? new double[nele_jac] : null;

                var ret = m_eval_jac_g_cb(n, x, new_x == IpoptBoolType.True, m, nele_jac, iRow, jCol, values);

                if (p_values != IntPtr.Zero)
                {
                    Marshal.Copy(values, 0, p_values, nele_jac);
                }
                if (p_iRow != IntPtr.Zero)
                {
                    Marshal.Copy(iRow, 0, p_iRow, nele_jac);
                }
                if (p_jCol != IntPtr.Zero)
                {
                    Marshal.Copy(jCol, 0, p_jCol, nele_jac);
                }

                return(ret ? IpoptBoolType.True : IpoptBoolType.False);
            }
Esempio n. 19
0
 public virtual IpoptBoolType eval_jac_g(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac,
     int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     throw new NotSupportedException("Jacobian evaluation should be implemented in subclass.");
 }
Esempio n. 20
0
 public IpoptBoolType eval_f(int n, double[] x, IpoptBoolType new_x, out double obj_value, IntPtr p_user_data)
 {
     obj_value = -x[0] * x[1] * x[2];
     return(IpoptBoolType.True);
 }
Esempio n. 21
0
            internal IpoptBoolType Evaluate(int n, IntPtr p_x, IpoptBoolType new_x, double obj_factor, int m, IntPtr p_lambda,
                IpoptBoolType new_lambda, int nele_hess, IntPtr p_iRow, IntPtr p_jCol, IntPtr p_values, IntPtr p_user_data)
            {
                var x = new double[n];
                var lambda = new double[m];
                var iRow = new int[nele_hess];
                var jCol = new int[nele_hess];

                if (p_x != IntPtr.Zero) Marshal.Copy(p_x, x, 0, n);
                if (p_lambda != IntPtr.Zero) Marshal.Copy(p_lambda, lambda, 0, m);
                if (p_iRow != IntPtr.Zero) Marshal.Copy(p_iRow, iRow, 0, nele_hess);
                if (p_jCol != IntPtr.Zero) Marshal.Copy(p_jCol, jCol, 0, nele_hess);
                var values = p_values != IntPtr.Zero ? new double[nele_hess] : null;

                var ret = m_eval_h_cb(n, x, new_x == IpoptBoolType.True, obj_factor, m, lambda,
                                new_lambda == IpoptBoolType.True, nele_hess, iRow, jCol, values);

                if (p_values != IntPtr.Zero) Marshal.Copy(values, 0, p_values, nele_hess);
                if (p_iRow != IntPtr.Zero) Marshal.Copy(iRow, 0, p_iRow, nele_hess);
                if (p_jCol != IntPtr.Zero) Marshal.Copy(jCol, 0, p_jCol, nele_hess);

                return ret ? IpoptBoolType.True : IpoptBoolType.False;
            }
Esempio n. 22
0
 public virtual IpoptBoolType eval_g(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
 {
     throw new NotSupportedException("Constraints evaluation should be implemented in subclass.");
 }
Esempio n. 23
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
 {
     return m_eval_g_cb(n, x, new_x == IpoptBoolType.True, m, g) ? IpoptBoolType.True : IpoptBoolType.False;
 }
Esempio n. 24
0
            internal IpoptBoolType Evaluate(int n, IntPtr p_x, IpoptBoolType new_x, int m, int nele_jac,
                IntPtr p_iRow, IntPtr p_jCol, IntPtr p_values, IntPtr p_user_data)
            {
                var x = new double[n];
                var iRow = new int[nele_jac];
                var jCol = new int[nele_jac];

                if (p_x != IntPtr.Zero) Marshal.Copy(p_x, x, 0, n);
                if (p_iRow != IntPtr.Zero) Marshal.Copy(p_iRow, iRow, 0, nele_jac);
                if (p_jCol != IntPtr.Zero) Marshal.Copy(p_jCol, jCol, 0, nele_jac);
                var values = p_values != IntPtr.Zero ? new double[nele_jac] : null;

                var ret = m_eval_jac_g_cb(n, x, new_x == IpoptBoolType.True, m, nele_jac, iRow, jCol, values);

                if (p_values != IntPtr.Zero) Marshal.Copy(values, 0, p_values, nele_jac);
                if (p_iRow != IntPtr.Zero) Marshal.Copy(iRow, 0, p_iRow, nele_jac);
                if (p_jCol != IntPtr.Zero) Marshal.Copy(jCol, 0, p_jCol, nele_jac);

                return ret ? IpoptBoolType.True : IpoptBoolType.False;
            }
Esempio n. 25
0
        public override IpoptBoolType eval_f(int n, double[] x, IpoptBoolType new_x, out double obj_value, IntPtr p_user_data)
        {
            obj_value = x[0] * x[3] * (x[0] + x[1] + x[2]) + x[2];

            return(IpoptBoolType.True);
        }
Esempio n. 26
0
        public IpoptBoolType eval_jac_g(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac, 
            int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
        {
            if (values == null)
            {
                /* set the structure of the jacobian */
                /* this particular jacobian is dense */

                iRow[0] = 0;
                jCol[0] = 0;
                iRow[1] = 0;
                jCol[1] = 1;
                iRow[2] = 0;
                jCol[2] = 2;
            }
            else
            {
                /* return the values of the jacobian of the constraints */

                values[0] = 1.0; /* 0,0 */
                values[1] = 2.0; /* 0,1 */
                values[2] = 2.0; /* 0,2 */
            }

            return IpoptBoolType.True;
        }
Esempio n. 27
0
        public override IpoptBoolType eval_h(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda, 
            IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
        {
            if (values == null)
            {
                /* set the Hessian structure. This is a symmetric matrix, fill the lower left
                 * triangle only. */

                /* the hessian for this problem is actually dense */
                int idx = 0; /* nonzero element counter */
                for (int row = 0; row < 4; row++)
                {
                    for (int col = 0; col <= row; col++)
                    {
                        iRow[idx] = row;
                        jCol[idx] = col;
                        idx++;
                    }
                }

            }
            else
            {
                /* return the values. This is a symmetric matrix, fill the lower left
                 * triangle only */

                /* fill the objective portion */
                values[0] = obj_factor * (2 * x[3]);               /* 0,0 */

                values[1] = obj_factor * (x[3]);                 /* 1,0 */
                values[2] = 0;                                   /* 1,1 */

                values[3] = obj_factor * (x[3]);                 /* 2,0 */
                values[4] = 0;                                   /* 2,1 */
                values[5] = 0;                                   /* 2,2 */

                values[6] = obj_factor * (2 * x[0] + x[1] + x[2]); /* 3,0 */
                values[7] = obj_factor * (x[0]);                 /* 3,1 */
                values[8] = obj_factor * (x[0]);                 /* 3,2 */
                values[9] = 0;                                   /* 3,3 */


                /* add the portion for the first constraint */
                values[1] += lambda[0] * (x[2] * x[3]);          /* 1,0 */

                values[3] += lambda[0] * (x[1] * x[3]);          /* 2,0 */
                values[4] += lambda[0] * (x[0] * x[3]);          /* 2,1 */

                values[6] += lambda[0] * (x[1] * x[2]);          /* 3,0 */
                values[7] += lambda[0] * (x[0] * x[2]);          /* 3,1 */
                values[8] += lambda[0] * (x[0] * x[1]);          /* 3,2 */

                /* add the portion for the second constraint */
                values[0] += lambda[1] * 2;                      /* 0,0 */

                values[2] += lambda[1] * 2;                      /* 1,1 */

                values[5] += lambda[1] * 2;                      /* 2,2 */

                values[9] += lambda[1] * 2;                      /* 3,3 */
            }

            return IpoptBoolType.True;
        }
Esempio n. 28
0
 public IpoptBoolType eval_h(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda,
                             IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     return(IpoptBoolType.True);
 }
Esempio n. 29
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
 {
     return(m_eval_grad_f_cb(n, x, new_x == IpoptBoolType.True, grad_f) ? IpoptBoolType.True : IpoptBoolType.False);
 }
Esempio n. 30
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
 {
     return(m_eval_g_cb(n, x, new_x == IpoptBoolType.True, m, g) ? IpoptBoolType.True : IpoptBoolType.False);
 }
Esempio n. 31
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, out double obj_value, IntPtr p_user_data)
 {
     return(m_eval_f_cb(n, x, new_x == IpoptBoolType.True, out obj_value) ? IpoptBoolType.True : IpoptBoolType.False);
 }
Esempio n. 32
0
        public override IpoptBoolType eval_f(int n, double[] x, IpoptBoolType new_x, out double obj_value, IntPtr p_user_data)
        {
            obj_value = x[0] * x[3] * (x[0] + x[1] + x[2]) + x[2];

            return IpoptBoolType.True;
        }
 public override IpoptBoolType eval_h(Int32 n, Double[] x, IpoptBoolType new_x, Double obj_factor, Int32 m,
                                      Double[] lambda, IpoptBoolType new_lambda, Int32 nele_hess, Int32[] iRow, Int32[] jCol, Double[] values,
                                      IntPtr p_user_data)
 {
     return(IpoptBoolType.True);
 }
Esempio n. 34
0
 public IpoptBoolType eval_h(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda, 
     IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     return IpoptBoolType.True;
 }
Esempio n. 35
0
 public virtual IpoptBoolType eval_g(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
 {
     throw new NotSupportedException("Constraints evaluation should be implemented in subclass.");
 }
Esempio n. 36
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, out double obj_value, IntPtr p_user_data)
 {
     return m_eval_f_cb(n, x, new_x == IpoptBoolType.True, out obj_value) ? IpoptBoolType.True : IpoptBoolType.False;
 }
Esempio n. 37
0
 public virtual IpoptBoolType eval_grad_f(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
 {
     throw new NotSupportedException("Objective function gradient evaluation should be implemented in subclass.");
 }
Esempio n. 38
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
 {
     return m_eval_grad_f_cb(n, x, new_x == IpoptBoolType.True, grad_f) ? IpoptBoolType.True : IpoptBoolType.False;
 }
Esempio n. 39
0
 public virtual IpoptBoolType eval_jac_g(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac,
                                         int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     throw new NotSupportedException("Jacobian evaluation should be implemented in subclass.");
 }
Esempio n. 40
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, int m, int nele_jac, 
     int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     return m_eval_jac_g_cb(n, x, new_x == IpoptBoolType.True, m, nele_jac, iRow, jCol, values)
                ? IpoptBoolType.True
                : IpoptBoolType.False;
 }
Esempio n. 41
0
 public virtual IpoptBoolType eval_h(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda,
                                     IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     throw new NotSupportedException("Hessian evaluation should be implemented in subclass.");
 }
Esempio n. 42
0
 internal IpoptBoolType Evaluate(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda,
     IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     return m_eval_h_cb(n, x, new_x == IpoptBoolType.True, obj_factor, m, lambda,
                     new_lambda == IpoptBoolType.True, nele_hess, iRow, jCol, values)
                ? IpoptBoolType.True
                : IpoptBoolType.False;
 }
Esempio n. 43
0
 public IpoptBoolType eval_f(int n, double[] x, IpoptBoolType new_x, out double obj_value, IntPtr p_user_data)
 {
     obj_value = -x[0] * x[1] * x[2];
     return IpoptBoolType.True;
 }
Esempio n. 44
0
 public virtual IpoptBoolType eval_grad_f(int n, double[] x, IpoptBoolType new_x, double[] grad_f, IntPtr p_user_data)
 {
     throw new NotSupportedException("Objective function gradient evaluation should be implemented in subclass.");
 }
Esempio n. 45
0
 public IpoptBoolType eval_g(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
 {
     g[0] = x[0] + 2.0 * x[1] + 2.0 * x[2];
     return IpoptBoolType.True;
 }
Esempio n. 46
0
 public virtual IpoptBoolType eval_h(int n, double[] x, IpoptBoolType new_x, double obj_factor, int m, double[] lambda,
     IpoptBoolType new_lambda, int nele_hess, int[] iRow, int[] jCol, double[] values, IntPtr p_user_data)
 {
     throw new NotSupportedException("Hessian evaluation should be implemented in subclass.");
 }
Esempio n. 47
0
 public IpoptBoolType eval_g(int n, double[] x, IpoptBoolType new_x, int m, double[] g, IntPtr p_user_data)
 {
     g[0] = x[0] + 2.0 * x[1] + 2.0 * x[2];
     return(IpoptBoolType.True);
 }