00001
00002
00003
00004 #ifndef CbcFathomDynamicProgramming_H
00005 #define CbcFathomDynamicProgramming_H
00006
00007 #include "CbcFathom.hpp"
00008
00009
00026 class CbcFathomDynamicProgramming : public CbcFathom {
00027 public:
00028
00029 CbcFathomDynamicProgramming ();
00030
00031
00032 CbcFathomDynamicProgramming (CbcModel & model);
00033
00034 CbcFathomDynamicProgramming(const CbcFathomDynamicProgramming & rhs);
00035
00036 virtual ~CbcFathomDynamicProgramming();
00037
00039 virtual void setModel(CbcModel * model);
00040
00042 virtual CbcFathom * clone() const;
00043
00045 virtual void resetModel(CbcModel * model);
00046
00055 virtual int fathom(double *& newSolution);
00056
00058 inline int maximumSize() const
00059 { return maximumSizeAllowed_;}
00060 inline void setMaximumSize(int value)
00061 { maximumSizeAllowed_=value;}
00063 int checkPossible(int allowableSize=0);
00064
00065 inline void setAlgorithm(int value)
00066 { algorithm_=value;}
00070 bool tryColumn(int numberElements, const int * rows,
00071 const double * coefficients, double cost,
00072 int upper=COIN_INT_MAX);
00074 inline const double * cost() const
00075 { return cost_;}
00077 inline const int * back() const
00078 { return back_;}
00080 inline int target() const
00081 { return target_;}
00083 inline void setTarget(int value)
00084 { target_=value;}
00085 private:
00087 void gutsOfDelete();
00088
00092 bool addOneColumn0(int numberElements, const int * rows,
00093 double cost);
00098 bool addOneColumn1(int numberElements, const int * rows,
00099 const int * coefficients, double cost);
00105 bool addOneColumn1A(int numberElements, const int * rows,
00106 const int * coefficients, double cost);
00108 int bitPattern(int numberElements, const int * rows,
00109 const int * coefficients);
00111 int bitPattern(int numberElements, const int * rows,
00112 const double * coefficients);
00114 int decodeBitPattern(int bitPattern, int * values, int numberRows);
00115
00116 protected:
00117
00119 int size_;
00123 int type_;
00125 double * cost_;
00127 int * back_;
00129 int * lookup_;
00131 int * indices_;
00133 int numberActive_;
00135 int maximumSizeAllowed_;
00137 int * startBit_;
00139 int * numberBits_;
00141 int * rhs_;
00143 int * coefficients_;
00145 int target_;
00147 int numberNonOne_;
00149 int bitPattern_;
00151 int algorithm_;
00152 private:
00153
00155 CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming& rhs);
00156
00157 };
00158
00159 #endif