Package pal.treesearch
Class PivotNode
- java.lang.Object
-
- pal.treesearch.AbstractParentableConstrainedNode
-
- pal.treesearch.PivotNode
-
- All Implemented Interfaces:
FreeNode
,GeneralOptimisable
,GeneralTreeComponent
,GroupLeader
,ParentableConstrainedNode
,RootAccess
public class PivotNode extends AbstractParentableConstrainedNode implements GeneralOptimisable, ParentableConstrainedNode, FreeNode, RootAccess, GroupLeader
-
-
Constructor Summary
Constructors Constructor Description PivotNode(Node tree, FreeBranch parentConnection, GeneralConstructionTool tool, GeneralConstraintGroupManager constraintGroupManager, GeneralConstraintGroupManager.Store store)
The subtree constructor with a connection to the rest of the treePivotNode(Node subTree, GeneralConstructionTool tool, GeneralConstraintGroupManager groupManager, GeneralConstraintGroupManager.Store store)
The root constructor, only used when the whole tree is constrained
-
Method Summary
-
Methods inherited from class pal.treesearch.AbstractParentableConstrainedNode
adjustNodeHeight, buildDescendentPALNodeBase, buildDescendentPALNodeES, buildLeftDecendentPALNodeBase, buildRightDecendentPALNodeBase, getAllComponents, getConstrainedInternal, getDescendentExtendedConditionals, getDescendentExtendedConditionalsWithAdjustedInternalHeights, getDescendentFlatConditionals, getDescendentLogLikelihood, getDescendentPatternInfo, getLeftChild, getLeftChildPatternInfo, getLeftDescendentExtendedConditionals, getLeftDescendentExtendedConditionals, getMaxChildHeight, getMaxOriginalDescendentLeafHeight, getMinimumChildSeperation, getMinimumChildSeperation, getMinimumDirectChildDistance, getMinimumLeafChildSeperation, getMinimumLeafChildSeperation, getMinOriginalDescendentLeafHeight, getNodeHeight, getNonSubTreeOfChildComponents, getRightChild, getRightChildPatternInfo, getRightDescendentExtendedConditionals, getRightDescendentExtendedConditionals, getSubTreeComponents, isLeftChild, obtainConstrainedExternalCalculator, obtainLeafInformation, rebuildDescendentPattern, recursivelyAdjustNodeHeight, recursivelySetChildrenParentPivot, setNodeHeight, setupInternalNodeHeights, toStringHeights, toStringLengths, toStringLengths
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface pal.treesearch.GeneralTreeComponent
getAllComponents
-
Methods inherited from interface pal.treesearch.GroupLeader
obtainLeafInformation
-
Methods inherited from interface pal.treesearch.ParentableConstrainedNode
getNodeHeight, getNonSubTreeOfChildComponents
-
Methods inherited from interface pal.treesearch.RootAccess
getAllComponents
-
-
-
-
Constructor Detail
-
PivotNode
public PivotNode(Node tree, FreeBranch parentConnection, GeneralConstructionTool tool, GeneralConstraintGroupManager constraintGroupManager, GeneralConstraintGroupManager.Store store)
The subtree constructor with a connection to the rest of the tree- Parameters:
tree
- the PAL node tree to base this tree onparentConnection
- The connection with the rest of tree (must be free, otherwise this shouldn't be the pivot)tool
- A general construction tool object for objtaining/building various componentsgroupConstraints
- The constraints object that manages the leaf constraints
-
PivotNode
public PivotNode(Node subTree, GeneralConstructionTool tool, GeneralConstraintGroupManager groupManager, GeneralConstraintGroupManager.Store store)
The root constructor, only used when the whole tree is constrained- Parameters:
tool
- A general construction tool object for objtaining/building various componentssubTree
- The subtreegroupConstraints
- The constraints object that manages the leaf constraints
-
-
Method Detail
-
postSetupNotify
public void postSetupNotify(ConstraintModel.GroupManager groupConstraints)
Description copied from interface:GroupLeader
Tell the group leader that the groupConstraints have been set up (parameter wise), and that internal node heights for example may be calculated- Specified by:
postSetupNotify
in interfaceGroupLeader
-
buildPALNodeBase
public Node buildPALNodeBase()
- Specified by:
buildPALNodeBase
in interfaceRootAccess
-
buildPALNodeES
public Node buildPALNodeES()
- Specified by:
buildPALNodeES
in interfaceRootAccess
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAscendentExtended
public ConditionalProbabilityStore getAscendentExtended(double baseHeight, ConstrainedNode childCaller, GeneralConstructionTool tool, boolean allowCaching)
- Specified by:
getAscendentExtended
in interfaceParentableConstrainedNode
-
getAscendentFlat
public ConditionalProbabilityStore getAscendentFlat(ConstrainedNode childCaller, GeneralConstructionTool tool, boolean allowCaching)
- Specified by:
getAscendentFlat
in interfaceParentableConstrainedNode
-
getAscendentPatternInfo
public PatternInfo getAscendentPatternInfo(ConstrainedNode childCaller, GeneralConstructionTool tool)
- Specified by:
getAscendentPatternInfo
in interfaceParentableConstrainedNode
-
calculateLogLikelihood
public double calculateLogLikelihood(GeneralConstructionTool tool)
- Specified by:
calculateLogLikelihood
in interfaceRootAccess
-
getPatternInfo
public PatternInfo getPatternInfo(GeneralConstructionTool tool, FreeBranch caller)
- Specified by:
getPatternInfo
in interfaceFreeNode
-
hasConnection
public boolean hasConnection(FreeBranch c, FreeBranch caller)
- Specified by:
hasConnection
in interfaceFreeNode
-
getLeftBranch
public FreeBranch getLeftBranch(FreeBranch caller)
- Specified by:
getLeftBranch
in interfaceFreeNode
-
getRightBranch
public FreeBranch getRightBranch(FreeBranch caller)
- Specified by:
getRightBranch
in interfaceFreeNode
-
getAllComponents
public void getAllComponents(java.util.ArrayList store, java.lang.Class componentType, FreeBranch caller)
Description copied from interface:FreeNode
Recurse to all neighbours but caller- Specified by:
getAllComponents
in interfaceFreeNode
-
testLikelihood
public void testLikelihood(FreeBranch caller, GeneralConstructionTool tool)
- Specified by:
testLikelihood
in interfaceFreeNode
-
testLikelihood
public void testLikelihood(GeneralConstructionTool tool)
- Specified by:
testLikelihood
in interfaceRootAccess
-
getLeftPatternInfo
public PatternInfo getLeftPatternInfo(GeneralConstructionTool tool, FreeBranch caller)
- Specified by:
getLeftPatternInfo
in interfaceFreeNode
- Returns:
- Get the pattern info for the relative left (from the caller's perspective), or null if not left pattern info
-
getRightPatternInfo
public PatternInfo getRightPatternInfo(GeneralConstructionTool tool, FreeBranch caller)
- Specified by:
getRightPatternInfo
in interfaceFreeNode
- Returns:
- Get the pattern info for the relative right (from the caller's perspective), or null if not right pattern info
-
getExtendedConditionalProbabilities
public ConditionalProbabilityStore getExtendedConditionalProbabilities(double distance, FreeBranch caller, GeneralConstructionTool tool)
- Specified by:
getExtendedConditionalProbabilities
in interfaceFreeNode
-
getExtendedConditionalProbabilities
public ConditionalProbabilityStore getExtendedConditionalProbabilities(double distance, FreeBranch caller, UnconstrainedLikelihoodModel.External external, ConditionalProbabilityStore resultStore, GeneralConstructionTool tool)
- Specified by:
getExtendedConditionalProbabilities
in interfaceFreeNode
-
extract
public FreeBranch extract(FreeBranch caller)
We can't extract
-
buildPALNodeES
public Node buildPALNodeES(double branchLength_, FreeBranch caller)
- Specified by:
buildPALNodeES
in interfaceFreeNode
-
buildPALNodeBase
public Node buildPALNodeBase(double branchLength_, FreeBranch caller)
- Specified by:
buildPALNodeBase
in interfaceFreeNode
-
getFlatConditionalProbabilities
public ConditionalProbabilityStore getFlatConditionalProbabilities(FreeBranch caller, GeneralConstructionTool tool)
- Specified by:
getFlatConditionalProbabilities
in interfaceFreeNode
-
toString
public java.lang.String toString(FreeBranch caller)
-
setConnectingBranches
public void setConnectingBranches(FreeBranch[] store, int number)
- Specified by:
setConnectingBranches
in interfaceFreeNode
-
hasDirectConnection
public boolean hasDirectConnection(FreeBranch query)
- Specified by:
hasDirectConnection
in interfaceFreeNode
-
swapConnection
public void swapConnection(FreeBranch original, FreeBranch newConnection)
Should not do anything but swap branches around- Specified by:
swapConnection
in interfaceFreeNode
-
swapConnection
public void swapConnection(FreeBranch original, FreeNode nodeToReplace, FreeBranch newConnection)
Should preserve tree integrity- Specified by:
swapConnection
in interfaceFreeNode
-
getNonSubTreeComponents
public void getNonSubTreeComponents(java.util.ArrayList store, java.lang.Class componentType)
- Specified by:
getNonSubTreeComponents
in classAbstractParentableConstrainedNode
-
getNumberOfOptimisationTypes
public int getNumberOfOptimisationTypes()
- Specified by:
getNumberOfOptimisationTypes
in interfaceGeneralOptimisable
-
optimise
public double optimise(int optimisationType, UnivariateMinimum minimiser, GeneralConstructionTool tool, int fracDigits)
- Specified by:
optimise
in interfaceGeneralOptimisable
minimiser
- The single dimensional minimisation tooltool
- The construction toolfracDigits
- the number of fractional digits to converge to- Returns:
- The optimised log likelihood, or >0 if not optimisation occured
-
-