Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00051 #ifndef OGDF_COINY_H
00052 #define OGDF_COINY_H
00053
00054 #include <ogdf/basic/basic.h>
00055
00056
00057 #ifndef USE_COIN
00058
00059 #define THROW_NO_COIN_EXCEPTION OGDF_THROW_PARAM(LibraryNotSupportedException, lnscCoin)
00060
00061 namespace ogdf {
00062 class CoinCallbacks {};
00063 }
00064
00065 #else // USE_COIN
00066
00067 #define OGDF_THROW_NO_CALLBACK_EXCEPTION
00068
00069 #include <OsiSolverInterface.hpp>
00070 #include <CoinPackedVector.hpp>
00071
00072 namespace ogdf {
00073
00074 class OGDF_EXPORT CoinCallbacks {
00075 friend class OGDF_EXPORT CoinManager;
00076 public:
00077 enum CallbackType { CT_Cut = 1, CT_Heuristic = 2, CT_Incumbent = 4, CT_Branch = 8 };
00078 enum CutReturn { CR_Error, CR_SolutionValid, CR_AddCuts, CR_DontAddCuts, CR_NoCutsFound };
00079 enum HeuristicReturn { HR_Error, HR_Ignore, HR_Update };
00080 enum IncumbentReturn { IR_Error, IR_Ignore, IR_Update };
00081
00082 virtual CutReturn cutCallback(const double , const double* , OsiCuts* ) { OGDF_THROW_NO_CALLBACK_EXCEPTION; return CR_Error; };
00083 virtual HeuristicReturn heuristicCallback(double& , double* ) { OGDF_THROW_NO_CALLBACK_EXCEPTION; return HR_Error; };
00084 virtual IncumbentReturn incumbentCallback(const double , const double* ) { OGDF_THROW_NO_CALLBACK_EXCEPTION; return IR_Error; };
00085
00086 private:
00087 bool registerCallbacks(OsiSolverInterface* _posi, int callbackTypes);
00088 };
00089
00090 class OGDF_EXPORT CoinManager {
00091 public:
00092 static OsiSolverInterface* createCorrectOsiSolverInterface();
00093 static OsiSolverInterface* createCorrectOsiSolverInterface(CoinCallbacks* ccc, int callbackTypes) {
00094 OsiSolverInterface* posi = createCorrectOsiSolverInterface();
00095 if(ccc->registerCallbacks(posi, callbackTypes))
00096 return posi;
00097 delete posi;
00098 return NULL;
00099 }
00100 static void logging(OsiSolverInterface* osi, bool logMe);
00101 };
00102
00103 }
00104
00105
00106 #endif // USE_COIN
00107
00108 #endif // OGDF_COINY_H
00109