bpp-phyl  2.4.0
bpp::NNITopologySearch Class Reference

NNI topology search method. More...

#include <Bpp/Phyl/NNITopologySearch.h>

+ Inheritance diagram for bpp::NNITopologySearch:
+ Collaboration diagram for bpp::NNITopologySearch:

Public Member Functions

 NNITopologySearch (NNISearchable &tree, const std::string &algorithm=FAST, unsigned int verbose=2)
 
 NNITopologySearch (const NNITopologySearch &ts)
 
NNITopologySearchoperator= (const NNITopologySearch &ts)
 
virtual ~NNITopologySearch ()
 
void search ()
 Performs the search. More...
 
void addTopologyListener (TopologyListener *listener)
 Add a listener to the list. More...
 
const TreegetTopology () const
 Retrieve the tree. More...
 
NNISearchablegetSearchableObject ()
 
const NNISearchablegetSearchableObject () const
 

Static Public Attributes

static const std::string FAST = "Fast"
 
static const std::string BETTER = "Better"
 
static const std::string PHYML = "PhyML"
 

Protected Member Functions

void searchFast ()
 
void searchBetter ()
 
void searchPhyML ()
 
void notifyAllPerformed (const TopologyChangeEvent &event)
 Process a TopologyChangeEvent to all listeners. More...
 
void notifyAllTested (const TopologyChangeEvent &event)
 Process a TopologyChangeEvent to all listeners. More...
 
void notifyAllSuccessful (const TopologyChangeEvent &event)
 Process a TopologyChangeEvent to all listeners. More...
 

Private Attributes

NNISearchablesearchableTree_
 
std::string algorithm_
 
unsigned int verbose_
 
std::vector< TopologyListener * > topoListeners_
 

Detailed Description

NNI topology search method.

Several algorithm are implemented:

  • Fast algorithm: loop over all nodes, check all NNIs and perform the corresponding change if it improve the score. When a NNI is done, reloop from the first node without checking the remaining ones.
  • Better algorithm: loop over all nodes, check all NNIS. Then choose the NNI corresponding to the best improvement and perform it. Then re-loop over all nodes.
  • PhyML algorithm (not fully tested, use with care): as the previous one, but perform all NNI improving the score at the same time. Leads to faster convergence.

Definition at line 61 of file NNITopologySearch.h.

Constructor & Destructor Documentation

bpp::NNITopologySearch::NNITopologySearch ( NNISearchable tree,
const std::string &  algorithm = FAST,
unsigned int  verbose = 2 
)
inline

Definition at line 76 of file NNITopologySearch.h.

bpp::NNITopologySearch::NNITopologySearch ( const NNITopologySearch ts)
inline

Definition at line 83 of file NNITopologySearch.h.

References topoListeners_.

virtual bpp::NNITopologySearch::~NNITopologySearch ( )
inlinevirtual

Definition at line 107 of file NNITopologySearch.h.

References search().

Member Function Documentation

void bpp::NNITopologySearch::addTopologyListener ( TopologyListener listener)
inlinevirtual

Add a listener to the list.

All listeners will be notified in the order of the list. The first listener to be notified is the NNISearchable object itself.

The listener will be owned by this instance, and copied when needed.

Implements bpp::TopologySearch.

Definition at line 126 of file NNITopologySearch.h.

Referenced by bpp::OptimizationTools::optimizeTreeNNI(), and bpp::OptimizationTools::optimizeTreeNNI2().

NNISearchable* bpp::NNITopologySearch::getSearchableObject ( )
inline
Returns
The NNISearchable object associated to this instance.

Definition at line 143 of file NNITopologySearch.h.

References searchableTree_.

Referenced by bpp::OptimizationTools::optimizeTreeNNI(), and bpp::OptimizationTools::optimizeTreeNNI2().

const NNISearchable* bpp::NNITopologySearch::getSearchableObject ( ) const
inline
Returns
The NNISearchable object associated to this instance.

Definition at line 147 of file NNITopologySearch.h.

References notifyAllPerformed(), notifyAllSuccessful(), notifyAllTested(), searchableTree_, searchBetter(), searchFast(), and searchPhyML().

const Tree& bpp::NNITopologySearch::getTopology ( ) const
inline

Retrieve the tree.

Returns
The tree associated to this instance.

Definition at line 138 of file NNITopologySearch.h.

References bpp::NNISearchable::getTopology().

void NNITopologySearch::notifyAllPerformed ( const TopologyChangeEvent event)
protected

Process a TopologyChangeEvent to all listeners.

Definition at line 58 of file NNITopologySearch.cpp.

Referenced by getSearchableObject().

void NNITopologySearch::notifyAllSuccessful ( const TopologyChangeEvent event)
protected

Process a TopologyChangeEvent to all listeners.

Definition at line 76 of file NNITopologySearch.cpp.

Referenced by getSearchableObject().

void NNITopologySearch::notifyAllTested ( const TopologyChangeEvent event)
protected

Process a TopologyChangeEvent to all listeners.

Definition at line 67 of file NNITopologySearch.cpp.

Referenced by getSearchableObject().

NNITopologySearch& bpp::NNITopologySearch::operator= ( const NNITopologySearch ts)
inline

Definition at line 94 of file NNITopologySearch.h.

References algorithm_, searchableTree_, topoListeners_, and verbose_.

void NNITopologySearch::search ( )
virtual

Member Data Documentation

std::string bpp::NNITopologySearch::algorithm_
private

Definition at line 71 of file NNITopologySearch.h.

Referenced by operator=().

const string NNITopologySearch::BETTER = "Better"
static
const string NNITopologySearch::FAST = "Fast"
static
NNISearchable* bpp::NNITopologySearch::searchableTree_
private

Definition at line 70 of file NNITopologySearch.h.

Referenced by getSearchableObject(), and operator=().

std::vector<TopologyListener*> bpp::NNITopologySearch::topoListeners_
private

Definition at line 73 of file NNITopologySearch.h.

Referenced by NNITopologySearch(), and operator=().

unsigned int bpp::NNITopologySearch::verbose_
private

Definition at line 72 of file NNITopologySearch.h.

Referenced by operator=().


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