Bonmin 1.4trunk
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 TNLP
00026   {
00027   public:
00030     BranchingTQP(SmartPtr<TMINLP2TNLP> tminlp2tnlp);
00031 
00033     virtual ~BranchingTQP();
00035 
00039     virtual bool get_nlp_info(Index& n, Index& m, Index& nnz_jac_g,
00040                               Index& nnz_h_lag, IndexStyleEnum& index_style);
00041     virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00042                                  Index m, Number* g_l, Number* g_u);
00046     virtual bool get_constraints_linearity(Index m, LinearityType* const_types);
00054     virtual bool get_starting_point(Index n, bool init_x, Number* x,
00055         bool init_z, Number* z_L, Number* z_U,
00056         Index m, bool init_lambda,
00057         Number* lambda);
00058 
00060     virtual bool eval_f(Index n, const Number* x, bool new_x,
00061         Number& obj_value);
00062 
00065     virtual bool eval_grad_f(Index n, const Number* x, bool new_x,
00066         Number* grad_f);
00067 
00069     virtual bool eval_g(Index n, const Number* x, bool new_x,
00070         Index m, Number* g);
00071 
00077     virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00078         Index m, Index nele_jac, Index* iRow,
00079         Index *jCol, Number* values);
00080 
00088     virtual bool eval_h(Index n, const Number* x, bool new_x,
00089         Number obj_factor, Index m, const Number* lambda,
00090         bool new_lambda, Index nele_hess,
00091         Index* iRow, Index* jCol, Number* values);
00092     virtual void finalize_solution(SolverReturn status,
00093                                    Index n, const Number* x, const Number* z_L, const Number* z_U,
00094                                    Index m, const Number* g, const Number* lambda,
00095                                    Number obj_value,
00096                                    const IpoptData* ip_data,
00097                                    IpoptCalculatedQuantities* ip_cq);
00099 
00102     const Number ObjVal()
00103     {
00104       return obj_val_;
00105     }
00106     const Number* ObjGrad()
00107     {
00108       return obj_grad_;
00109     }
00110     const Number* ObjHessVals()
00111     {
00112       return obj_hess_;
00113     }
00114     const Index* ObjHessIRow()
00115     {
00116       return obj_hess_irow_;
00117     }
00118     const Index* ObjHessJCol()
00119     {
00120       return obj_hess_jcol_;
00121     }
00122     const Number* ConstrRhs()
00123     {
00124       return g_vals_;
00125     }
00126     const Number* ConstrJacVals()
00127     {
00128       return g_jac_;
00129     }
00130     const Index* ConstrJacIRow()
00131     {
00132       return g_jac_irow_;
00133     }
00134     const 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     Number obj_val_;
00163     Number* obj_grad_;
00164     Number* obj_hess_;
00165     Index* obj_hess_irow_;
00166     Index* obj_hess_jcol_;
00167     Number* g_vals_;
00168     Number* g_jac_;
00169     Index* g_jac_irow_;
00170     Index* g_jac_jcol_;
00172 
00175     Index n_;
00176     Index m_;
00177     Index nnz_jac_g_;
00178     Index nnz_h_lag_;
00179     IndexStyleEnum index_style_;
00181 
00184     Number* x_sol_copy_;
00185 
00188     Number* duals_sol_copy_;
00189 
00192     SmartPtr<TMINLP2TNLP> tminlp2tnlp_;
00193   };
00194 
00195 } // namespace Ipopt
00196 
00197 #endif