Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

SbbNodeInfo Class Reference

#include <SbbNode.hpp>

Inheritance diagram for SbbNodeInfo:

SbbFullNodeInfo SbbPartialNodeInfo List of all members.

Public Member Functions

virtual void applyToModel (SbbModel *model, CoinWarmStartBasis *&basis, SbbCountRowCut **addCuts, int &currentNumberCuts) const=0
 Modify model according to information at node.

virtual SbbNodeInfobuildRowBasis (CoinWarmStartBasis &basis) const=0
virtual SbbNodeInfoclone () const=0
 Clone.

void increment (int amount=1)
 Increment number of references.

int decrement (int amount=1)
 Decrement number of references and return number left.

void initializeInfo (int number)
int numberBranchesLeft () const
 Return number of branches left in object.

int numberPointingToThis () const
 Return number of objects pointing to this.

int branchedOn ()
 Say one branch taken.

void throwAway ()
 Say thrown away.

SbbNodeInfoparent () const
 Parent of this.

void addCuts (OsiCuts &cuts, int numberToBranch, int *whichGenerator)
void addCuts (int numberCuts, SbbCountRowCut **cuts, int numberToBranch)
void deleteCuts (int numberToDelete, SbbCountRowCut **cuts)
void deleteCuts (int numberToDelete, int *which)
void deleteCut (int whichOne)
 Really delete a cut.

void decrementCuts (int change=1)
 Decrement active cut counts.

void decrementParentCuts (int change=1)
 Decrement all active cut counts in chain starting at parent.

void incrementParentCuts (int change=1)
 Increment all active cut counts in parent chain.

SbbCountRowCut ** cuts () const
 Array of pointers to cuts.

int numberCuts () const
 Number of row cuts (this node).

void setNumberCuts (int value)
void nullOwner ()
 Set owner null.

Constructors & destructors
 SbbNodeInfo ()
 SbbNodeInfo (SbbNodeInfo *parent)
 SbbNodeInfo (SbbNodeInfo *parent, SbbNode *owner)
virtual ~SbbNodeInfo ()

Protected Attributes

int numberPointingToThis_
SbbNodeInfoparent_
 parent

SbbNodeowner_
 Owner.

int numberCuts_
 Number of row cuts (this node).

SbbCountRowCut ** cuts_
 Array of pointers to cuts.

int numberRows_
int numberBranchesLeft_

Private Member Functions

SbbNodeInfooperator= (const SbbNodeInfo &rhs)
 Illegal Assignment operator.


Detailed Description

Information required to recreate the subproblem at this node

When a subproblem is initially created, it is represented by an SbbNode object and an attached SbbNodeInfo object.

The SbbNode contains information needed while the subproblem remains live. The SbbNode is deleted when the last branch arm has been evaluated.

The SbbNodeInfo contains information required to maintain the branch-and-cut search tree structure (links and reference counts) and to recreate the subproblem for this node (basis, variable bounds, cutting planes). An SbbNodeInfo object remains in existence until all nodes have been pruned from the subtree rooted at this node.

The principle used to maintain the reference count is that the reference count is always the sum of all potential and actual children of the node. Specifically,

Notice that the active subproblem lives in a sort of limbo, neither a potential or an actual node in the branch-and-cut tree.

SbbNodeInfo objects come in two flavours. An SbbFullNodeInfo object contains a full record of the information required to recreate a subproblem. An SbbPartialNodeInfo object expresses this information in terms of differences from the parent.

Definition at line 59 of file SbbNode.hpp.


Constructor & Destructor Documentation

SbbNodeInfo::SbbNodeInfo  ) 
 

Default Constructor

Creates an empty NodeInfo object.

Definition at line 27 of file SbbNode.cpp.

00028   :
00029   numberPointingToThis_(0),
00030   parent_(NULL),
00031   owner_(NULL),
00032   numberCuts_(0),
00033   cuts_(NULL),
00034   numberRows_(0),
00035   numberBranchesLeft_(0)
00036 {
00037 #ifdef CHECK_NODE
00038   printf("SbbNodeInfo %x Constructor\n",this);
00039 #endif
00040 }
// Constructor given parent

SbbNodeInfo::SbbNodeInfo SbbNodeInfo parent  ) 
 

Construct with parent

Creates a NodeInfo object which knows its parent and assumes it will in turn have two children.

Definition at line 42 of file SbbNode.cpp.

References numberCuts_, numberRows_, and parent_.

00043   :
00044   numberPointingToThis_(2),
00045   parent_(parent),
00046   owner_(NULL),
00047   numberCuts_(0),
00048   cuts_(NULL),
00049   numberRows_(0),
00050   numberBranchesLeft_(2)
00051 {
00052 #ifdef CHECK_NODE
00053   printf("SbbNodeInfo %x Constructor from parent %x\n",this,parent_);
00054 #endif
00055   if (parent_) {
00056     numberRows_ = parent_->numberRows_+parent_->numberCuts_;
00057   }
00058 }
// Constructor given parent and owner

SbbNodeInfo::SbbNodeInfo SbbNodeInfo parent,
SbbNode owner
 

Construct with parent and owner

As for `construct with parent', and attached to owner.

Definition at line 60 of file SbbNode.cpp.

References numberCuts_, numberRows_, and parent_.

00061   :
00062   numberPointingToThis_(2),
00063   parent_(parent),
00064   owner_(owner),
00065   numberCuts_(0),
00066   cuts_(NULL),
00067   numberRows_(0),
00068   numberBranchesLeft_(2)
00069 {
00070 #ifdef CHECK_NODE
00071   printf("SbbNodeInfo %x Constructor from parent %x\n",this,parent_);
00072 #endif
00073   if (parent_) {
00074     numberRows_ = parent_->numberRows_+parent_->numberCuts_;
00075   }
00076 }

SbbNodeInfo::~SbbNodeInfo  )  [virtual]
 

Destructor

Note that the destructor will recursively delete the parent if this nodeInfo is the last child.

Definition at line 83 of file SbbNode.cpp.

References cuts_, decrement(), SbbNode::nullNodeInfo(), numberPointingToThis_, owner_, and parent_.

00084 {
00085 #ifdef CHECK_NODE
00086   printf("SbbNodeInfo %x Destructor parent %x\n",this,parent_);
00087 #endif
00088 
00089   assert(!numberPointingToThis_);
00090 
00091   delete [] cuts_;
00092   if (owner_) 
00093     owner_->nullNodeInfo();
00094   if (parent_) {
00095     int numberLinks = parent_->decrement();
00096     if (!numberLinks) delete parent_;
00097   }
00098 }


Member Function Documentation

virtual void SbbNodeInfo::applyToModel SbbModel model,
CoinWarmStartBasis *&  basis,
SbbCountRowCut **  addCuts,
int &  currentNumberCuts
const [pure virtual]
 

Modify model according to information at node.

The routine modifies the model according to bound and basis information at node and adds any cuts to the addCuts array.

Implemented in SbbFullNodeInfo, and SbbPartialNodeInfo.

Referenced by SbbModel::addCuts1().

virtual SbbNodeInfo* SbbNodeInfo::buildRowBasis CoinWarmStartBasis basis  )  const [pure virtual]
 

Builds up row basis backwards (until original model). Returns NULL or previous one to apply . Depends on Free being 0 and impossible for cuts

Implemented in SbbFullNodeInfo, and SbbPartialNodeInfo.

Referenced by decrementParentCuts(), and incrementParentCuts().

void SbbNodeInfo::deleteCuts int  numberToDelete,
SbbCountRowCut **  cuts
 

Delete cuts (decrements counts) Slow unless cuts in same order as saved

Definition at line 299 of file SbbNode.cpp.

References cuts_, SbbCountRowCut::decrement(), and numberCuts_.

00300 {
00301   int i;
00302   int j;
00303   int last=-1;
00304   for (i=0;i<numberToDelete;i++) {
00305     SbbCountRowCut * next = cuts[i];
00306     for (j=last+1;j<numberCuts_;j++) {
00307       if (next==cuts_[j])
00308         break;
00309     }
00310     if (j==numberCuts_) {
00311       // start from beginning
00312       for (j=0;j<last;j++) {
00313         if (next==cuts_[j])
00314           break;
00315       }
00316       assert(j<last);
00317     }
00318     last=j;
00319     int number = cuts_[j]->decrement();
00320     if (!number)
00321       delete cuts_[j];
00322     cuts_[j]=NULL;
00323   }
00324   j=0;
00325   for (i=0;i<numberCuts_;i++) {
00326     if (cuts_[i])
00327       cuts_[j++]=cuts_[i];
00328   }
00329   numberCuts_ = j;
00330 }

void SbbNodeInfo::initializeInfo int  number  )  [inline]
 

Initialize reference counts

Initialize the reference counts used for tree maintenance.

Definition at line 123 of file SbbNode.hpp.

References numberBranchesLeft_, and numberPointingToThis_.

Referenced by SbbNode::initializeInfo().


Member Data Documentation

int SbbNodeInfo::numberBranchesLeft_ [protected]
 

Number of branch arms left to explore at this node

Todo:
There seems to be redundancy between this field and SbbBranchingObject::numberBranchesLeft_. It'd be good to sort out if both are necessary.

Definition at line 212 of file SbbNode.hpp.

Referenced by branchedOn(), decrementCuts(), decrementParentCuts(), initializeInfo(), numberBranchesLeft(), and throwAway().

int SbbNodeInfo::numberPointingToThis_ [protected]
 

Number of other nodes pointing to this node.

Number of existing and potential search tree nodes pointing to this node. `Existing' means referenced by parent_ of some other SbbNodeInfo. `Potential' means children still to be created (numberBranchesLeft_ of this SbbNodeInfo).

Definition at line 188 of file SbbNode.hpp.

Referenced by branchedOn(), decrement(), increment(), initializeInfo(), numberPointingToThis(), throwAway(), and ~SbbNodeInfo().

int SbbNodeInfo::numberRows_ [protected]
 

Number of rows in problem (before these cuts). This means that for top of chain it must be rows at continuous

Definition at line 204 of file SbbNode.hpp.

Referenced by decrementParentCuts(), incrementParentCuts(), and SbbNodeInfo().


The documentation for this class was generated from the following files:
Generated on Wed Dec 3 14:36:26 2003 for Sbb by doxygen 1.3.5