00001 // Copyright (C) 2007, International Business Machines Corporation and others. 00002 // All Rights Reserved. 00003 // This code is published under the Common Public License. 00004 // 00005 // Authors : 00006 // Joao P. Goncalves, International Business Machines Corporation 00007 // 00008 // Date : November 12, 2007 00009 00010 #ifndef BonHeuristicFPump_HPP 00011 #define BonHeuristicFPump_HPP 00012 #include "BonOsiTMINLPInterface.hpp" 00013 #include "BonBonminSetup.hpp" 00014 #include "CbcHeuristic.hpp" 00015 00016 using namespace std; 00017 namespace Bonmin 00018 { 00019 class HeuristicFPump : public CbcHeuristic 00020 { 00021 public: 00023 HeuristicFPump(); 00024 00026 HeuristicFPump(BonminSetup * setup); 00027 00029 HeuristicFPump(const HeuristicFPump ©); 00030 00032 ~HeuristicFPump() {} 00033 00035 HeuristicFPump & operator=(const HeuristicFPump & rhs); 00036 00038 virtual CbcHeuristic * clone() const{ 00039 return new HeuristicFPump(*this); 00040 } 00041 00043 virtual void resetModel(CbcModel * model){ 00044 setModel(model); 00045 } 00046 00048 void setSetup(BonminSetup * setup){ 00049 setup_ = setup; 00050 Initialize(setup_->options()); 00051 } 00052 00054 virtual int solution(double &solutionValue, double *betterSolution); 00055 00057 virtual int solution(double &solutionValue, double *betterSolution, OsiCuts & cs) 00058 { 00059 return solution(solutionValue, betterSolution); 00060 } 00061 00063 static void registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); 00064 00066 void Initialize(Ipopt::SmartPtr<Bonmin::OptionsList> options); 00067 00068 private: 00070 BonminSetup * setup_; 00071 00073 int objective_norm_; 00074 00075 int enableAdvanced_; 00076 }; 00077 00078 class RoundingFPump 00079 { 00080 public: 00082 RoundingFPump(TMINLP2TNLP* minlp); 00083 00085 ~RoundingFPump(); 00086 00088 void round(const double integerTolerance, 00089 const double primalTolerance, 00090 double* solution); 00091 00092 private: 00094 void gutsOfConstructor(); 00095 00097 TMINLP2TNLP* minlp_; 00098 00100 int numberRows_; 00101 00103 int numberColumns_; 00104 00106 vector<pair<int, int> >* col_and_jac_g_; 00107 00108 }; 00109 00110 } 00111 #endif