|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_TREE_MASS_TREE_PHYLO_FACTOR_H_
2 #define GENESIS_TREE_MASS_TREE_PHYLO_FACTOR_H_
38 #include <unordered_set>
60 double(
size_t iteration,
size_t edge_index, std::vector<double>
const& balances )
120 std::unordered_set<size_t>
const& candidate_edges
130 std::unordered_set<size_t>
const& candidate_edges,
169 std::function<
double( std::vector<double>
const& balances )> objective,
170 size_t max_iterations = 0,
171 std::function<
void(
size_t iteration,
size_t max_iterations )> log_progress = {}
186 BalanceData
const& data,
188 size_t max_iterations = 0,
189 std::function<
void(
size_t iteration,
size_t max_iterations )> log_progress = {}
195 #endif // include guard
std::unordered_set< size_t > phylo_factor_subtree_indices(Subtree const &subtree, std::unordered_set< size_t > const &candidate_edges)
Helper function for phylogenetic_factorization() to find the constrained subtrees that are split by a...
std::vector< double > balances
The balances for all Samples calculated on the two sets of edge indices of this factor.
Tree MassTree
Alias for a Tree that stores masses on its TreeEdges.
size_t edge_index
The edge that this factor found to be maximizing for the objective function.
A single phylogenetic factor.
std::vector< double > all_objective_values
For reference, all other objective values for the other edges of the tree.
Data needed to calculate balances.
double objective_value
The objective value obtained from the objective function using the balances.
std::function< double(size_t iteration, size_t edge_index, std::vector< double > const &balances) > PhyloFactorObjectiveFunction
Function type used as the objective function in phylogenetic_factorization().
std::unordered_set< size_t > edge_indices_secondary
The set of edges on the non-root (secondary) side of the edge that belongs to this factor.
Reference to a subtree of a Tree.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
std::vector< PhyloFactor > phylogenetic_factorization(BalanceData const &data, std::function< double(std::vector< double > const &balances)> objective, size_t max_iterations, std::function< void(size_t iteration, size_t max_iterations)> log_progress)
Calculate the Phylogenetic Factorization (PhyloFactor) of a set of MassTrees.
PhyloFactor phylo_factor_find_best_edge(size_t iteration, BalanceData const &data, std::unordered_set< size_t > const &candidate_edges, PhyloFactorObjectiveFunction objective)
Helper function for phylogenetic_factorization() that tries all candidate edges to find the one that ...
std::unordered_set< size_t > edge_indices_primary
The set of edges on the root (primary) side of the edge that belongs to this factor.