}
}
static FactorGraph createBoltzmannChain (int len)
{
Randoms r = new Randoms (3241321);
List<Variable> vars = new ArrayList<Variable> ();
for (int i = 0; i < len; i++) {
Variable x_i = new Variable (2);
x_i.setLabel ("X_"+i);
vars.add (x_i);
}
List<Factor> factors = new ArrayList<Factor> (vars.size ());
// node factors
for (int i = 0; i < len; i++) {
double u = r.nextUniform (-4.0, 4.0);
factors.add (new BoltzmannUnaryFactor (vars.get (i), u));
}
// edge factors
for (int i = 0; i < len-1; i++) {