00001 // (C) Copyright International Business Machines Corporation 2008 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Authors : 00006 // Andreas Waechter, International Business Machines Corporation 00007 // 00008 // Date : 02/10/2008 00009 00010 #ifndef BonCouenneInfos_H 00011 #define BonCouenneInfos_H 00012 00013 #include "BonBabInfos.hpp" 00014 #include "BonCbc.hpp" 00015 #include "IpSmartPtr.hpp" 00016 #include <list> 00017 00018 namespace Bonmin 00019 { 00021 class CouenneInfo : public Bonmin::BabInfo 00022 { 00023 public: 00025 class NlpSolution: public Ipopt::ReferencedObject 00026 { 00027 public: 00028 // meaningful constructor 00029 NlpSolution(int n, const double* sol, double objval); 00030 00031 // destructor 00032 ~NlpSolution(); 00033 00036 const double* solution() const 00037 { 00038 return sol_; 00039 } 00040 double objVal() const 00041 { 00042 return objVal_; 00043 } 00044 int nVars() const 00045 { 00046 return n_; 00047 } 00049 00050 private: 00052 NlpSolution(); 00053 NlpSolution(const NlpSolution&); 00054 void operator=(const NlpSolution&); 00056 00057 int n_; 00059 double* sol_; 00061 double objVal_; 00062 }; 00063 00065 CouenneInfo(int type); 00066 00068 CouenneInfo(const OsiBabSolver &other); 00069 00071 CouenneInfo(const CouenneInfo &other); 00072 00074 virtual ~CouenneInfo(); 00075 00077 virtual OsiAuxInfo * clone() const; 00078 00080 const std::list<Ipopt::SmartPtr<const NlpSolution> >& NlpSolutions() const { 00081 return nlpSols_; 00082 } 00083 00085 void addSolution(Ipopt::SmartPtr<const NlpSolution> newSol) 00086 { 00087 nlpSols_.push_back(newSol); 00088 } 00089 00090 protected: 00091 std::list<Ipopt::SmartPtr<const NlpSolution> > nlpSols_; 00092 }; 00093 }/* End namespace.*/ 00094 00095 #endif