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/09/2007 00009 00010 #ifndef BonIpoptHeuristic_HPP 00011 #define BonIpoptHeuristic_HPP 00012 #include "CbcHeuristic.hpp" 00013 #include "BonOsiTMINLPInterface.hpp" 00014 #include "CouenneProblem.hpp" 00015 namespace Bonmin{ 00019 const double maxNlpInf_0 = 1e-5; 00020 00021 class NlpSolveHeuristic : public CbcHeuristic{ 00022 public: 00024 NlpSolveHeuristic(); 00026 NlpSolveHeuristic(CbcModel & mip, OsiSolverInterface &nlp, bool cloneNlp = false, CouenneProblem * couenne = NULL); 00028 NlpSolveHeuristic(const NlpSolveHeuristic &other); 00029 00031 virtual ~NlpSolveHeuristic(); 00032 00034 virtual CbcHeuristic * clone() const; 00035 00037 NlpSolveHeuristic & operator=(const NlpSolveHeuristic &rhs); 00038 00040 void setNlp(OsiSolverInterface &nlp, bool cloneNlp = true); 00041 00043 void setCouenneProblem(CouenneProblem *); 00045 virtual void resetModel(CbcModel * model){} 00051 virtual int solution( double & objectiveValue, double * newSolution); 00053 void setMaxNlpInf(double value){ 00054 maxNlpInf_ = value;} 00056 void setNumberSolvePerLevel(int value){ 00057 numberSolvePerLevel_ = value;} 00058 private: 00060 OsiSolverInterface * nlp_; 00062 bool hasCloned_; 00064 double maxNlpInf_; 00066 int numberSolvePerLevel_; 00068 CouenneProblem * couenne_; 00069 }; 00070 }/* Ends namespace Bonmin. */ 00071 00072 #endif 00073