Bonmin
1.7
|
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 namespace Bonmin 00017 { 00018 class HeuristicFPump : public CbcHeuristic 00019 { 00020 public: 00022 HeuristicFPump(); 00023 00025 HeuristicFPump(BonminSetup * setup); 00026 00028 HeuristicFPump(const HeuristicFPump ©); 00029 00031 ~HeuristicFPump() {} 00032 00034 HeuristicFPump & operator=(const HeuristicFPump & rhs); 00035 00037 virtual CbcHeuristic * clone() const{ 00038 return new HeuristicFPump(*this); 00039 } 00040 00042 virtual void resetModel(CbcModel * model){ 00043 setModel(model); 00044 } 00045 00047 void setSetup(BonminSetup * setup){ 00048 setup_ = setup; 00049 Initialize(setup_->options()); 00050 } 00051 00053 virtual int solution(double &solutionValue, double *betterSolution); 00054 00056 virtual int solution(double &solutionValue, double *betterSolution, OsiCuts & cs) 00057 { 00058 return solution(solutionValue, betterSolution); 00059 } 00060 00062 static void registerOptions(Ipopt::SmartPtr<Bonmin::RegisteredOptions> roptions); 00063 00065 void Initialize(Ipopt::SmartPtr<Ipopt::OptionsList> options); 00066 00067 private: 00069 BonminSetup * setup_; 00070 00072 int objective_norm_; 00073 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 std::vector<std::pair<int, int> >* col_and_jac_g_; 00107 00108 }; 00109 00110 } 00111 #endif