00001
00002
00003
00004
00005
00006 #ifndef CbcFathomDynamicProgramming_H
00007 #define CbcFathomDynamicProgramming_H
00008
00009 #include "CbcFathom.hpp"
00010
00011
00028 class CbcFathomDynamicProgramming : public CbcFathom {
00029 public:
00030
00031 CbcFathomDynamicProgramming ();
00032
00033
00034 CbcFathomDynamicProgramming (CbcModel & model);
00035
00036 CbcFathomDynamicProgramming(const CbcFathomDynamicProgramming & rhs);
00037
00038 virtual ~CbcFathomDynamicProgramming();
00039
00041 virtual void setModel(CbcModel * model);
00042
00044 virtual CbcFathom * clone() const;
00045
00047 virtual void resetModel(CbcModel * model);
00048
00057 virtual int fathom(double *& newSolution);
00058
00060 inline int maximumSize() const {
00061 return maximumSizeAllowed_;
00062 }
00063 inline void setMaximumSize(int value) {
00064 maximumSizeAllowed_ = value;
00065 }
00067 int checkPossible(int allowableSize = 0);
00068
00069 inline void setAlgorithm(int value) {
00070 algorithm_ = value;
00071 }
00075 bool tryColumn(int numberElements, const int * rows,
00076 const double * coefficients, double cost,
00077 int upper = COIN_INT_MAX);
00079 inline const double * cost() const {
00080 return cost_;
00081 }
00083 inline const int * back() const {
00084 return back_;
00085 }
00087 inline int target() const {
00088 return target_;
00089 }
00091 inline void setTarget(int value) {
00092 target_ = value;
00093 }
00094 private:
00096 void gutsOfDelete();
00097
00101 bool addOneColumn0(int numberElements, const int * rows,
00102 double cost);
00107 bool addOneColumn1(int numberElements, const int * rows,
00108 const int * coefficients, double cost);
00114 bool addOneColumn1A(int numberElements, const int * rows,
00115 const int * coefficients, double cost);
00117 int bitPattern(int numberElements, const int * rows,
00118 const int * coefficients);
00120 int bitPattern(int numberElements, const int * rows,
00121 const double * coefficients);
00123 int decodeBitPattern(int bitPattern, int * values, int numberRows);
00124
00125 protected:
00126
00128 int size_;
00132 int type_;
00134 double * cost_;
00136 int * back_;
00138 int * lookup_;
00140 int * indices_;
00142 int numberActive_;
00144 int maximumSizeAllowed_;
00146 int * startBit_;
00148 int * numberBits_;
00150 int * rhs_;
00152 int * coefficients_;
00154 int target_;
00156 int numberNonOne_;
00158 int bitPattern_;
00160 int algorithm_;
00161 private:
00162
00164 CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming& rhs);
00165
00166 };
00167
00168 #endif
00169