MeshKit  1.0
IARoundingHeuristicMINLP.hpp
Go to the documentation of this file.
00001 // IANnl.hpp
00002 // Interval Assignment for Meshkit
00003 //
00004 // This is the solver-translation from Meshkit to the ipopt library
00005 // Here we provide the functions that ipopt needs to solve the optimization problem
00006 //
00007 // Adapted from: 
00008 // Copyright (C) 2005, 2007 International Business Machines and others.
00009 // All Rights Reserved.
00010 // This code is published under the Eclipse Public License.
00011 //
00012 // $Id: hs071_nlp.hpp 1864 2010-12-22 19:21:02Z andreasw $
00013 //
00014 // Authors:  Carl Laird, Andreas Waechter     IBM    2005-08-09
00015 
00016 #ifndef MESHKIT_IA_IAROUNDINGHEURISTICMINLP_HP
00017 #define MESHKIT_IA_IAROUNDINGHEURISTICMINLP_HP
00018 
00045 class IAData;
00046 class IPData;
00047 class IASolution;
00048 
00049 #include "IpTNLP.hpp"
00050 #include "meshkit/IANlp.hpp"
00051 
00052 class IARoundingHeuristicMINLP : public TNLP
00053 {
00054 public:
00056   IARoundingHeuristicMINLP(const IAData *data_ptr, const IPData *ip_data_ptr, IASolution *solution_ptr); 
00057 
00059   virtual ~IARoundingHeuristicMINLP();
00060 
00064   virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00065                             Index& nnz_h_lag, IndexStyleEnum& index_style);
00066 
00068   virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00069                                Index m, Number* g_l, Number* g_u);
00070 
00072   virtual bool get_starting_point(Index n, bool init_x, Number* x_init,
00073                                   bool init_z, Number* z_L, Number* z_U,
00074                                   Index m, bool init_lambda,
00075                                   Number* lambda);
00076 
00078   virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00079 
00081   virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00082 
00084   virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00085 
00090   virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00091                           Index m, Index nele_jac, Index* iRow, Index *jCol,
00092                           Number* values);
00093 
00098   virtual bool eval_h(Index n, const Number* x, bool new_x,
00099                       Number obj_factor, Index m, const Number* lambda,
00100                       bool new_lambda, Index nele_hess, Index* iRow,
00101                       Index* jCol, Number* values);
00102 
00104 
00108   virtual void finalize_solution(SolverReturn status,
00109                                  Index n, const Number* x, const Number* z_L, const Number* z_U,
00110                                  Index m, const Number* g, const Number* lambda,
00111                                  Number obj_value,
00112                                  const IpoptData* ip_data,
00113                                  IpoptCalculatedQuantities* ip_cq);
00115 
00116 
00117 private:  
00118   // hide untrusted default methods
00120   //  IA_NLP();
00121   IARoundingHeuristicMINLP();
00122   IARoundingHeuristicMINLP(const IARoundingHeuristicMINLP&);
00123   IARoundingHeuristicMINLP& operator=(const IARoundingHeuristicMINLP&);
00125   
00126   // implemented using an overlay over an IANlp
00127   IANlp baseNlp;
00128   
00129   // input data
00130   const IAData *data;
00131   const IPData *ip_data;
00132   // solution data
00133   IASolution *solution;
00134   
00135   const bool debugging;
00136   const bool verbose; // verbose debugging
00137   
00138   // internally used methods
00139   // contributions of one variable to the objective function and gradient
00140   // underlying function 
00141 
00142 
00143   // r functions: if x>I then x-I / I else I-x / x
00144   Number eval_r_i(const Number& I_i, const Number& x_i); 
00145   Number eval_grad_r_i(const Number& I_i, const Number& x_i); 
00146   Number eval_hess_r_i(const Number& I_i, const Number& x_i); 
00147 
00148   // s functions: r weighted by x: r*x
00149   Number eval_s_i(const Number& I_i, const Number& x_i); 
00150   Number eval_grad_s_i(const Number& I_i, const Number& x_i); 
00151   Number eval_hess_s_i(const Number& I_i, const Number& x_i); 
00152 
00153   // Capital functions, l-p norms of the lowercase functions
00154 public:
00155   Number eval_R_i(const Number& I_i, const Number& x_i); 
00156 private:
00157   Number eval_grad_R_i(const Number& I_i, const Number& x_i); 
00158   Number eval_hess_R_i(const Number& I_i, const Number& x_i); 
00159 
00160   Number eval_S_i(const Number& I_i, const Number& x_i); 
00161   Number eval_grad_S_i(const Number& I_i, const Number& x_i); 
00162   Number eval_hess_S_i(const Number& I_i, const Number& x_i); 
00163   
00164 
00165 };
00166 
00167 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines