Bonmin  1.7
MyTMINLP.hpp
Go to the documentation of this file.
00001 // (C) Copyright Carnegie Mellon University 2006
00002 // All Rights Reserved.
00003 // This code is published under the Common Public License.
00004 //
00005 // Authors :
00006 // P. Bonami, Carnegie Mellon University
00007 //
00008 // Date :  03/17/2006
00009 #ifndef MyTNLP_HPP
00010 #define MyTNLP_HPP
00011 #include "BonTMINLP.hpp"
00012 using namespace  Ipopt;
00013 using namespace Bonmin;
00028 class MyTMINLP : public TMINLP
00029 {
00030 public:
00032   MyTMINLP():
00033 printSol_(false){}
00034   
00036   virtual ~MyTMINLP(){}
00037 
00038   
00040   MyTMINLP(const MyTMINLP &other):
00041 printSol_(other.printSol_){}
00043   //MyTMINLP& operator=(const MyTMINLP&) {}
00044 
00045   
00052   virtual bool get_variables_types(Index n, VariableType* var_types);
00053  
00055   virtual bool get_variables_linearity(Index n, Ipopt::TNLP::LinearityType* var_types);
00056 
00061   virtual bool get_constraints_linearity(Index m, Ipopt::TNLP::LinearityType* const_types);
00063     
00076   virtual bool get_nlp_info(Index& n, Index&m, Index& nnz_jac_g,
00077                             Index& nnz_h_lag, TNLP::IndexStyleEnum& index_style);
00078   
00087   virtual bool get_bounds_info(Index n, Number* x_l, Number* x_u,
00088                                Index m, Number* g_l, Number* g_u);
00089   
00097   virtual bool get_starting_point(Index n, bool init_x, Number* x,
00098                                   bool init_z, Number* z_L, Number* z_U,
00099                                   Index m, bool init_lambda,
00100                                   Number* lambda);
00101   
00109   virtual bool eval_f(Index n, const Number* x, bool new_x, Number& obj_value);
00110 
00118   virtual bool eval_grad_f(Index n, const Number* x, bool new_x, Number* grad_f);
00119 
00129   virtual bool eval_g(Index n, const Number* x, bool new_x, Index m, Number* g);
00130 
00142   virtual bool eval_jac_g(Index n, const Number* x, bool new_x,
00143                           Index m, Index nele_jac, Index* iRow, Index *jCol,
00144                           Number* values);
00145   
00157   virtual bool eval_h(Index n, const Number* x, bool new_x,
00158                       Number obj_factor, Index m, const Number* lambda,
00159                       bool new_lambda, Index nele_hess, Index* iRow,
00160                       Index* jCol, Number* values);
00161 
00162   
00164   virtual void finalize_solution(TMINLP::SolverReturn status,
00165                                  Index n, const Number* x, Number obj_value);
00166   
00168 
00169   virtual const SosInfo * sosConstraints() const{return NULL;}
00170   virtual const BranchingInfo* branchingInfo() const{return NULL;}
00171   
00172   
00173   void printSolutionAtEndOfAlgorithm(){
00174     printSol_ = true;}
00175   
00176 private:
00177    bool printSol_;
00178 };
00179 
00180 #endif