/build/buildd/coinor-ipopt-3.10.1/Ipopt/contrib/sIPOPT/AmplSolver/SensAmplTNLP.hpp
Go to the documentation of this file.
00001 // Copyright 2009 Hans Pirnay
00002 // All Rights Reserved.
00003 // This code is published under the Eclipse Public License.
00004 //
00005 // Date   : 2009-05-11
00006 
00007 #ifndef __SENSAMPLTNLP_HPP__
00008 #define __SENSAMPLTNLP_HPP__
00009 
00010 #include "AmplTNLP.hpp"
00011 
00012 namespace Ipopt 
00013 {
00014 
00015   DECLARE_STD_EXCEPTION(SUFFIX_EMPTY);
00016 
00017   class SensAmplTNLP : public AmplTNLP
00018   {
00022   public:
00024     SensAmplTNLP(const SmartPtr<const Journalist>& jnlst,
00025                  const SmartPtr<OptionsList> options,
00026                  char**& argv,
00027                  SmartPtr<AmplSuffixHandler> suffix_handler= NULL,
00028                  bool allow_discrete = false,
00029                  SmartPtr<AmplOptionsList> ampl_options_list= NULL ,
00030                  const char* ampl_option_string = NULL ,
00031                  const char* ampl_invokation_string  = NULL,
00032                  const char* ampl_banner_string  = NULL,
00033                  std::string* nl_file_content  = NULL);
00034 
00035     virtual ~SensAmplTNLP();
00036 
00038     virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00039                                  Index m, Number* g_l, Number* g_u);
00040 
00041     void set_sens_solution(Index idx, SmartPtr<IteratesVector> sens_sol);
00042 
00043     virtual void finalize_metadata(Index n,
00044                                    const StringMetaDataMapType& var_string_md,
00045                                    const IntegerMetaDataMapType& var_integer_md,
00046                                    const NumericMetaDataMapType& var_numeric_md,
00047                                    Index m,
00048                                    const StringMetaDataMapType& con_string_md,
00049                                    const IntegerMetaDataMapType& con_integer_md,
00050                                    const NumericMetaDataMapType& con_numeric_md);
00051 
00052     virtual void finalize_solution(SolverReturn status,
00053                                    Index n, const Number* x, const Number* z_L, const Number* z_U,
00054                                    Index m, const Number* g, const Number* lambda,
00055                                    Number obj_value,
00056                                    const IpoptData* ip_data,
00057                                    IpoptCalculatedQuantities* ip_cq);    
00058 
00059     const Index* get_index_suffix(const char* suffix_name);
00060 
00061     std::vector<Index> get_index_suffix_vec(const char* suffix_name);
00062 
00063     const Number* get_number_suffix(const char* suffix_name);
00064 
00065     std::vector<Number> get_number_suffix_vec(const char* suffix_name);
00066 
00067     const Index* get_index_suffix_constr(const char* suffix_name);
00068 
00069     std::vector<Index> get_index_suffix_constr_vec(const char* suffix_name);
00070 
00071     const Number* get_number_suffix_constr(const char* suffix_name);
00072 
00073     virtual bool get_var_con_metadata(Index n,
00074                                       StringMetaDataMapType& var_string_md,
00075                                       IntegerMetaDataMapType& var_integer_md,
00076                                       NumericMetaDataMapType& var_numeric_md,
00077                                       Index m,
00078                                       StringMetaDataMapType& con_string_md,
00079                                       IntegerMetaDataMapType& con_integer_md,
00080                                       NumericMetaDataMapType& con_numeric_md);
00081 
00082   private:
00083     
00085     //    Number* x_L;
00086     //Number* x_U;
00087 
00088     SmartPtr<const Journalist> jnlst_;
00089     SmartPtr<OptionsList> options_;
00090 
00091     bool have_parameters_;
00092 
00093     Index* parameter_flags_;
00094     Number* parameter_values_;
00095 
00097     Index n_sens_steps_;
00098     bool run_sens_;
00099     bool compute_red_hessian_;
00100 
00101     std::vector< SmartPtr<IteratesVector> > sens_sol_;
00102     
00103   };
00104 
00105 }
00106 
00107 #endif