Blis  0.94.0
BlisTreeNode.h
Go to the documentation of this file.
1 /*===========================================================================*
2  * This file is part of the BiCePS Linear Integer Solver (BLIS). *
3  * *
4  * BLIS 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  * *
20  * Copyright (C) 2001-2013, Lehigh University, Yan Xu, and Ted Ralphs. *
21  * All Rights Reserved. *
22  *===========================================================================*/
23 
24 #ifndef BlisTreeNode_h_
25 #define BlisTreeNode_h_
26 
27 //#############################################################################
28 
29 #include "AlpsNodeDesc.h"
30 
31 #include "BcpsObjectPool.h"
32 #include "BcpsTreeNode.h"
33 
34 #include "BcpsNodeDesc.h"
35 #include "BlisNodeDesc.h"
36 
37 class BcpsModel;
38 class BlisModel;
39 
40 
41 //#############################################################################
45 //#############################################################################
46 
47 
48 class BlisTreeNode : public BcpsTreeNode {
49 private:
50 
52  BlisTreeNode(const BlisTreeNode&);
53 
54  BlisTreeNode& operator=(const BlisTreeNode&);
55 
57  //BcpsConstraintPool *constraintPool_;
58 
60  //BcpsVariablePool *variablePool_;
61 
63  //void saveExplicit();
64 
66  bool parallel(BlisModel *model,
67  BcpsConstraintPool &conPool,
68  int lastNew,
69  BlisConstraint *aCon);
70 
72  double estimateSolution(BlisModel *model,
73  const double *lpSolution,
74  double lpObjValue) const;
75 
76 public:
77 
80  :
81  BcpsTreeNode()
82  { init(); }
83 
86  init();
87  desc_ = new BlisNodeDesc(m);
88  }
89 
91  BlisTreeNode(AlpsNodeDesc *&desc) {
92  init();
93  desc_ = desc;
94  desc = NULL;
95  }
96 
98  virtual ~BlisTreeNode() {
99  //std::cout << "------ Delete blis part of node" << std::endl;
100  }
101 
103  void init() {
104  //constraintPool_ = new BcpsConstraintPool;
105  //variablePool_ = new BcpsVariablePool;
106  }
107 
109  AlpsTreeNode* createNewTreeNode(AlpsNodeDesc *&desc) const;
110 
112  virtual void convertToExplicit();
114  virtual void convertToRelative();
116 
118  virtual int installSubProblem(BcpsModel *mode);
119 
121  virtual int process(bool isRoot = false, bool rampUp = false);
122 
124  virtual int bound(BcpsModel *model);
125 
130  virtual std::vector< CoinTriple<AlpsNodeDesc*, AlpsNodeStatus, double> >
131  branch();
132 
134  int selectBranchObject(BlisModel *model,
135  bool& foundSol,
136  int numPassesLeft);
137 
139  virtual int chooseBranchingObject(BcpsModel*) { return AlpsReturnStatusOk;}
140 
141  // Why need below?
142  //using BcpsTreeNode::generateConstraints ;
143 
145  int generateConstraints(BlisModel *model, BcpsConstraintPool &conPool);
146 
151  int callHeuristics(BlisModel *model, bool onlyBeforeRoot=false);
152 
154  void getViolatedConstraints(BlisModel *model,
155  const double *currLpSolution,
156  BcpsConstraintPool & conPool);
157 
160  const double *solution,
161  BcpsConstraintPool & conPool);
162 
165 
167  //BcpsConstraintPool * constraintPool() { return constraintPool_; }
168 
170  //BcpsVariablePool * variablePool() { return variablePool_; }
171 
172  using AlpsKnowledge::encode ;
174  virtual AlpsEncoded* encode() const;
175 
177  virtual AlpsKnowledge* decode(AlpsEncoded&) const;
178 };
179 
180 #endif
virtual int bound(BcpsModel *model)
Bounding procedure.
virtual void convertToRelative()
virtual AlpsEncoded * encode() const
Encode this node for message passing.
virtual void convertToExplicit()
Convert explicit description to difference, and vise-vesa.
BlisTreeNode(BlisModel *m)
Useful constructor.
Definition: BlisTreeNode.h:85
virtual ~BlisTreeNode()
Destructor.
Definition: BlisTreeNode.h:98
virtual AlpsKnowledge * decode(AlpsEncoded &) const
Decode a node from an encoded object.
BlisReturnStatus
Definition: Blis.h:48
This is the class in which we are finally able to concretely define the bounding procedure.
Definition: BlisSubTree.h:33
virtual int chooseBranchingObject(BcpsModel *)
To be defined.
Definition: BlisTreeNode.h:139
virtual std::vector< CoinTriple< AlpsNodeDesc *, AlpsNodeStatus, double > > branch()
Takes the explicit description of the current active node and creates the children's descriptions...
void init()
Initilize member data when constructing a node.
Definition: BlisTreeNode.h:103
int callHeuristics(BlisModel *model, bool onlyBeforeRoot=false)
Call heuristic to search solutions.
int selectBranchObject(BlisModel *model, bool &foundSol, int numPassesLeft)
Select a branching object based on give branching strategy.
virtual int installSubProblem(BcpsModel *mode)
intall subproblem
void getViolatedConstraints(BlisModel *model, const double *currLpSolution, BcpsConstraintPool &conPool)
Get violated constraints.
BlisTreeNode(AlpsNodeDesc *&desc)
Useful constructor.
Definition: BlisTreeNode.h:91
BlisReturnStatus applyConstraints(BlisModel *model, const double *solution, BcpsConstraintPool &conPool)
Select and apply constraints.
BlisTreeNode()
Default constructor.
Definition: BlisTreeNode.h:79
int generateConstraints(BlisModel *model, BcpsConstraintPool &conPool)
Generate constraints.
BlisReturnStatus reducedCostFix(BlisModel *model)
Fix and tighten varaibles based optimality conditions.
AlpsTreeNode * createNewTreeNode(AlpsNodeDesc *&desc) const
Create a new node based on given desc.