1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
// $Id: C_evalParamUSSRV.cpp 1915 2007-04-04 15:56:24Z privmane $
#include "C_evalParamUSSRV.h"
// *********************
// * USSRV *
// *********************
MDOUBLE C_evalParamUSSRV::operator() (MDOUBLE param) {
setParam(param);
MDOUBLE res = likelihoodComputation2USSRV::getTreeLikelihoodAllPosAlphTheSame(_et,_sc,_baseSc,*_pModel,_weights);
print(param,res);
return -res;
}
void C_evalAlphaUSSRV::setParam(MDOUBLE alpha)
{
if (_pModel->noOfCategor() == 1)
errorMsg::reportError(" one category when trying to optimize alpha");
_pModel->updateAlpha(alpha);
}
void C_evalAlphaUSSRV::print(MDOUBLE alpha,MDOUBLE res) {
LOG(5,<<" with Alpha = "<<alpha<<" logL = " <<res<<endl);
}
void C_evalNuUSSRV::setParam(MDOUBLE Nu)
{
_pModel->updateNu(Nu);
}
void C_evalNuUSSRV::print(MDOUBLE nu,MDOUBLE res) {
LOG(5,<<" with Nu = "<<nu<<" logL = " <<res<<endl);
}
void C_evalFUSSRV::setParam(MDOUBLE f)
{
_pModel->updateF(f);
}
void C_evalFUSSRV::print(MDOUBLE f,MDOUBLE res) {
LOG(5,<<" with F = "<<f<<" logL = " <<res<<endl);
}
// *********************
// * SSRV *
// *********************
MDOUBLE C_evalParamSSRV::operator() (MDOUBLE param) {
setParam(param);
MDOUBLE res = likelihoodComputation::getTreeLikelihoodAllPosAlphTheSame(_et,_sc,_ssrvSp,_weights);
print(param,res);
return -res;
}
void C_evalAlphaSSRV::setParam(MDOUBLE alpha)
{
if (alpha<0)
errorMsg::reportError("ERROR in C_evalAlphaSSRV::setParam, alpha is < 0 ");
replacementModelSSRV* pMulRM = static_cast<replacementModelSSRV*>(_ssrvSp.getPijAccelerator()->getReplacementModel());
gammaDistribution* gammaDist = static_cast<gammaDistribution*>(pMulRM->getDistribution());
gammaDist->setAlpha(alpha);
pMulRM->updateQ();
}
void C_evalAlphaSSRV::print(MDOUBLE alpha,MDOUBLE res) {
LOG(5,<<" with Alpha = "<<alpha<<" logL = " <<res<<endl);
}
void C_evalNuSSRV::setParam(MDOUBLE Nu)
{
if (Nu<0)
errorMsg::reportError("C_evalNuSSRV::setParam, nu is < 0 ");
static_cast<replacementModelSSRV*>(_ssrvSp.getPijAccelerator()->getReplacementModel())->setRateOfRate(Nu);
}
void C_evalNuSSRV::print(MDOUBLE nu,MDOUBLE res) {
LOG(5,<<" with Nu = "<<nu<<" logL = " <<res<<endl);
}
void C_evalTrTvSSRV::setParam(MDOUBLE TrTv)
{
replacementModelSSRV* pMulRM = static_cast<replacementModelSSRV*>(_ssrvSp.getPijAccelerator()->getReplacementModel());
static_cast<tamura92*>(pMulRM->getBaseRM())->changeTrTv(TrTv);
pMulRM->updateQ();
}
void C_evalTrTvSSRV::print(MDOUBLE TrTv,MDOUBLE res) {
LOG(5,<<" with TrTv = "<<TrTv<<" logL = " <<res<<endl);
}
void C_evalThetaSSRV::setParam(MDOUBLE Theta)
{
replacementModelSSRV* pMulRM = static_cast<replacementModelSSRV*>(_ssrvSp.getPijAccelerator()->getReplacementModel());
static_cast<tamura92*>(pMulRM->getBaseRM())->changeTheta(Theta);
pMulRM->updateFreq();
pMulRM->updateQ();
}
void C_evalThetaSSRV::print(MDOUBLE Theta,MDOUBLE res) {
LOG(5,<<" with Theta = "<<Theta<<" logL = " <<res<<endl);
}
|