Ipopt
trunk
|
00001 // Copyright 2010 Hans Pirnay 00002 // All Rights Reserved. 00003 // This code is published under the Eclipse Public License. 00004 // 00005 // Date : 2010-01-05 00006 00007 #ifndef __PARAMETRICTNLPEXAMPLE_HPP__ 00008 #define __PARAMETRICTNLPEXAMPLE_HPP__ 00009 00010 #include "IpTNLP.hpp" 00011 00012 namespace Ipopt 00013 { 00014 00015 class ParametricTNLP : public TNLP 00016 { 00017 public: 00018 00020 ParametricTNLP(); 00021 00023 virtual ~ParametricTNLP(); 00024 00028 virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g, 00029 Index& nnz_h_lag, IndexStyleEnum& index_style); 00030 00032 virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u, 00033 Index m, Number* g_l, Number* g_u); 00034 00036 virtual bool get_starting_point(Index n, bool init_x, Number* x, 00037 bool init_z, Number* z_L, Number* z_U, 00038 Index m, bool init_lambda, 00039 Number* lambda); 00040 00042 virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value); 00043 00045 virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f); 00046 00048 virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g); 00049 00054 virtual bool eval_jac_g(Index n, const Number* x, bool new_x, 00055 Index m, Index nele_jac, Index* iRow, Index *jCol, 00056 Number* values); 00057 00062 virtual bool eval_h(Index n, const Number* x, bool new_x, 00063 Number obj_factor, Index m, const Number* lambda, 00064 bool new_lambda, Index nele_hess, Index* iRow, 00065 Index* jCol, Number* values); 00066 00068 00069 virtual bool get_var_con_metadata(Index n, 00070 StringMetaDataMapType& var_string_md, 00071 IntegerMetaDataMapType& var_integer_md, 00072 NumericMetaDataMapType& var_numeric_md, 00073 Index m, 00074 StringMetaDataMapType& con_string_md, 00075 IntegerMetaDataMapType& con_integer_md, 00076 NumericMetaDataMapType& con_numeric_md); 00077 00081 virtual void finalize_solution(SolverReturn status, 00082 Index n, const Number* x, const Number* z_L, const Number* z_U, 00083 Index m, const Number* g, const Number* lambda, 00084 Number obj_value, 00085 const IpoptData* ip_data, 00086 IpoptCalculatedQuantities* ip_cq); 00087 00090 virtual void finalize_metadata(Index n, 00091 const StringMetaDataMapType& var_string_md, 00092 const IntegerMetaDataMapType& var_integer_md, 00093 const NumericMetaDataMapType& var_numeric_md, 00094 Index m, 00095 const StringMetaDataMapType& con_string_md, 00096 const IntegerMetaDataMapType& con_integer_md, 00097 const NumericMetaDataMapType& con_numeric_md); 00099 00100 private: 00112 ParametricTNLP(const ParametricTNLP&); 00113 ParametricTNLP& operator=(const ParametricTNLP&); 00115 00116 00117 /* Nominal and perturbed parameter values */ 00118 Number nominal_eta1_; 00119 Number nominal_eta2_; 00120 00121 Number eta_1_perturbed_value_; 00122 Number eta_2_perturbed_value_; 00123 }; 00124 00125 } 00126 00127 #endif