Alps 1.5.12
Loading...
Searching...
No Matches
AbcTreeNode.h
Go to the documentation of this file.
1/*===========================================================================*
2 * This file is part of the Abstract Library for Parallel Search (ALPS). *
3 * *
4 * ALPS 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-2019, Lehigh University, Yan Xu, and Ted Ralphs. *
21 *===========================================================================*/
22
23#ifndef AbcTreeNode_h_
24#define AbcTreeNode_h_
25
26//#include <utility>
27#include "AlpsKnowledgeBroker.h"
28#include "AlpsTreeNode.h"
29
30#include "AbcModel.h"
31#include "AbcNodeDesc.h"
32
33//#############################################################################
34
40
41//#############################################################################
42
43class AbcTreeNode : public AlpsTreeNode {
44 private:
45 // NO: default constructor, copy constructor, assignment operator
48
49 private:
51 int branchedOn_;
52
54 double branchedOnVal_;
55
57 int branchedDir_;
58
61
64
65 public:
67 :
68 branchedOn_(-1),
70 branchedDir_(0),
73 {
74 desc_ = new AbcNodeDesc(dynamic_cast<AbcModel*>
75 (getKnowledgeBroker()->getModel()));
76 }
77
88
90 :
91 branchedOn_(-1),
93 branchedDir_(0),
96 {
97 desc_ = desc;
98 desc = 0;
99 //At the time of registering node, that node hasn't set broker
100 //desc_->setModel(getKnowledgeBroker()->getDataPool()->getModel());
101 }
102
104 {
105 }
106
108
110 virtual int process(bool isRoot = false, bool rampUp = false);
111
120 int chooseBranch (AbcModel * model, bool& strongFound);
121
125 inline double getObjValue() const { return quality_; }
126 inline void setObjValue(const double objValue) { quality_ = objValue; }
128
129 virtual std::vector< CoinTriple<AlpsNodeDesc*, AlpsNodeStatus, double> >
131
133 inline int numberUnsatisfied() const
134 { return numberUnsatisfied_; }
135
137 inline double guessedObjectiveValue() const
138 { return guessedObjectiveValue_; }
139
140 inline void setGuessedObjectiveValue(double value)
141 { guessedObjectiveValue_ = value; }
142
143 void setBranchedOn(int b) { branchedOn_ = b; }
145 void setBranchedDir(int d) { branchedDir_ = d; }
147 void setBranchedOnValue(double b) { branchedOnVal_ = b; }
149 int getBranchedOn() const { return branchedOn_; }
151 int getBranchedDir() const { return branchedDir_; }
153 double getBranchedOnValue() const { return branchedOnVal_; }
155 virtual AlpsEncoded* encode() const;
158
159};
160
161#endif
#define ALPS_BND_MAX
Definition Alps.h:147
#define ALPS_OBJ_MAX
Definition Alps.h:145
Model class for ALPS Branch and Cut.
Definition AbcModel.h:55
AbcTreeNode(AbcNodeDesc *&desc)
Definition AbcTreeNode.h:89
double guessedObjectiveValue() const
Guessed objective value (for solution)
double getBranchedOnValue() const
AbcTreeNode(const AbcTreeNode &)
void setBranchedOn(int b)
void setObjValue(const double objValue)
int chooseBranch(AbcModel *model, bool &strongFound)
Select the branch variable.
virtual std::vector< CoinTriple< AlpsNodeDesc *, AlpsNodeStatus, double > > branch()
virtual AlpsKnowledge * decode(AlpsEncoded &) const
This method should decode and return a pointer to a brand new object, i.e., the method must create a ...
double branchedOnVal_
The solution value (non-integral) of the branching variable.
Definition AbcTreeNode.h:54
AbcTreeNode & operator=(const AbcTreeNode &)
virtual int process(bool isRoot=false, bool rampUp=false)
Performing the bounding operation.
void setGuessedObjectiveValue(double value)
int branchedDir_
Branching direction.
Definition AbcTreeNode.h:57
void setBranchedDir(int d)
AbcTreeNode(AbcModel *m)
Definition AbcTreeNode.h:78
virtual AlpsEncoded * encode() const
This method should encode the content of the object and return a pointer to the encoded form.
int numberUnsatisfied() const
Get the number of objects unsatisfied at this node.
int numberUnsatisfied_
The number of objects unsatisfied at this node.
Definition AbcTreeNode.h:63
int getBranchedDir() const
double getObjValue() const
Query/set the objective value (could be approximately or not exit) of the node.
int branchedOn_
The index of the branching variable.
Definition AbcTreeNode.h:51
double guessedObjectiveValue_
Guessed satisfied Objective value.
Definition AbcTreeNode.h:60
virtual AlpsTreeNode * createNewTreeNode(AlpsNodeDesc *&desc) const
The purpose of this function is be able to create the children of a node after branching.
void setBranchedOnValue(double b)
int getBranchedOn() const
This data structure is to contain the packed form of an encodable knowledge.
Definition AlpsEncoded.h:25
AlpsKnowledge(const AlpsKnowledge &)
A class to refer to the description of a search tree node.
This class holds one node of the search tree.
AlpsNodeDesc * desc_
The actual description of the tree node.
AlpsTreeNode(const AlpsTreeNode &)
double quality_
The quality of this node.
AlpsKnowledgeBroker * getKnowledgeBroker() const
Functions to access/set the knwoledge broker.
AbcVarStatus
Definition AbcTreeNode.h:35
@ AbcVarFixedToLB
Definition AbcTreeNode.h:38
@ AbcVarFixedToUB
Definition AbcTreeNode.h:37
@ AbcVarFree
Definition AbcTreeNode.h:36