Bonmin  1.7
BonBranchingTQP.hpp
Go to the documentation of this file.
00001 // (C) Copyright International Business Machines Corporation and
00002 // Carnegie Mellon University 2006, 2008
00003 // All Rights Reserved.
00004 // This code is published under the Common Public License.
00005 //
00006 // Authors :
00007 // Andreas Waechter, International Business Machines Corporation
00008 //                   (derived from BonTMINLP2TNLP.hpp)            12/22/2006
00009 
00010 #ifndef __BONBRANCHINGTQP_HPP__
00011 #define __BONBRANCHINGTQP_HPP__
00012 
00013 #include "BonTMINLP2TNLP.hpp"
00014 
00015 namespace Bonmin
00016 {
00025   class BranchingTQP : public Ipopt::TNLP
00026   {
00027   public:
00030     BranchingTQP(Ipopt::SmartPtr<TMINLP2TNLP> tminlp2tnlp);
00031 
00033     virtual ~BranchingTQP();
00035 
00039     virtual bool get_nlp_info(Ipopt::Index& n, Ipopt::Index& m, Ipopt::Index& nnz_jac_g,
00040                               Ipopt::Index& nnz_h_lag, Ipopt::TNLP::IndexStyleEnum& index_style);
00041     virtual bool get_bounds_info(Ipopt::Index n, Ipopt::Number* x_l, Ipopt::Number* x_u,
00042                                  Ipopt::Index m, Ipopt::Number* g_l, Ipopt::Number* g_u);
00046     virtual bool get_constraints_linearity(Ipopt::Index m, LinearityType* const_types);
00054     virtual bool get_starting_point(Ipopt::Index n, bool init_x, Ipopt::Number* x,
00055         bool init_z, Ipopt::Number* z_L, Ipopt::Number* z_U,
00056         Ipopt::Index m, bool init_lambda,
00057         Ipopt::Number* lambda);
00058 
00060     virtual bool eval_f(Ipopt::Index n, const Ipopt::Number* x, bool new_x,
00061         Ipopt::Number& obj_value);
00062 
00065     virtual bool eval_grad_f(Ipopt::Index n, const Ipopt::Number* x, bool new_x,
00066         Ipopt::Number* grad_f);
00067 
00069     virtual bool eval_g(Ipopt::Index n, const Ipopt::Number* x, bool new_x,
00070         Ipopt::Index m, Ipopt::Number* g);
00071 
00077     virtual bool eval_jac_g(Ipopt::Index n, const Ipopt::Number* x, bool new_x,
00078         Ipopt::Index m, Ipopt::Index nele_jac, Ipopt::Index* iRow,
00079         Ipopt::Index *jCol, Ipopt::Number* values);
00080 
00088     virtual bool eval_h(Ipopt::Index n, const Ipopt::Number* x, bool new_x,
00089         Ipopt::Number obj_factor, Ipopt::Index m, const Ipopt::Number* lambda,
00090         bool new_lambda, Ipopt::Index nele_hess,
00091         Ipopt::Index* iRow, Ipopt::Index* jCol, Ipopt::Number* values);
00092     virtual void finalize_solution(Ipopt::SolverReturn status,
00093                                    Ipopt::Index n, const Ipopt::Number* x, const Ipopt::Number* z_L, const Ipopt::Number* z_U,
00094                                    Ipopt::Index m, const Ipopt::Number* g, const Ipopt::Number* lambda,
00095                                    Ipopt::Number obj_value,
00096                                    const Ipopt::IpoptData* ip_data,
00097                                    Ipopt::IpoptCalculatedQuantities* ip_cq);
00099 
00102     const Ipopt::Number ObjVal()
00103     {
00104       return obj_val_;
00105     }
00106     const Ipopt::Number* ObjGrad()
00107     {
00108       return obj_grad_;
00109     }
00110     const Ipopt::Number* ObjHessVals()
00111     {
00112       return obj_hess_;
00113     }
00114     const Ipopt::Index* ObjHessIRow()
00115     {
00116       return obj_hess_irow_;
00117     }
00118     const Ipopt::Index* ObjHessJCol()
00119     {
00120       return obj_hess_jcol_;
00121     }
00122     const Ipopt::Number* ConstrRhs()
00123     {
00124       return g_vals_;
00125     }
00126     const Ipopt::Number* ConstrJacVals()
00127     {
00128       return g_jac_;
00129     }
00130     const Ipopt::Index* ConstrJacIRow()
00131     {
00132       return g_jac_irow_;
00133     }
00134     const Ipopt::Index* ConstrJacJCol()
00135     {
00136       return g_jac_jcol_;
00137     }
00139 
00140   private:
00150     BranchingTQP();
00151 
00153     BranchingTQP(const BranchingTQP&);
00154 
00156     void operator=(const BranchingTQP&);
00158 
00162     Ipopt::Number obj_val_;
00163     Ipopt::Number* obj_grad_;
00164     Ipopt::Number* obj_hess_;
00165     Ipopt::Index* obj_hess_irow_;
00166     Ipopt::Index* obj_hess_jcol_;
00167     Ipopt::Number* g_vals_;
00168     Ipopt::Number* g_jac_;
00169     Ipopt::Index* g_jac_irow_;
00170     Ipopt::Index* g_jac_jcol_;
00172 
00175     Ipopt::Index n_;
00176     Ipopt::Index m_;
00177     Ipopt::Index nnz_jac_g_;
00178     Ipopt::Index nnz_h_lag_;
00179     Ipopt::TNLP::IndexStyleEnum index_style_;
00181 
00184     Ipopt::Number* x_sol_copy_;
00185 
00188     Ipopt::Number* duals_sol_copy_;
00189 
00192     Ipopt::SmartPtr<TMINLP2TNLP> tminlp2tnlp_;
00193   };
00194 
00195 } // namespace Ipopt
00196 
00197 #endif