Alps  2.0.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
KnapTreeNode Class Reference

Holds a Knapsack tree node. More...

#include <KnapTreeNode.h>

+ Inheritance diagram for KnapTreeNode:
+ Collaboration diagram for KnapTreeNode:

Public Member Functions

 KnapTreeNode (KnapModel *model)
 
 KnapTreeNode (KnapNodeDesc *&desc)
 
virtual ~KnapTreeNode ()
 
void setBranchOn (int b)
 
virtual AlpsTreeNodecreateNewTreeNode (AlpsNodeDesc *&desc) const
 The purpose of this function is be able to create the children of a node after branching. More...
 
virtual int process (bool isRoot=false, bool rampUp=false)
 
virtual std::vector< CoinTriple< AlpsNodeDesc *, AlpsNodeStatus, double > > branch ()
 
virtual AlpsReturnStatus encode (AlpsEncoded *encoded) const
 Encode this into the given AlpsEncoded object. More...
 
virtual AlpsReturnStatus decodeToSelf (AlpsEncoded &encoded)
 Decode the given AlpsEncoded object into this. More...
 
virtual AlpsKnowledgedecode (AlpsEncoded &encoded) const
 Decode the given AlpsEncoded object into a new AlpsKnowledge object and return a pointer to it. More...
 
- Public Member Functions inherited from AlpsTreeNode
 AlpsTreeNode ()
 
virtual ~AlpsTreeNode ()
 
bool operator< (const AlpsTreeNode &compNode)
 
AlpsNodeDescmodifyDesc ()
 Access the desc so that can modify it. More...
 
AlpsNodeDescgetDesc () const
 
void setDesc (AlpsNodeDesc *desc)
 
void removeChild (AlpsTreeNode *&child)
 Remove the pointer to given child from the list of children. More...
 
void addChild (AlpsTreeNode *&child)
 Add a child to the list of children for this node. More...
 
void removeDescendants ()
 Removes all the descendants of the node. More...
 
AlpsNodeStatus getStatus () const
 
void setStatus (const AlpsNodeStatus stat)
 get status. More...
 
bool isCandidate () const
 Query functions about specific stati. More...
 
bool isEvaluated () const
 
bool isPregnant () const
 
bool isBranched () const
 
bool isFathomed () const
 
bool isDiscarded () const
 
bool isActive () const
 Query/set node in-process indicator. More...
 
void setActive (const bool yesno)
 
AlpsNodeIndex_t getIndex () const
 Query/set node identifier (unique within subtree). More...
 
void setIndex (const AlpsNodeIndex_t index)
 
int getDepth () const
 Query/set what depth the search tree node is at. More...
 
void setDepth (const int depth)
 
double getSolEstimate () const
 Query/set the solution estimate of the node. More...
 
void setSolEstimate (double est)
 
double getQuality () const
 Query/set the quality of the node. More...
 
void setQuality (double quality)
 
int getNumChildren () const
 Query/set what the number of children. More...
 
void setNumChildren (const int numChildren)
 
void modifyNumChildren (const int s)
 
AlpsTreeNodegetChild (const int i) const
 Query/set pointer to the ith child. More...
 
void setChild (const int i, AlpsTreeNode *node)
 
AlpsTreeNodegetParent () const
 Get/set subtree. More...
 
void setParent (AlpsTreeNode *parent)
 
AlpsNodeIndex_t getParentIndex () const
 Get/set the index of the parent of the node. More...
 
void setParentIndex (AlpsNodeIndex_t index)
 
int getExplicit () const
 Get/set the indication of whether the node has full or differencing description. More...
 
void setExplicit (int fp)
 
virtual void convertToExplicit ()
 Convert explicit description to difference, and vise-vesa. More...
 
virtual void convertToRelative ()
 
int getSentMark () const
 Various marks used in parallel code. More...
 
void setSentMark (const int tf)
 
- Public Member Functions inherited from AlpsKnowledge
 AlpsKnowledge ()
 Default constructor. More...
 
 AlpsKnowledge (AlpsKnowledgeType type)
 
 AlpsKnowledge (AlpsKnowledgeType type, AlpsKnowledgeBroker *broker)
 
virtual ~AlpsKnowledge ()
 Destructor. More...
 
AlpsKnowledgeType getType () const
 Get knowledge type. More...
 
