Skip to content

Commit

Permalink
added upper bound on kappa, renumbering in addHybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
coraallensavietta committed Apr 27, 2020
1 parent 12463a8 commit adddc97
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/phyLiNCoptimization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const likAbsDelHybLiNC = -0.1 #= loglik decrease allowed when removing a hybrid
lower (more negative) values of lead to more hybrids removed during the search =#
const alphaRASmin = 0.02
const alphaRASmax = 50.0
const kappamax = 10.0

"""
CacheGammaLiNC
Expand Down Expand Up @@ -713,7 +714,7 @@ function addhybridedgeLiNC!(obj::SSM, currLik::Float64, maxhybrid::Int,
newhybridnode, newhybridedge = result
# unzip only at new node and its child edge
unzipat_canonical!(newhybridnode, getChildEdge(newhybridnode))
updateSSM!(obj)
updateSSM!(obj, true; constraints=constraints)
optimizelocalgammas_LiNC!(obj, newhybridedge, ftolRel, γcache)
if newhybridedge.gamma == 0.0
deletehybridedge!(obj.net, newhybridedge, false,true) # nofuse,unroot
Expand Down
3 changes: 3 additions & 0 deletions src/traitsLikDiscrete.jl
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ function fit!(obj::SSM; optimizeQ=true::Bool, optimizeRVAS=true::Bool,
NLopt.maxeval!(optQ, maxeval) # max number of iterations
# NLopt.maxtime!(optQ, t::Real)
NLopt.lower_bounds!(optQ, zeros(Float64, nparQ))
if typeof(obj.model) == HKY85 # set an upper bound on kappa values
NLopt.upper_bounds!(optQ, fill(kappamax,nparQ))
end
# fixit: set upper bound depending on branch lengths in network?
NLopt.max_objective!(optQ, loglikfun)
fmax, xmax, ret = NLopt.optimize(optQ, obj.model.rate)
Expand Down

0 comments on commit adddc97

Please sign in to comment.