00001 // (C) Copyright International Business Machines Corporation 2007 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Authors : 00006 // Pierre Bonami, International Business Machines Corporation 00007 // 00008 // Date : 04/23/2007 00009 00010 #ifndef BonAuxInfos_H 00011 #define BonAuxInfos_H 00012 #include <cstdlib> 00013 #include <vector> 00014 #include "OsiAuxInfo.hpp" 00015 #include "CoinSmartPtr.hpp" 00016 #include "BonTypes.hpp" 00017 #include "CoinFinite.hpp" 00018 00019 00020 namespace Bonmin { 00021 00022 00024 class AuxInfo : public OsiBabSolver { 00025 public: 00027 AuxInfo(int type); 00028 00030 AuxInfo(const OsiBabSolver &other); 00031 00033 AuxInfo(const AuxInfo &other); 00034 00036 virtual ~AuxInfo(); 00037 00039 virtual OsiAuxInfo * clone() const; 00040 00042 void setFeasibleNode(){ 00043 infeasibleNode_ = false;} 00044 00046 void setInfeasibleNode(){ 00047 infeasibleNode_ = true;} 00048 00050 bool infeasibleNode(){ 00051 return infeasibleNode_;} 00052 00054 const double * nlpSolution(){ 00055 00056 if(hasNlpSolution_) 00057 return nlpSolution_; 00058 else 00059 return NULL; 00060 } 00061 00063 const double nlpObjValue () 00064 {return hasNlpSolution_ ? objValue_ : COIN_DBL_MAX;} 00065 00067 void setNlpSolution(const double * sol, int numcols, double objValue); 00068 00070 void setHasNlpSolution(bool b){ 00071 hasNlpSolution_ = b;} 00073 const std::vector<double>& bestSolution2() const 00074 { 00075 return (*bestSolution2_)(); 00076 } 00079 double bestObj2() const 00080 { 00081 return (*bestObj2_)(); 00082 } 00084 void setBestObj2(double o) 00085 { 00086 (*bestObj2_)() = o; 00087 } 00088 void setBestSolution2(int n, double * d) 00089 { 00090 (*bestSolution2_)().clear(); 00091 (*bestSolution2_)().insert((*bestSolution2_)().end(),d, d+n); 00092 } 00093 protected: 00095 bool infeasibleNode_; 00097 double objValue_; 00099 double * nlpSolution_; 00101 int numcols_; 00103 bool hasNlpSolution_; 00105 Coin::SmartPtr< SimpleReferenced<std::vector<double> > > bestSolution2_; 00107 Coin::SmartPtr< SimpleReferenced<double> > bestObj2_; 00108 }; 00109 }/* End namespace.*/ 00110 00111 #endif 00112