MeshKit  1.0
IAMINlp.hpp
Go to the documentation of this file.
00001 // IAMINnl.hpp
00002 // Interval Assignment for Meshkit
00003 //
00004 // ipopt mixed-integer solution
00005 // The idea is the optimal solution will be an integer one, if one exists
00006 // Define some region around the relaxed solution and search for an integer solution
00007 //
00008 
00009 #ifndef MESHKIT_IA_IAMINLP_HP
00010 #define MESHKIT_IA_IAMINLP_HP
00011 
00012 class IAData;
00013 class IPData;
00014 class IASolution;
00015 class IANlp;
00016 
00017 #include "MKVersion.h"
00018 
00019 #include "IpTNLP.hpp"
00020 
00021 namespace MeshKit 
00022 {
00023 
00024 class IAMINlp : public TNLP
00025 {
00026 public:
00028   IAMINlp(const IAData *data_ptr, const IPData *ip_data_ptr, IASolution *solution_ptr); 
00029 
00031   virtual ~IAMINlp();
00032 
00036   virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00037                             Index& nnz_h_lag, IndexStyleEnum& index_style);
00038 
00040   virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00041                                Index m, Number* g_l, Number* g_u);
00042 
00044   virtual bool get_starting_point(Index n, bool init_x, Number* x_init,
00045                                   bool init_z, Number* z_L, Number* z_U,
00046                                   Index m, bool init_lambda,
00047                                   Number* lambda);
00048 
00050   virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00051 
00053   virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00054 
00056   virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00057 
00062   virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00063                           Index m, Index nele_jac, Index* iRow, Index *jCol,
00064                           Number* values);
00065 
00070   virtual bool eval_h(Index n, const Number* x, bool new_x,
00071                       Number obj_factor, Index m, const Number* lambda,
00072                       bool new_lambda, Index nele_hess, Index* iRow,
00073                       Index* jCol, Number* values);
00074 
00076 
00080   virtual void finalize_solution(SolverReturn status,
00081                                  Index n, const Number* x, const Number* z_L, const Number* z_U,
00082                                  Index m, const Number* g, const Number* lambda,
00083                                  Number obj_value,
00084                                  const IpoptData* ip_data,
00085                                  IpoptCalculatedQuantities* ip_cq);
00087 
00088 
00089 private:  
00090   // hide untrusted default methods
00092   //  IA_NLP();
00093   IAMINlp();
00094   IAMINlp(const IAMINlp&);
00095   IAMINlp& operator=(const IAMINlp&);
00097   
00098   // input data
00099   const IAData *data;
00100   const IPData *ip_data;
00101   // solution data
00102   IASolution *solution;
00103   
00104   const bool debugging;
00105   const bool verbose; // verbose debugging
00106   
00107   // internally used methods
00108   // contributions of one variable to the objective function and gradient
00109   // underlying function 
00110 
00111 
00112   // r functions: if x>I then x-I / I else I-x / x
00113   Number eval_r_i(const Number& I_i, const Number& x_i); 
00114   Number eval_grad_r_i(const Number& I_i, const Number& x_i); 
00115   Number eval_hess_r_i(const Number& I_i, const Number& x_i); 
00116 
00117   // s functions: r weighted by x: r*x
00118   Number eval_s_i(const Number& I_i, const Number& x_i); 
00119   Number eval_grad_s_i(const Number& I_i, const Number& x_i); 
00120   Number eval_hess_s_i(const Number& I_i, const Number& x_i); 
00121 
00122   // Capital functions, l-p norms of the lowercase functions
00123 public:
00124   Number eval_R_i(const Number& I_i, const Number& x_i); 
00125 private:
00126   Number eval_grad_R_i(const Number& I_i, const Number& x_i); 
00127   Number eval_hess_R_i(const Number& I_i, const Number& x_i); 
00128 
00129   Number eval_S_i(const Number& I_i, const Number& x_i); 
00130   Number eval_grad_S_i(const Number& I_i, const Number& x_i); 
00131   Number eval_hess_S_i(const Number& I_i, const Number& x_i); 
00132   
00133 
00134 };
00135 
00136 } // namespace MeshKit 
00137 
00138 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines