Skip to content

Commit

Permalink
re-make scaleFactor optional in GMRF block operator
Browse files Browse the repository at this point in the history
  • Loading branch information
msuchard committed Sep 26, 2024
1 parent 622c2f9 commit 3519890
Showing 1 changed file with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,21 @@ public String format(LogRecord record) {
if (mode == AdaptationMode.DEFAULT) mode = AdaptationMode.ADAPTATION_ON;

double weight = xo.getDoubleAttribute(MCMCOperator.WEIGHT);
double scaleFactor = xo.getDoubleAttribute(SCALE_FACTOR);
if (scaleFactor == 1.0) {
mode = AdaptationMode.ADAPTATION_OFF;
}

double scaleFactor = 1.0;
if (xo.hasAttribute(SCALE_FACTOR)) {
scaleFactor = xo.getDoubleAttribute(SCALE_FACTOR);
if (scaleFactor == 1.0) {
mode = AdaptationMode.ADAPTATION_OFF;
}

// if (scaleFactor <= 0.0) {
// throw new XMLParseException("scaleFactor must be greater than 0.0");
if (scaleFactor < 1.0) {
throw new XMLParseException("scaleFactor must be greater than or equal to 1.0");
if (scaleFactor < 1.0) {
throw new XMLParseException("scaleFactor must be greater than or equal to 1.0");
}
} else {
mode = AdaptationMode.ADAPTATION_OFF;
}

int maxIterations = xo.getAttribute(MAX_ITERATIONS, 200);
Expand Down Expand Up @@ -143,7 +149,7 @@ public XMLSyntaxRule[] getSyntaxRules() {
}

private XMLSyntaxRule[] rules = new XMLSyntaxRule[]{
AttributeRule.newDoubleRule(SCALE_FACTOR),
AttributeRule.newDoubleRule(SCALE_FACTOR, true),
AttributeRule.newDoubleRule(MCMCOperator.WEIGHT),
AttributeRule.newBooleanRule(AdaptableMCMCOperator.AUTO_OPTIMIZE, true),
AttributeRule.newDoubleRule(STOP_VALUE, true),
Expand Down

0 comments on commit 3519890

Please sign in to comment.