void setType (AlpsKnowledgeType t)
 Set knowledge type. More...
 
AlpsKnowledgeBrokerbroker ()
 Get pointer to the knowledge broker. More...
 
const AlpsKnowledgeBrokerbroker () const
 Get pointer to the knowledge broker. More...
 
void setBroker (AlpsKnowledgeBroker *broker)
 Set knowledge broker. More...
 
AlpsEncodedencode () const
 Encode the content of this into an AlpsEncoded object and return a pointer to it. More...
 

Private Member Functions

 KnapTreeNode (KnapTreeNode const &)
 
KnapTreeNodeoperator= (KnapTreeNode const &)
 

Private Attributes

int branchedOn_
 The index of the branching variable. More...
 

Additional Inherited Members

- Public Attributes inherited from AlpsKnowledge
AlpsKnowledgeBrokerbroker_
 
- Protected Attributes inherited from AlpsTreeNode
bool active_
 The subtree own this node. More...
 
AlpsNodeIndex_t index_
 The unique index of the tree node (across the whole search tree). More...
 
int depth_
 The depth of the node (in the whole tree – the root is at depth 0). More...
 
double solEstimate_
 The solution estimate. More...
 
double quality_
 The quality of this node. More...
 
AlpsTreeNodeparent_
 The parent of the tree node. More...
 
AlpsNodeIndex_t parentIndex_
 The index of parent of the tree node. More...
 
int numChildren_
 The number of children. More...
 
AlpsTreeNode ** children_
 
int explicit_
 Indicate whether the node description is explicit(1) or relative(0). More...
 
AlpsNodeDescdesc_
 The actual description of the tree node. More...
 
AlpsNodeStatus status_
 The current status of the node. More...
 
int sentMark_
 Various mark used in splitting and passing subtrees. More...
 

Detailed Description

Holds a Knapsack tree node.

Definition at line 42 of file KnapTreeNode.h.

Constructor & Destructor Documentation

◆ KnapTreeNode() [1/3]

KnapTreeNode::KnapTreeNode ( KnapModel model)

◆ KnapTreeNode() [2/3]

KnapTreeNode::KnapTreeNode ( KnapNodeDesc *&  desc)

◆ ~KnapTreeNode()

virtual KnapTreeNode::~KnapTreeNode ( )
inlinevirtual

Definition at line 49 of file KnapTreeNode.h.

◆ KnapTreeNode() [3/3]

KnapTreeNode::KnapTreeNode ( KnapTreeNode const &  )
private

Member Function Documentation

◆ setBranchOn()

void KnapTreeNode::setBranchOn ( int  b)
inline

Definition at line 51 of file KnapTreeNode.h.

◆ createNewTreeNode()

virtual AlpsTreeNode* KnapTreeNode::createNewTreeNode ( AlpsNodeDesc *&  desc) const
virtual

The purpose of this function is be able to create the children of a node after branching.

Implements AlpsTreeNode.

◆ process()

virtual int KnapTreeNode::process ( bool  isRoot = false,
bool  rampUp = false 
)
virtual

◆ branch()

virtual std::vector< CoinTriple<AlpsNodeDesc*, AlpsNodeStatus, double> > KnapTreeNode::branch ( )
virtual

◆ encode()

virtual AlpsReturnStatus KnapTreeNode::encode ( AlpsEncoded encoded) const
virtual

Encode this into the given AlpsEncoded object.

Reimplemented from AlpsKnowledge.

◆ decodeToSelf()

virtual AlpsReturnStatus KnapTreeNode::decodeToSelf ( AlpsEncoded encoded)
virtual

Decode the given AlpsEncoded object into this.

Reimplemented from AlpsKnowledge.

◆ decode()

virtual AlpsKnowledge* KnapTreeNode::decode ( AlpsEncoded encoded) const
virtual

Decode the given AlpsEncoded object into a new AlpsKnowledge object and return a pointer to it.

User application sub-classes should implement this since the returned pointer will point to user sub-class instances.

Implements AlpsKnowledge.

◆ operator=()

KnapTreeNode& KnapTreeNode::operator= ( KnapTreeNode const &  )
private

Member Data Documentation

◆ branchedOn_

int KnapTreeNode::branchedOn_
private

The index of the branching variable.

Definition at line 44 of file KnapTreeNode.h.


The documentation for this class was generated from the following file: