bpp-phyl  2.3.0
bpp::NNISearchable Class Referenceabstract

Interface for Nearest Neighbor Interchanges algorithms. More...

#include <Bpp/Phyl/NNISearchable.h>

+ Inheritance diagram for bpp::NNISearchable:
+ Collaboration diagram for bpp::NNISearchable:

Public Member Functions

 NNISearchable ()
 
virtual ~NNISearchable ()
 
virtual NNISearchableclone () const =0
 
virtual double testNNI (int nodeId) const =0 throw (NodeException)
 Send the score of a NNI movement, without performing it. More...
 
virtual void doNNI (int nodeId)=0 throw (NodeException)
 Perform a NNI movement. More...
 
virtual const TreegetTopology () const =0
 Get the tree associated to this NNISearchable object. More...
 
virtual double getTopologyValue () const =0 throw (Exception)
 Get the current score of this NNISearchable object. More...
 
virtual void topologyChangePerformed (const TopologyChangeEvent &event)
 Notify a topology change event. More...
 
virtual void topologyChangeTested (const TopologyChangeEvent &event)=0
 Notify a topology change event. More...
 
virtual void topologyChangeSuccessful (const TopologyChangeEvent &event)=0
 Tell that a topology change is definitive. More...
 

Detailed Description

Interface for Nearest Neighbor Interchanges algorithms.

This interface defines the methods to work with NNI algorithms.

NNISearchable objects are supposed to work with TreeTemplate objects. NNI are defined as follow:

------------->
    +------- C
    |
D --+ X  +-- B
    |    |
    +----+ F
         |
         +-- A

Where: -F is the focus (parent) node, -A and B are the son of F -X is the parent of F and so on. Two NNI's are possible for branch (XF):

  • swaping B and C, which is the same as D and A
  • swaping A and C, which is the same as D and B Because of the rooted representation, we'll consider B $\leftrightarrow$ C and A $\leftrightarrow$ C, which are simpler to perform.

For unrooted tree, we have at the 'root' node:

------------->
  +------- D
  |
X +------- C
  |
  |    +-- B
  |    |
  +----+ F
       |
       +-- A

In this case, we swap A or B with one of C or D. Which one of C or D depends on the implementation, but will always be the same, so that swapping A or B involve 2 distinct NNI.

Definition at line 96 of file NNISearchable.h.

Constructor & Destructor Documentation

bpp::NNISearchable::NNISearchable ( )
inline

Definition at line 101 of file NNISearchable.h.

virtual bpp::NNISearchable::~NNISearchable ( )
inlinevirtual

Definition at line 102 of file NNISearchable.h.

References clone(), doNNI(), getTopology(), getTopologyValue(), and testNNI().

Member Function Documentation

virtual NNISearchable* bpp::NNISearchable::clone ( ) const
pure virtual
virtual void bpp::NNISearchable::doNNI ( int  nodeId)
throw (NodeException
)
pure virtual

Perform a NNI movement.

Parameters
nodeIdThe id of the node defining the NNI movement.
Exceptions
NodeExceptionIf the node does not define a valid NNI.

Implemented in bpp::NNIHomogeneousTreeLikelihood, and bpp::DRTreeParsimonyScore.

Referenced by ~NNISearchable().

virtual const Tree& bpp::NNISearchable::getTopology ( ) const
pure virtual

Get the tree associated to this NNISearchable object.

Returns
The tree associated to this instance.

Implemented in bpp::NNIHomogeneousTreeLikelihood, and bpp::DRTreeParsimonyScore.

Referenced by bpp::NNITopologySearch::getTopology(), and ~NNISearchable().

virtual double bpp::NNISearchable::getTopologyValue ( ) const
throw (Exception
)
pure virtual

Get the current score of this NNISearchable object.

Returns
The current score of this instance.

Implemented in bpp::NNIHomogeneousTreeLikelihood, and bpp::DRTreeParsimonyScore.

Referenced by ~NNISearchable().

virtual double bpp::NNISearchable::testNNI ( int  nodeId) const
throw (NodeException
)
pure virtual

Send the score of a NNI movement, without performing it.

This methods sends the score variation. This variation must be negative if the new point is better, i.e. the object is to be used with a minimizing optimization (for consistence with Optimizer objects).

Parameters
nodeIdThe id of the node defining the NNI movement.
Returns
The score variation of the NNI.
Exceptions
NodeExceptionIf the node does not define a valid NNI.

Implemented in bpp::NNIHomogeneousTreeLikelihood, and bpp::DRTreeParsimonyScore.

Referenced by ~NNISearchable().

virtual void bpp::TopologyListener::topologyChangePerformed ( const TopologyChangeEvent event)
inlinevirtualinherited

Notify a topology change event.

This method is to be invoked after one or several NNI are performed. It allows appropriate recomputations.

In most case, this is the same as topologyChangeTested() + topologyChangeSuccessful().

Parameters
eventThe topology change event.

Definition at line 103 of file TopologySearch.h.

virtual void bpp::TopologyListener::topologyChangeSuccessful ( const TopologyChangeEvent event)
pure virtualinherited

Tell that a topology change is definitive.

This method is called after the topologyChangeTested() method.

Parameters
eventThe topology change event.

Implemented in bpp::NNITopologyListener2, bpp::NNIHomogeneousTreeLikelihood, bpp::NNITopologyListener, and bpp::DRTreeParsimonyScore.

virtual void bpp::TopologyListener::topologyChangeTested ( const TopologyChangeEvent event)
pure virtualinherited

Notify a topology change event.

Parameters
eventThe topology change event.

Implemented in bpp::NNITopologyListener2, bpp::NNIHomogeneousTreeLikelihood, bpp::NNITopologyListener, and bpp::DRTreeParsimonyScore.


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