00001 /*===========================================================================* 00002 * This file is part of the Abstract Library for Parallel Search (ALPS). * 00003 * * 00004 * ALPS is distributed under the Common Public License as part of the * 00005 * COIN-OR repository (http://www.coin-or.org). * 00006 * * 00007 * Authors: * 00008 * * 00009 * Yan Xu, Lehigh University * 00010 * Ted Ralphs, Lehigh University * 00011 * * 00012 * Conceptual Design: * 00013 * * 00014 * Yan Xu, Lehigh University * 00015 * Ted Ralphs, Lehigh University * 00016 * Laszlo Ladanyi, IBM T.J. Watson Research Center * 00017 * Matthew Saltzman, Clemson University * 00018 * * 00019 * * 00020 * Copyright (C) 2001-2007, Lehigh University, Yan Xu, and Ted Ralphs. * 00021 *===========================================================================*/ 00022 00023 //############################################################################# 00024 // This file is modified from SbbHeuristic.hpp 00025 //############################################################################# 00026 00027 #ifndef AbcHeuristic_h_ 00028 #define AbcHeuristic_h_ 00029 00030 #include <string> 00031 #include <vector> 00032 #include "CoinPackedMatrix.hpp" 00033 #include "OsiCuts.hpp" 00034 00035 class OsiSolverInterface; 00036 class AbcModel; 00037 00038 //############################################################################# 00039 00041 class AbcHeuristic { 00042 public: 00043 // Default Constructor 00044 AbcHeuristic (); 00045 00046 // Constructor with model - assumed before cuts 00047 AbcHeuristic (AbcModel & model); 00048 00049 virtual ~AbcHeuristic(); 00050 00052 virtual void setModel(AbcModel * model); 00053 00055 virtual AbcHeuristic * clone() const=0; 00056 00062 virtual int solution(double & objectiveValue, 00063 double * newSolution)=0; 00064 00072 virtual int solution(double & objectiveValue, 00073 double * newSolution, 00074 OsiCuts & cs) {return 0;} 00075 00076 protected: 00077 00079 AbcModel * model_; 00080 private: 00081 00083 AbcHeuristic & operator=(const AbcHeuristic& rhs); 00084 00085 }; 00086 00090 class AbcRounding : public AbcHeuristic { 00091 public: 00092 00093 // Default Constructor 00094 AbcRounding (); 00095 00096 // Constructor with model - assumed before cuts 00097 AbcRounding (AbcModel & model); 00098 00099 // Copy constructor 00100 AbcRounding ( const AbcRounding &); 00101 00102 // Destructor 00103 ~AbcRounding (); 00104 00106 virtual AbcHeuristic * clone() const; 00107 00109 virtual void setModel(AbcModel * model); 00110 00116 virtual int solution(double & objectiveValue, 00117 double * newSolution); 00118 00119 00121 void setSeed(int value) 00122 { seed_ = value;} 00123 00124 protected: 00125 // Data 00126 00127 // Original matrix by column 00128 CoinPackedMatrix matrix_; 00129 00130 // Original matrix by 00131 CoinPackedMatrix matrixByRow_; 00132 00133 // Seed for random stuff 00134 int seed_; 00135 00136 private: 00138 AbcRounding & operator=(const AbcRounding& rhs); 00139 }; 00140 00141 00142 #endif 00143