MeshKit  1.0
IARoundingFarNlp.hpp
Go to the documentation of this file.
00001 // IARoundingFarNnl.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_IAROUNDINGFARNLP_HP
00010 #define MESHKIT_IA_IAROUNDINGFARNLP_HP
00011 
00012 class IAData;
00013 class IPData;
00014 class IASolution;
00015 #include "meshkit/IAWeights.hpp"
00016 #include "meshkit/IANlp.hpp"
00017 
00018 #include "IpTNLP.hpp"
00019 
00020 class IARoundingFarNlp : public TNLP
00021 {
00022 public:
00024   IARoundingFarNlp(const IAData *data_ptr, const IPData *ip_data_ptr, IASolution *solution_ptr); 
00025 
00027   virtual ~IARoundingFarNlp();
00028 
00029   // extra for IA, not for TNLP
00030   // nada
00031   
00035   virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00036                             Index& nnz_h_lag, IndexStyleEnum& index_style);
00037 
00039   virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00040                                Index m, Number* g_l, Number* g_u);
00041 
00043   virtual bool get_starting_point(Index n, bool init_x, Number* x_init,
00044                                   bool init_z, Number* z_L, Number* z_U,
00045                                   Index m, bool init_lambda,
00046                                   Number* lambda);
00047 
00049   virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00050 
00052   virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00053 
00055   virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00056 
00061   virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00062                           Index m, Index nele_jac, Index* iRow, Index *jCol,
00063                           Number* values);
00064 
00069   virtual bool eval_h(Index n, const Number* x, bool new_x,
00070                       Number obj_factor, Index m, const Number* lambda,
00071                       bool new_lambda, Index nele_hess, Index* iRow,
00072                       Index* jCol, Number* values);
00073 
00075 
00079   virtual void finalize_solution(SolverReturn status,
00080                                  Index n, const Number* x, const Number* z_L, const Number* z_U,
00081                                  Index m, const Number* g, const Number* lambda,
00082                                  Number obj_value,
00083                                  const IpoptData* ip_data,
00084                                  IpoptCalculatedQuantities* ip_cq);
00086 
00087 
00088 private:  
00089   // hide untrusted default methods
00091   //  IA_NLP();
00092   IARoundingFarNlp();
00093   IARoundingFarNlp(const IARoundingFarNlp&);
00094   IARoundingFarNlp& operator=(const IARoundingFarNlp&);
00096   
00097   // input data
00098   const IAData *data;
00099   const IPData *ipData;
00100   // model
00101   IAWeights h0; // h0, as weights in IARoundingNLP
00102   IAWeights hp; // h+
00103   IAWeights hm; // h-
00104   
00105   // solution data
00106   IASolution *solution;
00107   
00108   
00109   // implemented using an overlay over an IANlp
00110   IANlp baseNlp;  
00111   
00112   const bool debugging;
00113   const bool verbose; // verbose debugging
00114   
00115   
00116   // utility
00117   double f_x_value( double I_i, double x_i ) const;
00118   double get_f_xl(int i) const; // obj function value at xl
00119   double get_f_xh(int i) const; // obj function value at xh
00120 
00121 };
00122 
00123 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines