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 759 2006-07-07 03:07:08Z 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 
00064     virtual ~StdInterfaceTNLP();
00066 
00071     virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00072                               Index& nnz_h_lag, IndexStyleEnum& index_style);
00073 
00075     virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00076                                  Index m, Number* g_l, Number* g_u);
00077 
00079     virtual bool get_starting_point(Index n, bool init_x, Number* x,
00080                                     bool init_z, Number* z_L, Number* z_U,
00081                                     Index m, bool init_lambda, Number* lambda);
00082 
00084     virtual bool eval_f(Index n, const Number* x, bool new_x,
00085                         Number& obj_value);
00086 
00089     virtual bool eval_grad_f(Index n, const Number* x, bool new_x,
00090                              Number* grad_f);
00091 
00093     virtual bool eval_g(Index n, const Number* x, bool new_x, Index m,
00094                         Number* g);
00095 
00099     virtual bool eval_jac_g(Index n, const Number* x, bool new_x, Index m,
00100                             Index nele_jac, Index* iRow, Index *jCol,
00101                             Number* values);
00102 
00105     virtual bool eval_h(Index n, const Number* x, bool new_x,
00106                         Number obj_factor, Index m, const Number* lambda,
00107                         bool new_lambda, Index nele_hess, Index* iRow,
00108                         Index* jCol, Number* values);
00110 
00113     virtual void finalize_solution(SolverReturn status,
00114                                    Index n, const Number* x, const Number* z_L, const Number* z_U,
00115                                    Index m, const Number* g, const Number* lambda,
00116                                    Number obj_value);
00118 
00119   private:
00121     SmartPtr<const Journalist> jnlst_;
00122 
00126     const Index n_var_;
00128     const Index n_con_;
00130     const Number* x_L_;
00132     const Number* x_U_;
00134     const Number* g_L_;
00136     const Number* g_U_;
00138     const Index nele_jac_;
00140     const Index nele_hess_;
00142     const Index index_style_;
00144     const Number* start_x_;
00147     const Number* start_lam_;
00150     const Number* start_z_L_;
00153     const Number* start_z_U_;
00155     Eval_F_CB eval_f_;
00157     Eval_G_CB eval_g_;
00160     Eval_Grad_F_CB eval_grad_f_;
00162     Eval_Jac_G_CB eval_jac_g_;
00164     Eval_H_CB eval_h_;
00166     UserDataPtr user_data_;
00168 
00169 
00171     Number* non_const_x_;
00172 
00174     Number* x_sol_;
00175     Number* z_L_sol_;
00176     Number* z_U_sol_;
00177     Number* g_sol_;
00178     Number* lambda_sol_;
00179     Number* obj_sol_;
00180 
00183     void apply_new_x(bool new_x, Index n, const Number* x);
00184 
00185 
00195     StdInterfaceTNLP();
00196 
00198     StdInterfaceTNLP(const StdInterfaceTNLP&);
00199 
00201     void operator=(const StdInterfaceTNLP&);
00203 
00204   };
00205 
00206 } // namespace Ipopt
00207 
00208 #endif

Generated on Fri Sep 26 07:44:13 2008 for SimTKcore by  doxygen 1.5.6