00001 /* $Id: BonCouenneInfo.hpp 154 2009-06-16 18:52:53Z pbelotti $ */ 00002 // (C) Copyright International Business Machines Corporation 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 // 00009 // Date : 02/10/2008 00010 00011 #ifndef BonCouenneInfos_H 00012 #define BonCouenneInfos_H 00013 00014 #include "BonBabInfos.hpp" 00015 #include "BonCbc.hpp" 00016 #include "IpSmartPtr.hpp" 00017 #include <list> 00018 00019 namespace Bonmin 00020 { 00022 class CouenneInfo : public Bonmin::BabInfo 00023 { 00024 public: 00026 class NlpSolution: public Ipopt::ReferencedObject 00027 { 00028 public: 00029 // meaningful constructor 00030 NlpSolution(int n, const double* sol, double objval); 00031 00032 // destructor 00033 ~NlpSolution(); 00034 00037 const double* solution() const 00038 { 00039 return sol_; 00040 } 00041 double objVal() const 00042 { 00043 return objVal_; 00044 } 00045 int nVars() const 00046 { 00047 return n_; 00048 } 00050 00051 private: 00053 NlpSolution(); 00054 NlpSolution(const NlpSolution&); 00055 void operator=(const NlpSolution&); 00057 00058 int n_; 00060 double* sol_; 00062 double objVal_; 00063 }; 00064 00066 CouenneInfo(int type); 00067 00069 CouenneInfo(const OsiBabSolver &other); 00070 00072 CouenneInfo(const CouenneInfo &other); 00073 00075 virtual ~CouenneInfo(); 00076 00078 virtual OsiAuxInfo * clone() const; 00079 00081 const std::list<Ipopt::SmartPtr<const NlpSolution> >& NlpSolutions() const { 00082 return nlpSols_; 00083 } 00084 00086 void addSolution(Ipopt::SmartPtr<const NlpSolution> newSol) 00087 { 00088 nlpSols_.push_back(newSol); 00089 } 00090 00091 protected: 00092 std::list<Ipopt::SmartPtr<const NlpSolution> > nlpSols_; 00093 }; 00094 }/* End namespace.*/ 00095 00096 #endif