Bonmin 1.4trunk
|
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 00076 int enableAdvanced_; 00077 }; 00078 00079 class RoundingFPump 00080 { 00081 public: 00083 RoundingFPump(TMINLP2TNLP* minlp); 00084 00086 ~RoundingFPump(); 00087 00089 void round(const double integerTolerance, 00090 const double primalTolerance, 00091 double* solution); 00092 00093 private: 00095 void gutsOfConstructor(); 00096 00098 TMINLP2TNLP* minlp_; 00099 00101 int numberRows_; 00102 00104 int numberColumns_; 00105 00107 vector<pair<int, int> >* col_and_jac_g_; 00108 00109 }; 00110 00111 } 00112 #endif