00001 /* $Id: CouenneSolverInterface.hpp 833 2012-02-11 14:09:50Z pbelotti $ 00002 * 00003 * Name: CouenneSolverInterface.hpp 00004 * Authors: Pietro Belotti, Carnegie Mellon University 00005 * Purpose: OsiSolverInterface with a pointer to a CouenneCutGenerator object 00006 * 00007 * (C) Carnegie-Mellon University, 2007-09. 00008 * This file is licensed under the Eclipse Public License (EPL) 00009 */ 00010 00011 #ifndef COUENNESOLVERINTERFACE_HPP 00012 #define COUENNESOLVERINTERFACE_HPP 00013 00014 class OsiSolverInterface; 00015 00016 namespace Couenne { 00017 00018 class CouenneCutGenerator; 00019 00026 00027 template <class T> class CouenneSolverInterface: public T { 00028 00029 public: 00030 00032 CouenneSolverInterface (CouenneCutGenerator *cg = NULL); 00033 00035 CouenneSolverInterface (const CouenneSolverInterface &src); 00036 00038 ~CouenneSolverInterface (); 00039 00041 virtual OsiSolverInterface * clone (bool copyData = true) const 00042 {return new CouenneSolverInterface (*this);} 00043 00045 virtual bool isProvenPrimalInfeasible () const; 00046 00048 virtual bool isProvenOptimal () const; 00049 00051 CouenneCutGenerator *CutGen () 00052 {return cutgen_;} 00053 00057 void setCutGenPtr (CouenneCutGenerator *cg) { 00058 cutgen_ = cg; 00059 //if (cutgen_ && !(cutgen_ -> enableLpImpliedBounds ())) 00060 //specialOptions_ = specialOptions_ | 262144; 00061 } 00062 00064 virtual void initialSolve (); 00065 00067 virtual void resolve (); 00068 00070 virtual void resolve_nobt () 00071 {T::resolve ();} 00072 00076 00077 virtual void markHotStart(); 00078 00080 virtual void solveFromHotStart(); 00081 00083 virtual void unmarkHotStart(); 00085 00087 virtual int tightenBounds (int lightweight); 00088 00090 //bool &doingResolve () 00091 //{return doingResolve_;} 00092 00094 bool isProvenDualInfeasible () const; 00095 //{return knowDualInfeasible_;} 00096 00099 virtual double getObjValue() const; 00100 00101 // /// returns LP optimum at root node 00102 // double rootLB () const 00103 // {return rootLB_;} 00104 00105 protected: 00106 00108 virtual int tightenBoundsCLP (int lightweight); 00109 00111 virtual int tightenBoundsCLP_Light (int lightweight); 00112 00116 CouenneCutGenerator *cutgen_; 00117 00119 bool knowInfeasible_; 00120 00122 bool knowOptimal_; 00123 00125 bool knowDualInfeasible_; 00126 00127 // /// First (root) LP not solved yet -- use this flag to obtain root 00128 // /// lower bound and print an alternative gap 00129 // bool beforeFirstRootLP_; 00130 00131 // /// First (root) LP bound -- used to get an alternative gap 00132 // double rootLB_; 00133 }; 00134 00135 } 00136 00137 // These source files are #included due to the template classes 00138 // defined in there 00139 00140 #include "CouenneSolverInterface.cpp" 00141 #include "CouenneLPtightenBounds.cpp" 00142 #include "CouenneLPtightenBoundsCLP-light.cpp" 00143 #include "CouenneLPtightenBoundsCLP.cpp" 00144 00145 #endif