1 /*
2  * modelfactorymixlen.h
3  *
4  *  Created on: Sep 2, 2015
5  *      Author: minh
6  */
7 
8 
9 #include "modelfactory.h"
10 
11 class ModelFactoryMixlen : public ModelFactory {
12 
13 public:
14 
15 	/**
16 		constructor
17 		create substitution model with possible rate heterogeneity. Create proper class objects
18 		for two variables: model and site_rate. It takes the following field of params into account:
19 			model_name, num_rate_cats, freq_type, store_trans_matrix
20 		@param params program parameters
21 		@param tree associated phylogenetic tree
22 	*/
23 	ModelFactoryMixlen(Params &params, string &model_name, PhyloTree *tree, ModelsBlock *models_block);
24 
25 	/**
26 		optimize model parameters and tree branch lengths
27 		@param fixed_len TRUE to fix branch lengths, default is false
28 		@return the best likelihood
29 	*/
30 	virtual double optimizeParameters(int fixed_len = BRLEN_OPTIMIZE, bool write_info = true,
31                                       double logl_epsilon = 0.1, double gradient_epsilon = 0.0001);
32 
33     /**
34         sort classes in ascending order of tree lengths
35         @return tree string with sorted branch lengths
36     */
37     string sortClassesByTreeLength();
38 
39 
40     /**
41      * @param brlen_type either BRLEN_OPTIMIZE, BRLEN_FIX or BRLEN_SCALE
42      * @return #parameters of the model + # branches
43      */
44     virtual int getNParameters(int brlen_type);
45 
46 };
47