public static extern IntPtr CreateIpoptProblem(int n, double[] x_L, double[] x_U, int m, double[] g_L, double[] g_U, int nele_jac, int nele_hess, IpoptIndexStyle index_style, Eval_F_CB eval_f, Eval_G_CB eval_g, Eval_Grad_F_CB eval_grad_f, Eval_Jac_G_CB eval_jac_g, Eval_H_CB eval_h);
/// <summary> /// This function returns an object that can be passed to the IpoptSolve call. It /// contains the basic definition of the optimization problem, such /// as number of variables and constraints, bounds on variables and /// constraints, information about the derivatives, and the callback /// function for the computation of the optimization problem /// functions and derivatives. During this call, the options file /// ipopt.opt is read as well. /// </summary> /// <param name="n">Number of optimization variables</param> /// <param name="x_L">Lower bounds on variables. This array of size n is copied internally, so that the /// caller can change the incoming data after return without that IpoptProblem is modified. Any value /// less or equal than the number specified by option 'nlp_lower_bound_inf' is interpreted to be minus infinity.</param> /// <param name="x_U">Upper bounds on variables. This array of size n is copied internally, so that the /// caller can change the incoming data after return without that IpoptProblem is modified. Any value /// greater or equal than the number specified by option 'nlp_upper_bound_inf' is interpreted to be plus infinity.</param> /// <param name="m">Number of constraints.</param> /// <param name="g_L">Lower bounds on constraints. This array of size m is copied internally, so that the /// caller can change the incoming data after return without that IpoptProblem is modified. Any value /// less or equal than the number specified by option 'nlp_lower_bound_inf' is interpreted to be minus infinity.</param> /// <param name="g_U">Upper bounds on constraints. This array of size m is copied internally, so that the /// caller can change the incoming data after return without that IpoptProblem is modified. Any value /// greater or equal than the number specified by option 'nlp_upper_bound_inf' is interpreted to be plus infinity.</param> /// <param name="nele_jac">Number of non-zero elements in constraint Jacobian.</param> /// <param name="nele_hess">Number of non-zero elements in Hessian of Lagrangian.</param> /// <param name="index_style">Indexing style for iRow & jCol, 0 for C style, 1 for Fortran style</param> /// <param name="eval_f">Callback function for evaluating objective function</param> /// <param name="eval_g">Callback function for evaluating constraint functions</param> /// <param name="eval_grad_f">Callback function for evaluating gradient of objective function</param> /// <param name="eval_jac_g">Callback function for evaluating Jacobian of constraint functions</param> /// <param name="eval_h">Callback function for evaluating Hessian of Lagrangian function</param> public static IntPtr CreateIpoptProblem(int n, double[] x_L, double[] x_U, int m, double[] g_L, double[] g_U, int nele_jac, int nele_hess, IpoptIndexStyle index_style, Eval_F_CB eval_f, Eval_G_CB eval_g, Eval_Grad_F_CB eval_grad_f, Eval_Jac_G_CB eval_jac_g, Eval_H_CB eval_h) { if (IntPtr.Size == 4) { return IpoptAdapter32.CreateIpoptProblem(n, x_L, x_U, m, g_L, g_U, nele_jac, nele_hess, index_style, eval_f, eval_g, eval_grad_f, eval_jac_g, eval_h); } else if (IntPtr.Size == 8) { return IpoptAdapter64.CreateIpoptProblem(n, x_L, x_U, m, g_L, g_U, nele_jac, nele_hess, index_style, eval_f, eval_g, eval_grad_f, eval_jac_g, eval_h); } else { throw new NotSupportedException(); } }