00001 // Copyright (C) 2002, International Business Machines 00002 // Corporation and others. All Rights Reserved. 00003 #ifndef SbbHeuristic_H 00004 #define SbbHeuristic_H 00005 00006 #include <string> 00007 #include <vector> 00008 #include "CoinPackedMatrix.hpp" 00009 #include "OsiCuts.hpp" 00010 00011 class OsiSolverInterface; 00012 00013 class SbbModel; 00014 00015 //############################################################################# 00018 class SbbHeuristic { 00019 public: 00020 // Default Constructor 00021 SbbHeuristic (); 00022 00023 // Constructor with model - assumed before cuts 00024 SbbHeuristic (SbbModel & model); 00025 00026 virtual ~SbbHeuristic(); 00027 00029 virtual void setModel(SbbModel * model); 00030 00032 virtual SbbHeuristic * clone() const=0; 00033 00039 virtual int solution(double & objectiveValue, 00040 double * newSolution)=0; 00041 00049 virtual int solution(double & objectiveValue, 00050 double * newSolution, 00051 OsiCuts & cs) {return 0;}; 00052 00053 protected: 00054 00056 SbbModel * model_; 00057 private: 00058 00060 SbbHeuristic & operator=(const SbbHeuristic& rhs); 00061 00062 }; 00063 00067 class SbbRounding : public SbbHeuristic { 00068 public: 00069 00070 // Default Constructor 00071 SbbRounding (); 00072 00073 // Constructor with model - assumed before cuts 00074 SbbRounding (SbbModel & model); 00075 00076 // Copy constructor 00077 SbbRounding ( const SbbRounding &); 00078 00079 // Destructor 00080 ~SbbRounding (); 00081 00083 virtual SbbHeuristic * clone() const; 00084 00086 virtual void setModel(SbbModel * model); 00087 00093 virtual int solution(double & objectiveValue, 00094 double * newSolution); 00095 00096 00098 void setSeed(int value) 00099 { seed_ = value;}; 00100 00101 protected: 00102 // Data 00103 00104 // Original matrix by column 00105 CoinPackedMatrix matrix_; 00106 00107 // Original matrix by 00108 CoinPackedMatrix matrixByRow_; 00109 00110 // Seed for random stuff 00111 int seed_; 00112 00113 private: 00115 SbbRounding & operator=(const SbbRounding& rhs); 00116 }; 00117 00118 00119 #endif