- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# /home/coin/SVN-release/Blis-0.92.0/Bcps/src/BcpsBranchStrategy.h

Go to the documentation of this file.

    00001 /*===========================================================================*
    00002  * This file is part of the Branch, Constrain and Price Software (BiCePS)    *
    00003  *                                                                           *
    00004  * BiCePS is distributed under the Eclipse 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  * Copyright (C) 2001-2011, Lehigh University, Yan Xu, and Ted Ralphs.       *
    00020  * All Rights Reserved.                                                      *
    00021  *===========================================================================*/
    00022
    00023 #ifndef BcpsBranchStrategy_h_
    00024 #define BcpsBranchStrategy_h_
    00025
    00026 #include "BcpsBranchObject.h"
    00027
    00028 class BcpsModel;
    00029
    00030 //#############################################################################
    00031 // NOTE: Borrow ideas from COIN/Cbc.
    00032 //#############################################################################
    00033
    00034
    00039 class BcpsBranchStrategy {
    00040
    00041  private:
    00043     BcpsBranchStrategy & operator=(const BcpsBranchStrategy& rhs);
    00044
    00045  protected:
    00046
    00048     int type_;
    00049
    00051     BcpsModel *model_;
    00052
    00058     int numBranchObjects_;
    00060     BcpsBranchObject ** branchObjects_;
    00062
    00069     BcpsBranchObject * bestBranchObject_;
    00071     double bestChangeUp_;
    00073     int bestNumberUp_;
    00075     double bestChangeDown_;
    00077     int bestNumberDown_;
    00079
    00080  public:
    00081
    00083     BcpsBranchStrategy()
    00084         :
    00085         model_(NULL),
    00086         numBranchObjects_(0),
    00087         branchObjects_(NULL),
    00088         bestChangeUp_(0.0),
    00089         bestNumberUp_(0),
    00090         bestChangeDown_(0.0),
    00091         bestNumberDown_(0)
    00092         {}
    00093
    00095     BcpsBranchStrategy(BcpsModel *m)
    00096         :
    00097         model_(m),
    00098         numBranchObjects_(0),
    00099         branchObjects_(NULL),
    00100         bestChangeUp_(0.0),
    00101         bestNumberUp_(0),
    00102         bestChangeDown_(0.0),
    00103         bestNumberDown_(0)
    00104         {}
    00105
    00107     virtual ~BcpsBranchStrategy() {
    00108         for (int k = 0; k < numBranchObjects_; ++k) {
    00109             delete branchObjects_[k];
    00110         }
    00111         delete [] branchObjects_;
    00112     }
    00113
    00115     virtual BcpsBranchStrategy * clone() const = 0;
    00116
    00118     int getType() { return type_; }
    00119
    00121     void setType(int t) { type_ = t; }
    00122
    00124     void setModel(BcpsModel *m) { model_ = m; }
    00125
    00128     int getNumBranchObjects() { return numBranchObjects_; }
    00129     void getNumBranchObjects(int num) { numBranchObjects_ = num; }
    00130     BcpsBranchObject ** getBranchObjects() { return branchObjects_; }
    00131     void setBranchObjects(BcpsBranchObject **obj) { branchObjects_ = obj; }
    00132     BcpsBranchObject *getBestBranchObject() { return bestBranchObject_; }
    00133     void setBestBranchObject(BcpsBranchObject *ob) { bestBranchObject_ = ob; }
    00135
    00138     virtual void clearBest(BcpsModel * model) {
    00139         bestBranchObject_ = NULL;
    00140         bestChangeUp_ = 0.0;
    00141         bestNumberUp_ = 0;
    00142         bestChangeDown_ = 0.0;
    00143         bestNumberDown_ = 0;
    00144     }
    00145
    00147     virtual int createCandBranchObjects(int numPassesLeft, double ub){
    00148         return 0;
    00149     }
    00150
    00156     virtual int betterBranchObject(BcpsBranchObject * b,
    00157                                    BcpsBranchObject * bestSoFar) = 0;
    00158
    00162     virtual BcpsBranchObject *bestBranchObject();
    00163 };
    00164
    00165 #endif