bpp-phyl  2.1.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:

List of all members.

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.
void addTopologyListener (TopologyListener *listener)
 Add a listener to the list.
const TreegetTopology () const
 Retrieve the tree.
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.
void notifyAllTested (const TopologyChangeEvent &event)
 Process a TopologyChangeEvent to all listeners.
void notifyAllSuccessful (const TopologyChangeEvent &event)
 Process a TopologyChangeEvent to all listeners.

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.

Definition at line 83 of file NNITopologySearch.h.

References topoListeners_.

virtual bpp::NNITopologySearch::~NNITopologySearch ( ) [inline, virtual]

Definition at line 107 of file NNITopologySearch.h.

References topoListeners_.


Member Function Documentation

void bpp::NNITopologySearch::addTopologyListener ( TopologyListener listener) [inline, virtual]

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

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

Returns:
The NNISearchable object associated to this instance.

Definition at line 147 of file NNITopologySearch.h.

References searchableTree_.

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_.

void NNITopologySearch::notifyAllPerformed ( const TopologyChangeEvent event) [protected]

Process a TopologyChangeEvent to all listeners.

Definition at line 58 of file NNITopologySearch.cpp.

void NNITopologySearch::notifyAllSuccessful ( const TopologyChangeEvent event) [protected]

Process a TopologyChangeEvent to all listeners.

Definition at line 76 of file NNITopologySearch.cpp.

void NNITopologySearch::notifyAllTested ( const TopologyChangeEvent event) [protected]

Process a TopologyChangeEvent to all listeners.

Definition at line 67 of file NNITopologySearch.cpp.

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


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]
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:
 All Classes Namespaces Files Functions Variables Typedefs Friends