00001
00002
00003 #ifndef CbcFathomDynamicProgramming_H
00004 #define CbcFathomDynamicProgramming_H
00005
00006 #include "CbcFathom.hpp"
00007
00008
00025 class CbcFathomDynamicProgramming : public CbcFathom {
00026 public:
00027
00028 CbcFathomDynamicProgramming ();
00029
00030
00031 CbcFathomDynamicProgramming (CbcModel & model);
00032
00033 CbcFathomDynamicProgramming(const CbcFathomDynamicProgramming & rhs);
00034
00035 virtual ~CbcFathomDynamicProgramming();
00036
00038 virtual void setModel(CbcModel * model);
00039
00041 virtual CbcFathom * clone() const;
00042
00044 virtual void resetModel(CbcModel * model);
00045
00054 virtual int fathom(double *& newSolution);
00055
00057 inline int maximumSize() const
00058 { return maximumSizeAllowed_;}
00059 inline void setMaximumSize(int value)
00060 { maximumSizeAllowed_=value;}
00062 int checkPossible(int allowableSize=0);
00063
00064 inline void setAlgorithm(int value)
00065 { algorithm_=value;}
00069 bool tryColumn(int numberElements, const int * rows,
00070 const double * coefficients, double cost,
00071 int upper=COIN_INT_MAX);
00073 inline const double * cost() const
00074 { return cost_;}
00076 inline const int * back() const
00077 { return back_;}
00079 inline int target() const
00080 { return target_;}
00082 inline void setTarget(int value)
00083 { target_=value;}
00084 private:
00086 void gutsOfDelete();
00087
00091 bool addOneColumn0(int numberElements, const int * rows,
00092 double cost);
00097 bool addOneColumn1(int numberElements, const int * rows,
00098 const int * coefficients, double cost);
00104 bool addOneColumn1A(int numberElements, const int * rows,
00105 const int * coefficients, double cost);
00107 int bitPattern(int numberElements, const int * rows,
00108 const int * coefficients);
00110 int bitPattern(int numberElements, const int * rows,
00111 const double * coefficients);
00113 int decodeBitPattern(int bitPattern, int * values, int numberRows);
00114
00115 protected:
00116
00118 int size_;
00122 int type_;
00124 double * cost_;
00126 int * back_;
00128 int * lookup_;
00130 int * indices_;
00132 int numberActive_;
00134 int maximumSizeAllowed_;
00136 int * startBit_;
00138 int * numberBits_;
00140 int * rhs_;
00142 int * coefficients_;
00144 int target_;
00146 int numberNonOne_;
00148 int bitPattern_;
00150 int algorithm_;
00151 private:
00152
00154 CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming& rhs);
00155
00156 };
00157
00158 #endif