00001 // Copyright (C) 2006, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 #ifndef OsiAuxInfo_H 00004 #define OsiAuxInfo_H 00005 00006 class OsiSolverInterface; 00007 00008 //############################################################################# 00019 class OsiAuxInfo { 00020 public: 00021 // Default Constructor 00022 OsiAuxInfo (void * appData = NULL); 00023 00024 // Copy Constructor 00025 OsiAuxInfo (const OsiAuxInfo & rhs); 00026 // Destructor 00027 virtual ~OsiAuxInfo(); 00028 00030 virtual OsiAuxInfo * clone() const; 00032 OsiAuxInfo & operator=(const OsiAuxInfo& rhs); 00033 00035 inline void * getApplicationData() const 00036 { return appData_;}; 00037 protected: 00039 void * appData_; 00040 }; 00041 //############################################################################# 00047 class OsiBabSolver : public OsiAuxInfo { 00048 public: 00049 // Default Constructor 00050 OsiBabSolver (int solverType=0); 00051 00052 // Copy Constructor 00053 OsiBabSolver (const OsiBabSolver & rhs); 00054 // Destructor 00055 virtual ~OsiBabSolver(); 00056 00058 virtual OsiAuxInfo * clone() const; 00060 OsiBabSolver & operator=(const OsiBabSolver& rhs); 00061 00063 inline void setSolver(const OsiSolverInterface * solver) 00064 { solver_ = solver;}; 00066 inline void setSolver(const OsiSolverInterface & solver) 00067 { solver_ = &solver;}; 00068 00074 int solution(double & objectiveValue, 00075 double * newSolution, int numberColumns); 00079 void setSolution(const double * solution, int numberColumns, double objectiveValue); 00080 00086 bool hasSolution(double & solutionValue, double * solution); 00087 00100 inline void setSolverType(int value) 00101 { solverType_=value;}; 00113 inline int solverType() const 00114 { return solverType_;}; 00117 inline bool solutionAddsCuts() const 00118 { return solverType_==3;}; 00120 inline bool alwaysTryCutsAtRootNode() const 00121 { return solverType_==4;}; 00124 inline bool solverAccurate() const 00125 { return solverType_==0||solverType_==2||solverType_==4;}; 00127 inline bool reducedCostsAccurate() const 00128 { return solverType_==0||solverType_==4;}; 00130 double mipBound() const; 00132 bool mipFeasible() const; 00134 inline void setMipBound(double value) 00135 { mipBound_ = value;}; 00137 inline double bestObjectiveValue() const 00138 { return bestObjectiveValue_;}; 00140 inline bool tryCuts() const 00141 { return solverType_!=2;}; 00143 inline bool warmStart() const 00144 { return solverType_!=2;}; 00145 protected: 00147 const OsiSolverInterface * solver_; 00159 int solverType_; 00161 double bestObjectiveValue_; 00163 double * bestSolution_; 00165 double mipBound_; 00167 int sizeSolution_; 00168 }; 00169 00170 #endif