Alps  2.0.2
KnapNodeDesc.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 KnapNodeDesc_h_
28 #define KnapNodeDesc_h_
29 
30 #include "AlpsNodeDesc.h"
31 
36 };
37 
38 class KnapModel;
39 
50 class KnapNodeDesc : public AlpsNodeDesc {
54  // In the constructor, we should allocate this array to be the right
55  // length.
60 
61 public:
63  KnapNodeDesc(KnapModel * model, KnapVarStatus *& st, int cap, int val);
64 
65  virtual ~KnapNodeDesc();
66 
67  void setVarStatus(const int i, const KnapVarStatus status);
68  KnapVarStatus getVarStatus(const int i);
69  KnapVarStatus const * getVarStati() const;
70 
71 
72  inline int getUsedCapacity() const { return usedCapacity_; }
73  inline int getUsedValue() const { return usedValue_; }
74 
75  KnapModel * model() { return model_; }
76  KnapModel const * model() const { return model_; }
78 
82  virtual AlpsReturnStatus encode(AlpsEncoded * encoded) const;
84  virtual AlpsReturnStatus decodeToSelf(AlpsEncoded & encoded);
85  virtual AlpsNodeDesc * decode(AlpsEncoded & encoded) const;
86 private:
88  KnapNodeDesc(KnapNodeDesc const & other);
90  KnapNodeDesc & operator=(KnapNodeDesc const & rhs);
91 };
92 
93 #endif
KnapNodeDesc::varStatus_
KnapVarStatus * varStatus_
This array keeps track of which variables have been fixed by branching and which are still free.
Definition: KnapNodeDesc.h:56
KnapNodeDesc::usedCapacity_
int usedCapacity_
The total size of the items fixed to be put into the knapsack.
Definition: KnapNodeDesc.h:58
KnapVarFixedToZero
@ KnapVarFixedToZero
Definition: KnapNodeDesc.h:35
KnapNodeDesc::getUsedValue
int getUsedValue() const
Definition: KnapNodeDesc.h:73
AlpsReturnStatus
AlpsReturnStatus
Definition: Alps.h:261
KnapNodeDesc::decodeToSelf
virtual AlpsReturnStatus decodeToSelf(AlpsEncoded &encoded)
Unpack fields from the given AlpsEncoded object.
AlpsEncoded
Definition: AlpsEncoded.h:64
KnapNodeDesc::operator=
KnapNodeDesc & operator=(KnapNodeDesc const &rhs)
Disable copy assignment operator.
KnapNodeDesc::model_
KnapModel * model_
Definition: KnapNodeDesc.h:51
KnapVarFixedToOne
@ KnapVarFixedToOne
Definition: KnapNodeDesc.h:34
KnapNodeDesc::decode
virtual AlpsNodeDesc * decode(AlpsEncoded &encoded) const
Decode the given AlpsEncoded object into a new AlpsKnowledge object and return a pointer to it.
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
KnapNodeDesc::getUsedCapacity
int getUsedCapacity() const
Definition: KnapNodeDesc.h:72
KnapNodeDesc::~KnapNodeDesc
virtual ~KnapNodeDesc()
KnapNodeDesc::setVarStatus
void setVarStatus(const int i, const KnapVarStatus status)
KnapNodeDesc::model
KnapModel * model()
Definition: KnapNodeDesc.h:75
AlpsKnowledge::encode
AlpsEncoded * encode() const
Encode the content of this into an AlpsEncoded object and return a pointer to it.
AlpsNodeDesc.h
KnapNodeDesc::getVarStatus
KnapVarStatus getVarStatus(const int i)
KnapVarStatus
KnapVarStatus
Definition: KnapNodeDesc.h:32
KnapNodeDesc
Here, we need to fill in what the node description will look like.
Definition: KnapNodeDesc.h:50
KnapNodeDesc::model
const KnapModel * model() const
Definition: KnapNodeDesc.h:76
KnapNodeDesc::KnapNodeDesc
KnapNodeDesc(KnapModel *model)
KnapNodeDesc::getVarStati
const KnapVarStatus * getVarStati() const
KnapNodeDesc::usedValue_
int usedValue_
Definition: KnapNodeDesc.h:59
KnapVarFree
@ KnapVarFree
Definition: KnapNodeDesc.h:33