source: trunk/GDE/PHYML20130708/phyml/src/spr.h

Last change on this file was 10307, checked in by aboeckma, 11 years ago

added most recent version of phyml

File size: 3.1 KB
Line 
1/*
2** spr.h: Header file for the SPR routines.
3**
4** Wim Hordijk   Last modified: 28 August 2006
5*/
6
7#include <config.h>
8
9#ifndef _SPR_H_
10#define _SPR_H_
11
12#include "utilities.h"
13#include "models.h"
14#include "lk.h"
15#include "free.h"
16#include "optimiz.h"
17#include "alrt.h"
18#include "pars.h"
19#include "simu.h"
20
21#define ALL   1
22#define BEST  2
23#define ONE   3
24
25/*
26** _move_: Structure for holding the relevant information for candidate SPR moves.
27*/
28
29typedef struct
30{
31  t_node   *v_prune, *u_prune, *v_n, *v_nx1, *u_n, **path;
32  t_edge   *e_prune, *e_regraft;
33  phydbl  l_connect, l_est[3], delta_lk, d_L, d_up_v, d_un_v;
34  int     dist, rgrft_rank, optim_rank, globl_rank;
35} _move_;
36
37
38
39void Init_SPR          (t_tree *tree);
40void Clean_SPR         (t_tree *tree);
41void Optim_SPR         (t_tree *tree, int max_size, int method);
42int  Perform_SPR_Moves (t_tree *tree, int max_size);
43int  Perform_Best_SPR  (t_tree *tree, int max_size);
44int  Perform_One_SPR   (t_tree *tree, int max_size);
45
46void Calc_Tree_Length (t_edge *e_prune, t_node *v_prune, t_tree *tree);
47void Tree_Length      (t_node *v_prune, t_node *u_prune, t_node *v_n, t_node *v_n_1,
48                       t_node *v_nx1, t_node *v_0, t_node *u_n, phydbl d_up_v_1,
49                       phydbl d_uu, phydbl d_L_1, int n, t_tree *tree);
50int  Est_Lk_Change    (t_edge *e_prune, t_node *v_prune, t_tree *tree);
51int  Best_Lk_Change   (t_edge *e_prune, t_node *v_prune, t_tree *tree);
52void Make_Move        (_move_ *move, int type, t_tree *tree);
53int  Find_Optim_Local (t_tree *tree);
54int  Find_Optim_Globl (t_tree *tree);
55void Prune            (t_edge *e, t_node *v, t_edge **e_connect, t_edge **e_avail,
56                       t_tree *tree);
57void Regraft          (t_edge *e, t_node *v, t_edge *avail, t_tree *tree);
58void PostOrder_v      (t_tree *tree, t_node *v, t_edge *e);
59void PostOrder_w      (t_tree *tree, t_node *v, t_edge *v_e, t_node *w, t_edge *e);
60
61
62
63
64
65void Speed_Spr(t_tree *tree, int max_cycles);
66void Speed_Spr_Loop(t_tree *tree);
67void Make_Spr_List(t_tree *tree);
68void Init_One_Spr(t_spr *a_spr);
69t_spr *Make_One_Spr(t_tree *tree);
70int Spr(phydbl init_lnL, t_tree *tree);
71int Spr_Recur(t_node *a, t_node *d, t_tree *tree);
72int Test_All_Spr_Targets(t_edge *pulled, t_node *link, t_tree *tree);
73void Randomize_Spr_List(t_tree *tree);
74void Test_One_Spr_Target_Recur(t_node *a, t_node *d, t_edge *pulled, t_node *link, t_edge *residual, int *best_found, t_tree *tree);
75phydbl Test_One_Spr_Target(t_edge *target, t_edge *arrow, t_node *link, t_edge *residual, t_tree *tree);
76void Apply_Spr_Moves_One_By_One(t_tree *tree);
77int Try_One_Spr_Move_Triple(t_spr *move, t_tree *tree);
78int Try_One_Spr_Move_Full(t_spr *move, t_tree *tree);
79void Make_Best_Spr(t_tree *tree);
80void Random_Spr(int n_moves, t_tree *tree);
81void Include_One_Spr_To_List_Of_Spr(t_spr *move, t_tree *tree);
82void Reset_Spr_List(t_tree *tree);
83int Evaluate_List_Of_Regraft_Pos_Triple(t_spr **spr_list, int list_size, t_tree *tree);
84void Best_Spr(t_tree *tree);
85int Check_Spr_Move_Validity(t_spr *this_spr_move, t_tree *tree);
86void Spr_Subtree(t_edge *b, t_node *link, t_tree *tree);
87void Spr_Pars(t_tree *tree);
88void SPR_Shuffle(t_tree *tree);
89
90
91
92#endif  /* _SPR_H_ */
93
94
95/*
96** EOF: spr.h
97*/
Note: See TracBrowser for help on using the repository browser.