bpp-phyl  2.2.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 () throw (Exception)
 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 () throw (Exception)
 
void searchBetter () throw (Exception)
 
void searchPhyML () throw (Exception)
 
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

◆ NNITopologySearch() [1/2]

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

Definition at line 76 of file NNITopologySearch.h.

◆ NNITopologySearch() [2/2]

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

Definition at line 83 of file NNITopologySearch.h.

References topoListeners_.

◆ ~NNITopologySearch()

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

Definition at line 107 of file NNITopologySearch.h.

References topoListeners_.

Member Function Documentation

◆ addTopologyListener()

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.

References topoListeners_.

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

◆ getSearchableObject() [1/2]

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().

◆ getSearchableObject() [2/2]

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

Definition at line 147 of file NNITopologySearch.h.

References searchableTree_.

◆ getTopology()

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(), and searchableTree_.

◆ notifyAllPerformed()

void NNITopologySearch::notifyAllPerformed ( const TopologyChangeEvent event)
protected

Process a TopologyChangeEvent to all listeners.

Definition at line 58 of file NNITopologySearch.cpp.

◆ notifyAllSuccessful()

void NNITopologySearch::notifyAllSuccessful ( const TopologyChangeEvent event)
protected

Process a TopologyChangeEvent to all listeners.

Definition at line 76 of file NNITopologySearch.cpp.

◆ notifyAllTested()

void NNITopologySearch::notifyAllTested ( const TopologyChangeEvent event)
protected

Process a TopologyChangeEvent to all listeners.

Definition at line 67 of file NNITopologySearch.cpp.

◆ operator=()

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

Definition at line 94 of file NNITopologySearch.h.

References algorithm_, searchableTree_, topoListeners_, and verbose_.

◆ search()

void NNITopologySearch::search ( )
throw (Exception
)
virtual

Performs the search.

Implements bpp::TopologySearch.

Definition at line 85 of file NNITopologySearch.cpp.

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

◆ searchBetter()

void NNITopologySearch::searchBetter ( )
throw (Exception
)
protected

◆ searchFast()

void NNITopologySearch::searchFast ( )
throw (Exception
)
protected

◆ searchPhyML()

void NNITopologySearch::searchPhyML ( )
throw (Exception
)
protected

Member Data Documentation

◆ algorithm_

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

Definition at line 71 of file NNITopologySearch.h.

Referenced by operator=().

◆ BETTER

const string NNITopologySearch::BETTER = "Better"
static

◆ FAST

const string NNITopologySearch::FAST = "Fast"
static

◆ PHYML

const string NNITopologySearch::PHYML = "PhyML"
static

◆ searchableTree_

NNISearchable* bpp::NNITopologySearch::searchableTree_
private

Definition at line 70 of file NNITopologySearch.h.

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

◆ topoListeners_

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

◆ verbose_

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: