Alps  2.0.2
KnapTreeNode.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  * Aykut Bulut, Lehigh University *
11  * Ted Ralphs, Lehigh University *
12  * *
13  * Conceptual Design: *
14  * *
15  * Yan Xu, Lehigh University *
16  * Ted Ralphs, Lehigh University *
17  * Laszlo Ladanyi, IBM T.J. Watson Research Center *
18  * Matthew Saltzman, Clemson University *
19  * *
20  * *
21  * Copyright (C) 2001-2019, Lehigh University, Yan Xu, Aykut Bulut, and *
22  * Ted Ralphs. *
23  * All Rights Reserved. *
24  *===========================================================================*/
25 
26 
27 #ifndef KnapTreeNode_h_
28 #define KnapTreeNode_h_
29 
30 // STL headers
31 #include <utility>
32 // ALPS headers
33 #include "AlpsTreeNode.h"
34 
35 class KnapModel;
36 class KnapNodeDesc;
37 
42 class KnapTreeNode : public AlpsTreeNode {
45 
46 public:
47  KnapTreeNode(KnapModel * model);
48  KnapTreeNode(KnapNodeDesc *& desc);
49  virtual ~KnapTreeNode() { }
50 
51  void setBranchOn(int b) { branchedOn_ = b; }
52 
53  virtual AlpsTreeNode * createNewTreeNode(AlpsNodeDesc*& desc) const;
54 
55  virtual int process(bool isRoot = false, bool rampUp = false);
56 
57  virtual std::vector< CoinTriple<AlpsNodeDesc*, AlpsNodeStatus, double> >
58  branch();
59 
62  virtual AlpsReturnStatus encode(AlpsEncoded * encoded) const;
64  virtual AlpsReturnStatus decodeToSelf(AlpsEncoded & encoded);
65  virtual AlpsKnowledge * decode(AlpsEncoded & encoded) const;
66 
67 private:
68  // NO: default constructor, copy constructor, assignment operator
69  KnapTreeNode(KnapTreeNode const &);
71 };
72 
73 #endif
KnapTreeNode::operator=
KnapTreeNode & operator=(KnapTreeNode const &)
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:261
AlpsEncoded
Definition: AlpsEncoded.h:64
KnapTreeNode::createNewTreeNode
virtual AlpsTreeNode * createNewTreeNode(AlpsNodeDesc *&desc) const
The purpose of this function is be able to create the children of a node after branching.
AlpsTreeNode.h
KnapTreeNode::decodeToSelf
virtual AlpsReturnStatus decodeToSelf(AlpsEncoded &encoded)
Decode the given AlpsEncoded object into this.
KnapTreeNode::setBranchOn
void setBranchOn(int b)
Definition: KnapTreeNode.h:51
AlpsTreeNode
This class holds one node of the search tree.
Definition: AlpsTreeNode.h:52
KnapTreeNode::~KnapTreeNode
virtual ~KnapTreeNode()
Definition: KnapTreeNode.h:49
AlpsNodeDesc
This is an abstract base class for subproblem data to be stored in a tree node.
Definition: AlpsNodeDesc.h:45
KnapModel
Definition: KnapModel.h:39
AlpsKnowledge
The abstract base class of Alps knowledges generated during the search.
Definition: AlpsKnowledge.h:63
AlpsKnowledge::encode
AlpsEncoded * encode() const
Encode the content of this into an AlpsEncoded object and return a pointer to it.
KnapTreeNode::process
virtual int process(bool isRoot=false, bool rampUp=false)
KnapTreeNode::KnapTreeNode
KnapTreeNode(KnapModel *model)
KnapNodeDesc
Here, we need to fill in what the node description will look like.
Definition: KnapNodeDesc.h:50
KnapTreeNode
Holds a Knapsack tree node.
Definition: KnapTreeNode.h:42
KnapTreeNode::branch
virtual std::vector< CoinTriple< AlpsNodeDesc *, AlpsNodeStatus, double > > branch()
KnapTreeNode::branchedOn_
int branchedOn_
The index of the branching variable.
Definition: KnapTreeNode.h:44
KnapTreeNode::decode
virtual AlpsKnowledge * decode(AlpsEncoded &encoded) const
Decode the given AlpsEncoded object into a new AlpsKnowledge object and return a pointer to it.