00001 /* $Id: BonNlpHeuristic.hpp 488 2011-01-10 17:06:41Z pbelotti $ */ 00002 // (C) Copyright International Business Machines Corporation 2007 00003 // All Rights Reserved. 00004 // This code is published under the Eclipse Public License (EPL). 00005 // 00006 // Authors : 00007 // Pierre Bonami, International Business Machines Corporation 00008 // 00009 // Date : 04/09/2007 00010 00011 #ifndef BonIpoptHeuristic_HPP 00012 #define BonIpoptHeuristic_HPP 00013 00014 #include "BonOsiTMINLPInterface.hpp" 00015 #include "CbcHeuristic.hpp" 00016 #include "BonOsiTMINLPInterface.hpp" 00017 #include "CouenneProblem.hpp" 00018 00019 namespace Couenne { 00020 00026 const double maxNlpInf_0 = 1e-5; 00027 00028 class NlpSolveHeuristic : public CbcHeuristic{ 00029 00030 public: 00032 NlpSolveHeuristic(); 00034 NlpSolveHeuristic(CbcModel & mip, Bonmin::OsiTMINLPInterface &nlp, bool cloneNlp = false, CouenneProblem * couenne = NULL); 00036 NlpSolveHeuristic(const NlpSolveHeuristic &other); 00037 00039 virtual ~NlpSolveHeuristic(); 00040 00042 virtual CbcHeuristic * clone() const; 00043 00045 NlpSolveHeuristic & operator=(const NlpSolveHeuristic &rhs); 00046 00048 void setNlp (Bonmin::OsiTMINLPInterface &nlp, bool cloneNlp = true); 00049 00051 void setCouenneProblem(CouenneProblem *); 00053 virtual void resetModel(CbcModel * model){} 00059 virtual int solution( double & objectiveValue, double * newSolution); 00061 void setMaxNlpInf(double value){ 00062 maxNlpInf_ = value;} 00064 void setNumberSolvePerLevel(int value){ 00065 numberSolvePerLevel_ = value;} 00066 00068 static void registerOptions (Ipopt::SmartPtr <Bonmin::RegisteredOptions>); 00069 00070 private: 00072 Bonmin::OsiTMINLPInterface * nlp_; 00074 bool hasCloned_; 00076 double maxNlpInf_; 00078 int numberSolvePerLevel_; 00080 CouenneProblem * couenne_; 00081 }; 00082 00083 } 00084 00085 #endif