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

- File List
- File Members

BcpsTreeNode.h
Go to the documentation of this file.
1 /*===========================================================================*
2 * This file is part of the Branch, Constrain and Price Software (BiCePS) *
3 * *
4 * BiCePS is distributed under the Eclipse Public License as part of the *
5 * COIN-OR repository (http://www.coin-or.org). *
6 * *
7 * Authors: *
8 * *
9 * Yan Xu, Lehigh University *
10 * Ted Ralphs, Lehigh University *
11 * *
12 * Conceptual Design: *
13 * *
14 * Yan Xu, Lehigh University *
15 * Ted Ralphs, Lehigh University *
16 * Laszlo Ladanyi, IBM T.J. Watson Research Center *
17 * Matthew Saltzman, Clemson University *
18 * *
19 * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
20 * All Rights Reserved. *
21 *===========================================================================*/
22
23 #ifndef BcpsTreeNode_h_
24 #define BcpsTreeNode_h_
25
26 #include "BcpsNodeDesc.h"
27
28 #include <vector>
29
30 #include "AlpsTreeNode.h"
31 #include "AlpsNodeDesc.h"
32
33 #include "BcpsBranchObject.h"
34 #include "BcpsObjectPool.h"
35
36 //#############################################################################
44 //#############################################################################
45
46 class BcpsTreeNode : public AlpsTreeNode {
47
48 protected:
49
52 BcpsBranchObject *branchObject_;
53
54 protected:
55
58 virtual int generateConstraints(BcpsModel *model,
59 BcpsConstraintPool *conPool) {
60 AlpsReturnStatus status = AlpsReturnStatusOk;
61 return status;
62 }
63
66 virtual int generateVariables(BcpsModel *model,
67 BcpsVariablePool *varPool) {
68 AlpsReturnStatus status = AlpsReturnStatusOk;
69 return status;
70 }
71
73 virtual int chooseBranchingObject(BcpsModel *model) = 0;
74
78 virtual int installSubProblem(BcpsModel *model) = 0;
79
91 virtual int handleBoundingStatus(int status, bool &keepOn, bool &fathomed){
92 // Default do nothing.
93 return BcpsReturnStatusOk;
94 }
95
96 public:
97
99 BcpsTreeNode() : branchObject_(NULL) { }
100
102 virtual ~BcpsTreeNode(){ delete branchObject_; }
103
110 virtual int process(bool isRoot = false, bool rampUp = false);
111
113 virtual int bound(BcpsModel *model) = 0;
114
119 virtual std::vector< CoinTriple<AlpsNodeDesc*, AlpsNodeStatus, double> >
120 branch() = 0;
121
123 const BcpsBranchObject * branchObject() const { return branchObject_; }
124
126 void setBranchObject(BcpsBranchObject * b) { branchObject_ = b; }
127
128 protected:
129
131 AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const {
132 AlpsReturnStatus status = AlpsReturnStatusOk;
133 int type = 0;
134 if (branchObject_) {
135 type = branchObject_->getType();
136 encoded->writeRep(type);
137 status = branchObject_->encode(encoded);
138 }
139 else {
140 encoded->writeRep(type);
141 }
142 return status;
143 }
144
145 #if 0 // Can't docode a down(blis) branching object here.
146
147 AlpsReturnStatus decodeBcps(AlpsEncoded &encoded) {
148 AlpsReturnStatus status = AlpsReturnStatusOk;
149 int mark;
150 encoded.readRep(mark);
151
152 if (mark == 1) {
153 // branchObject_ is not NULL.
154 status = branchObject_->encode(encoded);
155 }
156
157 return status;
158 }
159 #endif
160
161 };
162
163 #endif
AlpsNodeDesc.h
BcpsTreeNode::encodeBcps
AlpsReturnStatus encodeBcps(AlpsEncoded *encoded) const
Pack Bcps portion of node into an encoded object.
Definition: BcpsTreeNode.h:131
AlpsEncoded::readRep
AlpsEncoded & readRep(T &value)
Read a single object of type T from repsentation_ .
Definition: AlpsEncoded.h:173
BcpsTreeNode::BcpsTreeNode
BcpsTreeNode()
Default constructor.
Definition: BcpsTreeNode.h:99
AlpsEncoded::writeRep
AlpsEncoded & writeRep(const T &value)
Write a single object of type T in repsentation_ .
Definition: AlpsEncoded.h:163
BcpsTreeNode::chooseBranchingObject
virtual int chooseBranchingObject(BcpsModel *model)=0
Choose a branching object.
BcpsTreeNode::installSubProblem
virtual int installSubProblem(BcpsModel *model)=0
Extract node information (bounds, constraints, variables) from this node and load the information int...
BcpsTreeNode::generateConstraints
virtual int generateConstraints(BcpsModel *model, BcpsConstraintPool *conPool)
Generate constraints.
Definition: BcpsTreeNode.h:58
BcpsVariablePool
Definition: BcpsObjectPool.h:127
BcpsTreeNode::~BcpsTreeNode
virtual ~BcpsTreeNode()
Destructor.
Definition: BcpsTreeNode.h:102
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:118
BcpsTreeNode::generateVariables
virtual int generateVariables(BcpsModel *model, BcpsVariablePool *varPool)
Generate variables.
Definition: BcpsTreeNode.h:66
BcpsTreeNode::setBranchObject
void setBranchObject(BcpsBranchObject *b)
Set the branching object.
Definition: BcpsTreeNode.h:126
BcpsBranchObject::getType
int getType()
Get type.
Definition: BcpsBranchObject.h:163
BcpsBranchObject
BcpsBranchObject contains the member data required when choosing branching entities and excuting actu...
Definition: BcpsBranchObject.h:47
AlpsEncoded
This data structure is to contain the packed form of an encodable knowledge.
Definition: AlpsEncoded.h:25
BcpsObjectPool.h
BcpsTreeNode::process
virtual int process(bool isRoot=false, bool rampUp=false)
This methods performs the processing of the node.
AlpsReturnStatusOk
Definition: Alps.h:119
BcpsTreeNode::handleBoundingStatus
virtual int handleBoundingStatus(int status, bool &keepOn, bool &fathomed)
Handle bounding status:
Definition: BcpsTreeNode.h:91
AlpsTreeNode
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:50
BcpsReturnStatusOk
Definition: Bcps.h:31
BcpsModel
Definition: BcpsModel.h:40
BcpsConstraintPool
Definition: BcpsObjectPool.h:104
BcpsTreeNode::branchObject
const BcpsBranchObject * branchObject() const
Return the branching object.
Definition: BcpsTreeNode.h:123
BcpsBranchObject::encode
virtual AlpsReturnStatus encode(AlpsEncoded *encoded) const
Pack to an encoded object.
Definition: BcpsBranchObject.h:248
BcpsTreeNode::bound
virtual int bound(BcpsModel *model)=0
Bounding procedure to estimate quality of this node.
AlpsTreeNode.h
BcpsTreeNode::branchObject_
BcpsBranchObject * branchObject_
Branching object for this node, which has information of how to execute branching.
Definition: BcpsTreeNode.h:52
BcpsTreeNode::branch
virtual std::vector< CoinTriple< AlpsNodeDesc *, AlpsNodeStatus, double > > branch()=0
This method must be invoked on a pregnant node (which has all the information needed to create the ch...
BcpsBranchObject.h
BcpsNodeDesc.h
BcpsTreeNode
This class contain the data for a BCPS search tree node.
Definition: BcpsTreeNode.h:46