Search in sources :

Example 1 with TreeBitRandomWalkOperator

use of dr.evomodel.operators.TreeBitRandomWalkOperator in project beast-mcmc by beast-dev.

the class TreeBitRandomWalkOperatorParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
    DefaultTreeModel treeModel = (DefaultTreeModel) xo.getChild(DefaultTreeModel.class);
    String trait1 = null;
    String trait2 = null;
    if (xo.hasAttribute(INDICTATOR_TRAIT))
        trait1 = xo.getStringAttribute(INDICTATOR_TRAIT);
    if (xo.hasAttribute(TRAIT2))
        trait2 = xo.getStringAttribute(TRAIT2);
    int k = xo.getAttribute("k", 1);
    boolean swapTrait2 = xo.getAttribute(SWAP_TRAIT2, true);
    return new TreeBitRandomWalkOperator(treeModel, trait1, trait2, weight, k, swapTrait2);
}
Also used : DefaultTreeModel(dr.evomodel.tree.DefaultTreeModel) TreeBitRandomWalkOperator(dr.evomodel.operators.TreeBitRandomWalkOperator)

Example 2 with TreeBitRandomWalkOperator

use of dr.evomodel.operators.TreeBitRandomWalkOperator in project beast-mcmc by beast-dev.

the class RLYModelTest method testTreeBitRandomWalk.

public void testTreeBitRandomWalk() {
    DefaultTreeModel treeModel = new DefaultTreeModel("treeModel", tree);
    Parameter I = treeModel.createNodeTraitsParameter(birthRateIndicator, new double[] { 1 });
    Parameter b = treeModel.createNodeTraitsParameter(birthRate, new double[] { 1 });
    OperatorSchedule schedule = new SimpleOperatorSchedule();
    TreeBitRandomWalkOperator tbrw = new TreeBitRandomWalkOperator(treeModel, birthRateIndicator, birthRate, 1.0, 4, true);
    BitFlipOperator bfo = new BitFlipOperator(I, 1.0, true);
    schedule.addOperator(tbrw);
    schedule.addOperator(bfo);
    randomLocalYuleTester(treeModel, I, b, schedule);
}
Also used : SimpleOperatorSchedule(dr.inference.operators.SimpleOperatorSchedule) OperatorSchedule(dr.inference.operators.OperatorSchedule) SimpleOperatorSchedule(dr.inference.operators.SimpleOperatorSchedule) BitFlipOperator(dr.inference.operators.BitFlipOperator) Parameter(dr.inference.model.Parameter) DefaultTreeModel(dr.evomodel.tree.DefaultTreeModel) TreeBitRandomWalkOperator(dr.evomodel.operators.TreeBitRandomWalkOperator)

Aggregations

TreeBitRandomWalkOperator (dr.evomodel.operators.TreeBitRandomWalkOperator)2 DefaultTreeModel (dr.evomodel.tree.DefaultTreeModel)2 Parameter (dr.inference.model.Parameter)1 BitFlipOperator (dr.inference.operators.BitFlipOperator)1 OperatorSchedule (dr.inference.operators.OperatorSchedule)1 SimpleOperatorSchedule (dr.inference.operators.SimpleOperatorSchedule)1