use of dr.evomodel.operators.SubtreeLeapOperator in project beast-mcmc by beast-dev.
the class SubtreeLeapOperatorParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
CoercionMode mode = CoercionMode.parseMode(xo);
TreeModel treeModel = (TreeModel) xo.getChild(TreeModel.class);
final double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
final double size = xo.getAttribute("size", 1.0);
final double prob = xo.getAttribute("accP", 0.234);
if (Double.isInfinite(size) || size <= 0.0) {
throw new XMLParseException("size attribute must be positive and not infinite. was " + size);
}
if (prob <= 0.0 || prob >= 1.0) {
throw new XMLParseException("Target acceptance probability has to lie in (0, 1). Currently: " + prob);
}
SubtreeLeapOperator operator = new SubtreeLeapOperator(treeModel, weight, size, prob, mode);
return operator;
}
Aggregations