MeshKit  1.0
IARoundingNlp.hpp
Go to the documentation of this file.
00001 // IARoundingNnl.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_IAROUNDINGNLP_HP
00010 #define MESHKIT_IA_IAROUNDINGNLP_HP
00011 
00012 #include "meshkit/IANlp.hpp"
00013 #include "meshkit/IAWeights.hpp"
00014 
00015 // from Ipopot
00016 #include "IpTNLP.hpp"
00017 
00018 namespace MeshKit {
00019 
00020 class IAData;
00021 class IPData;
00022 class IASolution;
00023 
00024 class IARoundingNlp : public TNLP
00025 {
00026   // first set of functions required by TNLP
00027 public:
00029   IARoundingNlp(const IAData *data_ptr, const IPData *ip_data_ptr, IASolution *solution_ptr,
00030     const bool set_silent = true); 
00031 
00033   virtual ~IARoundingNlp();
00034   
00035 
00039   virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00040                             Index& nnz_h_lag, IndexStyleEnum& index_style);
00041 
00043   virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00044                                Index m, Number* g_l, Number* g_u);
00045 
00047   virtual bool get_starting_point(Index n, bool init_x, Number* x_init,
00048                                   bool init_z, Number* z_L, Number* z_U,
00049                                   Index m, bool init_lambda,
00050                                   Number* lambda);
00051 
00053   virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00054 
00056   virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00057 
00059   virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00060 
00065   virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00066                           Index m, Index nele_jac, Index* iRow, Index *jCol,
00067                           Number* values);
00068 
00073   virtual bool eval_h(Index n, const Number* x, bool new_x,
00074                       Number obj_factor, Index m, const Number* lambda,
00075                       bool new_lambda, Index nele_hess, Index* iRow,
00076                       Index* jCol, Number* values);
00077 
00079 
00083   virtual void finalize_solution(SolverReturn status,
00084                                  Index n, const Number* x, const Number* z_L, const Number* z_U,
00085                                  Index m, const Number* g, const Number* lambda,
00086                                  Number obj_value,
00087                                  const IpoptData* ip_data,
00088                                  IpoptCalculatedQuantities* ip_cq);
00090 
00091 // extra stuff not required by TNLP
00092   bool randomize_weights_of_non_int();
00093 
00094 private:  
00095   // hide untrusted default methods
00097   //  IA_NLP();
00098   IARoundingNlp();
00099   IARoundingNlp(const IARoundingNlp&);
00100   IARoundingNlp& operator=(const IARoundingNlp&);
00102   
00103   // input data
00104   const IAData *data;
00105   const IPData *ipData;
00106   
00107   // solution data
00108   IASolution *solution;
00109   
00110   
00111   // implemented using an overlay over an IANlp
00112   IANlp baseNlp;  
00113 
00114   // defining / weighting objective function
00115   IAWeights weights;
00116 
00117   double f_x_value( double I_i, double x_i );
00118 
00119   // debug
00120   const bool silent;
00121   const bool debugging;
00122   const bool verbose; // verbose debugging
00123   
00124 };
00125 
00126 } // namespace MeshKit 
00127 
00128 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines