/home/coin/SVN-release/CoinAll-1.1.0/Ipopt/src/Interfaces/IpStdInterfaceTNLP.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2004, 2006 International Business Machines and others.
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // $Id: IpStdInterfaceTNLP.hpp 949 2007-03-27 00:41:26Z andreasw $
00006 //
00007 // Authors:  Carl Laird, Andreas Waechter     IBM    2004-08-13
00008 
00009 #ifndef __IPSTDINTERFACETNLP_HPP__
00010 #define __IPSTDINTERFACETNLP_HPP__
00011 
00012 #include "IpUtils.hpp"
00013 #include "IpTNLP.hpp"
00014 #include "IpJournalist.hpp"
00015 #include "IpException.hpp"
00016 #include "IpStdCInterface.h"
00017 #include "IpSmartPtr.hpp"
00018 
00019 namespace Ipopt
00020 {
00023   DECLARE_STD_EXCEPTION(INVALID_STDINTERFACE_NLP);
00024 
00030   class StdInterfaceTNLP : public TNLP
00031   {
00032   public:
00039     StdInterfaceTNLP(Index n_var,
00040                      const Number* x_L, const Number* x_U,
00041                      Index n_con,
00042                      const Number* g_L, const Number* g_U,
00043                      Index nele_jac,
00044                      Index nele_hess,
00045                      Index index_style,
00046                      const Number* start_x,
00047                      const Number* start_lam,
00048                      const Number* start_z_L,
00049                      const Number* start_z_U,
00050                      Eval_F_CB eval_f,
00051                      Eval_G_CB eval_g,
00052                      Eval_Grad_F_CB eval_grad_f,
00053                      Eval_Jac_G_CB eval_jac_g,
00054                      Eval_H_CB eval_h,
00055                      Number* x_sol,
00056                      Number* z_L_sol,
00057                      Number* z_U_sol,
00058                      Number* g_sol,
00059                      Number* lam_sol,
00060                      Number* obj_sol,
00061                      UserDataPtr user_data,
00062                      Number obj_scaling=1,
00063                      const Number* x_scaling = NULL,
00064                      const Number* g_scaling = NULL);
00065 
00067     virtual ~StdInterfaceTNLP();
00069 
00074     virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00075                               Index& nnz_h_lag, IndexStyleEnum& index_style);
00076 
00078     virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00079                                  Index m, Number* g_l, Number* g_u);
00080 
00083     virtual bool get_scaling_parameters(Number& obj_scaling,
00084                                         bool& use_x_scaling, Index n,
00085                                         Number* x_scaling,
00086                                         bool& use_g_scaling, Index m,
00087                                         Number* g_scaling);
00088 
00090     virtual bool get_starting_point(Index n, bool init_x, Number* x,
00091                                     bool init_z, Number* z_L, Number* z_U,
00092                                     Index m, bool init_lambda, Number* lambda);
00093 
00095     virtual bool eval_f(Index n, const Number* x, bool new_x,
00096                         Number& obj_value);
00097 
00100     virtual bool eval_grad_f(Index n, const Number* x, bool new_x,
00101                              Number* grad_f);
00102 
00104     virtual bool eval_g(Index n, const Number* x, bool new_x, Index m,
00105                         Number* g);
00106 
00110     virtual bool eval_jac_g(Index n, const Number* x, bool new_x, Index m,
00111                             Index nele_jac, Index* iRow, Index *jCol,
00112                             Number* values);
00113 
00116     virtual bool eval_h(Index n, const Number* x, bool new_x,
00117                         Number obj_factor, Index m, const Number* lambda,
00118                         bool new_lambda, Index nele_hess, Index* iRow,
00119                         Index* jCol, Number* values);
00121 
00124     virtual void finalize_solution(SolverReturn status,
00125                                    Index n, const Number* x, const Number* z_L, const Number* z_U,
00126                                    Index m, const Number* g, const Number* lambda,
00127                                    Number obj_value,
00128                                    const IpoptData* ip_data,
00129                                    IpoptCalculatedQuantities* ip_cq);
00131 
00132   private:
00134     SmartPtr<const Journalist> jnlst_;
00135 
00139     const Index n_var_;
00141     const Index n_con_;
00143     const Number* x_L_;
00145     const Number* x_U_;
00147     const Number* g_L_;
00149     const Number* g_U_;
00151     const Index nele_jac_;
00153     const Index nele_hess_;
00155     const Index index_style_;
00157     const Number* start_x_;
00160     const Number* start_lam_;
00163     const Number* start_z_L_;
00166     const Number* start_z_U_;
00168     Eval_F_CB eval_f_;
00170     Eval_G_CB eval_g_;
00173     Eval_Grad_F_CB eval_grad_f_;
00175     Eval_Jac_G_CB eval_jac_g_;
00177     Eval_H_CB eval_h_;
00179     UserDataPtr user_data_;
00181     Number obj_scaling_;
00183     const Number* x_scaling_;
00185     const Number* g_scaling_;
00187 
00188 
00190     Number* non_const_x_;
00191 
00193     Number* x_sol_;
00194     Number* z_L_sol_;
00195     Number* z_U_sol_;
00196     Number* g_sol_;
00197     Number* lambda_sol_;
00198     Number* obj_sol_;
00199 
00202     void apply_new_x(bool new_x, Index n, const Number* x);
00203 
00204 
00214     StdInterfaceTNLP();
00215 
00217     StdInterfaceTNLP(const StdInterfaceTNLP&);
00218 
00220     void operator=(const StdInterfaceTNLP&);
00222 
00223   };
00224 
00225 } // namespace Ipopt
00226 
00227 #endif

Generated on Sun Nov 14 14:06:36 2010 for Coin-All by  doxygen 1.4.7