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 BonHeuristicDive_HPP 00011 #define BonHeuristicDive_HPP 00012 #include "BonOsiTMINLPInterface.hpp" 00013 #include "BonBonminSetup.hpp" 00014 #include "CbcHeuristic.hpp" 00015 00016 namespace Bonmin 00017 { 00018 class HeuristicDive : public CbcHeuristic 00019 { 00020 public: 00022 HeuristicDive(); 00023 00025 HeuristicDive(BonminSetup * setup); 00026 00028 HeuristicDive(const HeuristicDive ©); 00029 00031 ~HeuristicDive() {} 00032 00034 HeuristicDive & operator=(const HeuristicDive & rhs); 00035 00037 virtual CbcHeuristic * clone() const = 0; 00038 00040 virtual void resetModel(CbcModel * model){ 00041 setModel(model); 00042 } 00043 00045 virtual void setSetup(BonminSetup * setup){ 00046 setup_ = setup; 00047 // Initialize(setup_->options()); 00048 } 00049 00051 void setPercentageToFix(double value) 00052 { percentageToFix_ = value; } 00053 00055 virtual int solution(double &solutionValue, double *betterSolution); 00056 00058 virtual void setInternalVariables(TMINLP2TNLP* minlp) = 0; 00059 00061 00063 virtual void selectVariableToBranch(TMINLP2TNLP* minlp, 00064 const vector<int> & integerColumns, 00065 const double* newSolution, 00066 int& bestColumn, 00067 int& bestRound) = 0; 00068 00069 protected: 00071 BonminSetup * setup_; 00072 00074 double percentageToFix_; 00075 00076 private: 00078 int howOften_; 00079 00080 }; 00081 00083 bool isNlpFeasible(TMINLP2TNLP* minlp, const double primalTolerance); 00084 00086 void adjustPrimalTolerance(TMINLP2TNLP* minlp, double & primalTolerance); 00087 } 00088 #endif