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

- File List
- File Members

# /home/coin/SVN-release/Blis-0.91.2/Bcps/src/BcpsTreeNode.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 Common 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-2009, Lehigh University, Yan Xu, and Ted Ralphs.       *
    00020  * All Rights Reserved.                                                      *
    00021  *===========================================================================*/
    00022
    00023 #ifndef BcpsTreeNode_h_
    00024 #define BcpsTreeNode_h_
    00025
    00026 #include "BcpsNodeDesc.h"
    00027
    00028 #include <vector>
    00029
    00030 #include "AlpsTreeNode.h"
    00031 #include "AlpsNodeDesc.h"
    00032
    00033 #include "BcpsBranchObject.h"
    00034 #include "BcpsObjectPool.h"
    00035
    00036 //#############################################################################
    00044 //#############################################################################
    00045
    00046 class BcpsTreeNode : public AlpsTreeNode {
    00047
    00048  protected:
    00049
    00052     BcpsBranchObject *branchObject_;
    00053
    00054  protected:
    00055
    00058     virtual int generateConstraints(BcpsModel *model,
    00059                                     BcpsConstraintPool *conPool) {
    00060         AlpsReturnStatus status = AlpsReturnStatusOk;
    00061         return status;
    00062     }
    00063
    00066     virtual int generateVariables(BcpsModel *model,
    00067                                   BcpsVariablePool *varPool) {
    00068         AlpsReturnStatus status = AlpsReturnStatusOk;
    00069         return status;
    00070     }
    00071
    00073     virtual int chooseBranchingObject(BcpsModel *model) = 0;
    00074
    00078     virtual int installSubProblem(BcpsModel *model) = 0;
    00079
    00091     virtual int handleBoundingStatus(int status, bool &keepOn, bool &fathomed){
    00092         // Default do nothing.
    00093         return BcpsReturnStatusOk;
    00094     }
    00095
    00096  public:
    00097
    00099     BcpsTreeNode() : branchObject_(NULL) { }
    00100
    00102     virtual ~BcpsTreeNode(){ delete branchObject_; }
    00103
    00110     virtual int process(bool isRoot = false, bool rampUp = false);
    00111
    00113     virtual int bound(BcpsModel *model) = 0;
    00114
    00119     virtual std::vector< CoinTriple<AlpsNodeDesc*, AlpsNodeStatus, double> >
    00120         branch() = 0;
    00121
    00123     const BcpsBranchObject * branchObject() const { return branchObject_; }
    00124
    00126     void setBranchObject(BcpsBranchObject * b) { branchObject_ = b; }
    00127
    00128  protected:
    00129
    00131     AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const {
    00132         AlpsReturnStatus status = AlpsReturnStatusOk;
    00133         int type = 0;
    00134         if (branchObject_) {
    00135             type = branchObject_->getType();
    00136             encoded->writeRep(type);
    00137             status = branchObject_->encode(encoded);
    00138         }
    00139         else {
    00140             encoded->writeRep(type);
    00141         }
    00142         return status;
    00143     }
    00144
    00145 #if 0 // Can't docode a down(blis) branching object here.
    00146
    00147     AlpsReturnStatus decodeBcps(AlpsEncoded &encoded) {
    00148         AlpsReturnStatus status = AlpsReturnStatusOk;
    00149         int mark;
    00150         encoded.readRep(mark);
    00151
    00152         if (mark == 1) {
    00153             // branchObject_ is not NULL.
    00154             status = branchObject_->encode(encoded);
    00155         }
    00156
    00157         return status;
    00158     }
    00159 #endif
    00160
    00161 };
    00162
    00163 #endif