/build/buildd/coinor-cbc-2.5.0/Cbc/src/CbcFathomDynamicProgramming.hpp
Go to the documentation of this file.
00001 /* $Id: CbcFathomDynamicProgramming.hpp 1432 2010-02-07 19:33:53Z bjarni $ */
00002 // Copyright (C) 2004, International Business Machines
00003 // Corporation and others.  All Rights Reserved.
00004 #ifndef CbcFathomDynamicProgramming_H
00005 #define CbcFathomDynamicProgramming_H
00006 
00007 #include "CbcFathom.hpp"
00008 
00009 //#############################################################################
00026 class CbcFathomDynamicProgramming : public CbcFathom {
00027 public:
00028     // Default Constructor
00029     CbcFathomDynamicProgramming ();
00030 
00031     // Constructor with model - assumed before cuts
00032     CbcFathomDynamicProgramming (CbcModel & model);
00033     // Copy constructor
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     }
00061     inline void setMaximumSize(int value) {
00062         maximumSizeAllowed_ = value;
00063     }
00065     int checkPossible(int allowableSize = 0);
00066     // set algorithm
00067     inline void setAlgorithm(int value) {
00068         algorithm_ = value;
00069     }
00073     bool tryColumn(int numberElements, const int * rows,
00074                    const double * coefficients, double cost,
00075                    int upper = COIN_INT_MAX);
00077     inline const double * cost() const {
00078         return cost_;
00079     }
00081     inline const int * back() const {
00082         return back_;
00083     }
00085     inline int target() const {
00086         return target_;
00087     }
00089     inline void setTarget(int value) {
00090         target_ = value;
00091     }
00092 private:
00094     void gutsOfDelete();
00095 
00099     bool addOneColumn0(int numberElements, const int * rows,
00100                        double cost);
00105     bool addOneColumn1(int numberElements, const int * rows,
00106                        const int * coefficients, double cost);
00112     bool addOneColumn1A(int numberElements, const int * rows,
00113                         const int * coefficients, double cost);
00115     int bitPattern(int numberElements, const int * rows,
00116                    const int * coefficients);
00118     int bitPattern(int numberElements, const int * rows,
00119                    const double * coefficients);
00121     int decodeBitPattern(int bitPattern, int * values, int numberRows);
00122 
00123 protected:
00124 
00126     int size_;
00130     int type_;
00132     double * cost_;
00134     int * back_;
00136     int * lookup_;
00138     int * indices_;
00140     int numberActive_;
00142     int maximumSizeAllowed_;
00144     int * startBit_;
00146     int * numberBits_;
00148     int * rhs_;
00150     int * coefficients_;
00152     int target_;
00154     int numberNonOne_;
00156     int bitPattern_;
00158     int algorithm_;
00159 private:
00160 
00162     CbcFathomDynamicProgramming & operator=(const CbcFathomDynamicProgramming& rhs);
00163 
00164 };
00165 
00166 #endif
00167